📄 qiplotaxis.pas
字号:
TiPlotComponentAccess(Owner).DoObjectClick(Self)
end
finally
FMouseDown := False;
end;
end;
//****************************************************************************************************************************************************
function TiPlotAxis.iMouseWheel(WheelDelta: Integer; Shift: TShiftState; const MousePos: TPoint): Boolean;
var
Sign : Integer;
begin
Result := True;
if WheelDelta = 0 then Exit;
TrackingEnabled := False;
Sign := WheelDelta div ABS(WheelDelta);
case GetActualMode of
ipamScroll : case
FScaleType of
ipstLinear : ScrollPercentByReference(Min, Span, Max, Sign*0.05);
ipstLog10 : ScrollPercentByReference(Min, Max, Max, Sign*0.05);
end;
ipamZoom : case FScaleType of
ipstLinear : ZoomPercentByReference(Min, Span, Max, Sign*0.0250);
ipstLog10 : ZoomPercentByReference(Min, Span, Max, Sign*0.0500);
end;
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.iKeyDown(var CharCode: Word; Shift: TShiftState);
var
Percent : Double;
begin
if FMasterUIInput then TiPlotComponentAccess(Owner).MasterAxisKeyDown(Self, CharCode, Shift);
TrackingEnabled := False;
case CharCode of
VK_LEFT : Percent := -0.01;
VK_DOWN : Percent := -0.01;
VK_RIGHT : Percent := +0.01;
VK_UP : Percent := +0.01;
VK_PRIOR : Percent := +1.00;
VK_NEXT : Percent := -1.00;
VK_HOME : Percent := -1.00;
VK_END : Percent := +1.00;
else Percent := 0;
end;
if Percent <> 0 then
begin
TriggerInvalidateNow(Self);
case FMode of
ipamScroll : ScrollPercentByReference(Min, Span, Max, Percent);
ipamZoom : ZoomPercentByReference (Min, Span, Max, Percent);
end;
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.DefineProperties(Filer: TFiler);
begin
inherited DefineProperties(Filer);
Filer.DefineProperty('Span_2', ReadSpan, WriteSpan, False);
Filer.DefineProperty('Span', ReadSpan, WriteSpan, False);
Filer.DefineProperty('LabelSeparation', ReadLabelSeperation, WriteLabelSeperation, FLabelSeparation = 0);
Filer.DefineProperty('TitleMargin', ReadTitleMargin, WriteTitleMargin, FTitleMargin = 0);
end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.WriteSpan (Writer: TWriter);begin Writer.WriteFloat(FSpan );end;
procedure TiPlotAxis.WriteLabelSeperation(Writer: TWriter);begin Writer.WriteFloat(FLabelSeparation);end;
procedure TiPlotAxis.WriteTitleMargin (Writer: TWriter);begin Writer.WriteFloat(FTitleMargin );end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.ReadSpan (Reader: TReader);begin FSpan := Reader.ReadFloat;end;
procedure TiPlotAxis.ReadLabelSeperation (Reader: TReader);begin FLabelSeparation := Reader.ReadFloat;end;
procedure TiPlotAxis.ReadTitleMargin (Reader: TReader);begin FTitleMargin := Reader.ReadFloat;end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.SetLabelsMargin (const Value:Double );begin SetDoubleProperty (Value,FLabelsMargin, TriggerChange);end;
procedure TiPlotAxis.SetLabelsPrecision (const Value:Integer);begin SetIntegerProperty(Value,FLabelsPrecision, TriggerChange);end;
procedure TiPlotAxis.SetLabelsMinLength (const Value:Double );begin SetDoubleProperty (Value,FLabelsMinLength, TriggerChange);end;
procedure TiPlotAxis.SetMajorLength (const Value:Integer);begin SetIntegerProperty(Value,FMajorLength, TriggerChange);end;
procedure TiPlotAxis.SetInnerMargin (const Value:Integer);begin SetIntegerProperty(Value,FInnerMargin, TriggerChange);end;
procedure TiPlotAxis.SetOuterMargin (const Value:Integer);begin SetIntegerProperty(Value,FOuterMargin, TriggerChange);end;
procedure TiPlotAxis.SetMinorCount (const Value:Integer);begin SetIntegerProperty(Value,FMinorCount, TriggerChange);end;
procedure TiPlotAxis.SetMinorLength (const Value:Integer);begin SetIntegerProperty(Value,FMinorLength, TriggerChange);end;
procedure TiPlotAxis.SetReverseScale (const Value:Boolean);begin SetBooleanProperty(Value,FReverseScale, TriggerChange);end;
procedure TiPlotAxis.SetTitle (const Value:String );begin SetStringProperty (Value,FTitle, TriggerChange);end;
procedure TiPlotAxis.SetTitleRotated (const Value:Boolean);begin SetBooleanProperty(Value,FTitleRotated, TriggerChange);end;
procedure TiPlotAxis.SetTitleShow (const Value:Boolean);begin SetBooleanProperty(Value,FTitleShow, TriggerChange);end;
procedure TiPlotAxis.SetTitleMargin (const Value:Double );begin SetDoubleProperty (Value,FTitleMargin, TriggerChange);end;
procedure TiPlotAxis.SetScaleLineShow (const Value:Boolean);begin SetBooleanProperty(Value,FScaleLineShow, TriggerChange);end;
procedure TiPlotAxis.SetScaleLinesShow (const Value:Boolean);begin SetBooleanProperty(Value,FScaleLinesShow, TriggerChange);end;
procedure TiPlotAxis.SetTrackingScrollCompressMax(const Value:Double );begin SetDoubleProperty (Value,FTrackingScrollCompressMax,TriggerChange);end;
procedure TiPlotAxis.SetStackingEndsMargin (const Value:Double );begin SetDoubleProperty (Value,FStackingEndsMargin, TriggerChange);end;
procedure TiPlotAxis.SetLabelsVisible (const Value:Boolean);begin SetBooleanProperty(Value,FLabelsVisible, TriggerChange);end;
procedure TiPlotAxis.SetLabelSeparation (const Value:Double );begin SetDoubleProperty (Value,FLabelSeparation, TriggerChange);end;
procedure TiPlotAxis.SetScaleLinesColor (const Value:TColor );begin SetColorProperty (Value,FScaleLinesColor, TriggerChange);end;
procedure TiPlotAxis.SetDateTimeFormat (const Value:String );begin SetStringProperty (Value,FDateTimeFormat, TriggerChange);end;
procedure TiPlotAxis.SetLabelsMinLengthAutoAdjust(const Value:Boolean);begin SetBooleanProperty(Value,FLabelsMinLengthAutoAdjust,TriggerChange);end;
procedure TiPlotAxis.SetCursorScaler (const Value:Double );begin SetDoubleProperty (Value,FCursorScaler, TriggerChange);end;
procedure TiPlotAxis.SetRestoreValuesOnResume (const Value:Boolean);begin SetBooleanProperty(Value,FRestoreValuesOnResume, TriggerChange);end;
procedure TiPlotAxis.SetScrollMinMaxEnabled (const Value:Boolean);begin SetBooleanProperty(Value,FScrollMinMaxEnabled, TriggerChange);end;
procedure TiPlotAxis.SetScrollMax (const Value:Double );begin SetDoubleProperty (Value,FScrollMax, TriggerChange);end;
procedure TiPlotAxis.SetScrollMin (const Value:Double );begin SetDoubleProperty (Value,FScrollMin, TriggerChange);end;
procedure TiPlotAxis.SetMasterUIInput (const Value:Boolean);begin SetBooleanProperty(Value,FMasterUIInput, TriggerChange);end;
procedure TiPlotAxis.SetDesiredStart (const Value:Double );begin SetDoubleProperty (Value,FDesiredStart, TriggerChange);end;
procedure TiPlotAxis.SetCartesianChildRefValue (const Value:Double );begin SetDoubleProperty (Value,FCartesianChildRefValue, TriggerChange);end;
procedure TiPlotAxis.SetGridLinesVisible (const Value:Boolean);begin SetBooleanProperty(Value,FGridLinesVisible, TriggerChange);end;
procedure TiPlotAxis.SetCursorUseDefaultFormat (const Value:Boolean);begin SetBooleanProperty(Value,FCursorUseDefaultFormat, TriggerChange);end;
procedure TiPlotAxis.SetCursorDateTimeFormat (const Value:String );begin SetStringProperty (Value,FCursorDateTimeFormat, TriggerChange);end;
procedure TiPlotAxis.SetCursorPrecision (const Value:Integer);begin SetIntegerProperty(Value,FCursorPrecision, TriggerChange);end;
procedure TiPlotAxis.SetCursorMinLength (const Value:Double );begin SetDoubleProperty (Value,FCursorMinLength, TriggerChange);end;
procedure TiPlotAxis.SetCursorMinLengthAutoAdjust(const Value:Boolean);begin SetBooleanProperty(Value,FCursorMinLengthAutoAdjust,TriggerChange);end;
procedure TiPlotAxis.SetLegendUseDefaultFormat (const Value:Boolean);begin SetBooleanProperty(Value,FLegendUseDefaultFormat, TriggerChange);end;
procedure TiPlotAxis.SetLegendDateTimeFormat (const Value:String );begin SetStringProperty (Value,FLegendDateTimeFormat, TriggerChange);end;
procedure TiPlotAxis.SetLegendPrecision (const Value:Integer);begin SetIntegerProperty(Value,FLegendPrecision, TriggerChange);end;
procedure TiPlotAxis.SetLegendMinLength (const Value:Double );begin SetDoubleProperty (Value,FLegendMinLength, TriggerChange);end;
procedure TiPlotAxis.SetLegendMinLengthAutoAdjust(const Value:Boolean);begin SetBooleanProperty(Value,FLegendMinLengthAutoAdjust,TriggerChange);end;
procedure TiPlotAxis.SetTickListCustom (const Value:Boolean);begin SetBooleanProperty(Value,FTickListCustom, TriggerChange);end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.SetTitleFont (const Value:TFont);begin FTitleFont.Assign (Value);end;
procedure TiPlotAxis.SetLabelsFont(const Value:TFont);begin FLabelsFont.Assign(Value);end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.SetCartesianStyle(const Value: TiPlotCartesianStyle);
begin
if FCartesianStyle <> Value then
begin
FCartesianStyle := Value;
TriggerChange(Self);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.SetLabelsRotation(const Value: TiRotationAngle);
begin
if FLabelsRotation <> Value then
begin
FLabelsRotation := Value;
TriggerChange(Self);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.SetSpan(const Value : Double);
var
TempValue : Double;
OldValue : Double;
begin
TempValue := Value;
if TempValue < 1e-300 then TempValue := 1e-300;
if TempValue > 1e+300 then TempValue := 1e+300;
if FSpan <> TempValue then
begin
OldValue := FSpan;
FSpan := TempValue;
TriggerChange(Self);
if Owner is TiPlotComponent then TiPlotComponentAccess(Owner).DoAxesSpanChange (Self, OldValue, FSpan);
if not FBlockMinSpanEvent then if Owner is TiPlotComponent then TiPlotComponentAccess(Owner).DoAxesMinSpanChange(Self, Min, OldValue, Min, FSpan);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.SetMin(const Value : Double);
var
TempValue : Double;
OldValue : Double;
begin
TempValue := Value;
if TempValue > +1e+300 then TempValue := +1e+300;
if TempValue < -1e+300 then TempValue := -1e+300;
if FMin <> TempValue then
begin
OldValue := FMin;
FMin := TempValue;
TriggerChange(Self);
if Owner is TiPlotComponent then TiPlotComponentAccess(Owner).DoAxesMinChange (Self, OldValue, FMin);
if not FBlockMinSpanEvent then if Owner is TiPlotComponent then TiPlotComponentAccess(Owner).DoAxesMinSpanChange(Self, OldValue, Span, FMin, Span);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.SetDesiredIncrement(const Value: Double);
var
TempValue : Double;
begin
TempValue := Value;
if TempValue > +1e+300 then TempValue := +1e+300;
if TempValue < 0 then TempValue := 0;
if FDesiredIncrement <> TempValue then
begin
FDesiredIncrement := TempValue;
TriggerChange(Self);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.UpdateResumeValues;
begin
FPreviousMin := FMin;
FPreviousSpan := FSpan;
FPreviousLabelsMinLength := FLabelsMinLength;
end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.SetTrackingEnabled(const Value:Boolean);
begin
if FTrackingEnabled <> Value then
begin
FTrackingEnabled := Value;
if FRestoreValuesOnResume then
begin
if TrackingEnabled then
begin
SetMinSpan(FPreviousMin, FPreviousSpan);
FLabelsMinLength := FPreviousLabelsMinLength;
end
else UpdateResumeValues;
end;
TriggerChange(Self);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.SetLabelsFormatStyle(const Value: TiPlotTextFormat);
begin
if FLabelsFormatStyle <> Value then
begin
FLabelsFormatStyle := Value;
TriggerChange(Self);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.SetCursorFormatStyle(const Value: TiPlotTextFormat);
begin
if FCursorFormatStyle <> Value then
begin
FCursorFormatStyle := Value;
TriggerChange(Self);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAxis.SetLegendFormatStyle(const Value: TiPlotTextFormat);
begin
if FLegendFormatStyle <> Value then
begin
FLegendFormatStyle := Value;
TriggerChange(Self);
end;
end;
//****************************************************************************************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -