📄 teengine.pas
字号:
property Value:Double read FValue write SetValue;
end;
TAxisItems=class {$IFDEF CLR}sealed{$ENDIF} (TList)
private
FFormat: TTeeShape;
IAxis : TChartAxis;
function Get(Index:Integer):TAxisItem;
public
Constructor Create(Axis:TChartAxis);
Destructor Destroy; override;
Function Add(const Value: Double):TAxisItem; overload;
Function Add(const Value: Double; const Text:String):TAxisItem; overload;
Procedure CopyFrom(Source:TAxisItems);
Procedure Clear; override;
property Format:TTeeShape read FFormat;
property Item[Index:Integer]:TAxisItem read Get; default;
end;
TChartAxisPen=class {$IFDEF CLR}sealed{$ENDIF} (TChartPen)
private
public
Constructor Create(OnChangeEvent:TNotifyEvent);
published
property Width default 2;
end;
TAxisDrawLabelEvent=procedure(Sender:TChartAxis; var X,Y,Z:Integer; var Text:String;
var DrawLabel:Boolean) of object;
// internal event, used at TGridBandTool class (only)
TAxisDrawGrids=procedure(Sender:TChartAxis) of object;
TChartAxis=class(TCollectionItem)
private
{ scales }
FAutomatic : Boolean;
FAutomaticMaximum : Boolean;
FAutomaticMinimum : Boolean;
FDesiredIncrement : Double;
FMaximumValue : Double;
FMinimumValue : Double;
FLogarithmic : Boolean;
FLogarithmicBase : Double; // 6.0
FMaximumOffset : Integer;
FMinimumOffset : Integer;
{ axis }
FAxis : TChartAxisPen;
FPosAxis : Integer;
FZPosition : Double;
{ title }
FAxisTitle : TChartAxisTitle;
FTitleSize : Integer;
FPosTitle : Integer;
{ grid }
FGrid : TAxisGridPen;
{ labels }
FLabelsAlign : TAxisLabelAlign;
FLabelsAlternate : Boolean;
FLabelsAngle : Integer;
FItems : TAxisItems;
FLabelsOnAxis : Boolean;
FLabelsSeparation : Integer;
FLabelsSize : Integer;
FLabelStyle : TAxisLabelStyle;
FLabelsExponent : Boolean;
FLabelsMultiLine : Boolean;
FPosLabels : Integer;
FAxisValuesFormat : String;
FDateTimeFormat : String;
FExactDateTime : Boolean;
FRoundFirstLabel : Boolean;
{ ticks }
FMinorGrid : TChartHiddenPen;
FMinorTickCount : Integer;
FMinorTickLength : Integer;
FMinorTicks : TDarkGrayPen;
FTicks : TDarkGrayPen;
FTicksInner : TDarkGrayPen;
FTickInnerLength : Integer;
FTickLength : Integer;
FTickOnLabelsOnly : Boolean;
{ other }
FInverted : Boolean;
FHorizontal : Boolean;
FOtherSide : Boolean;
FParentChart : TCustomAxisPanel;
FVisible : Boolean;
FStartPosition : Double;
FEndPosition : Double;
FPositionPercent : Double;
FPosUnits : TTeeUnits;
// Events
FOnDrawLabel : TAxisDrawLabelEvent;
FMaster : TChartAxis;
{ internal }
IAxisDateTime : Boolean;
IAxisLogSizeRange : TChartValue;
IAxisSizeRange : TChartValue;
ICenterPos : Integer;
IDepthAxis : Boolean;
ILogMax : Double;
ILogMin : Double;
IMaximum : Double;
IMinimum : Double;
IRange : TChartValue;
IRangeLog : Double;
IRangeZero : Boolean;
ISeriesList : TCustomSeriesList;
IsVisible : Boolean;
IZPos : Integer;
Function DepthAxisAlign:Integer;
Function DepthAxisPos:Integer;
Function RoundLogPower(const Value:Double):Double;
Procedure SetAutomatic(Value:Boolean);
Procedure SetAutomaticMinimum(Value:Boolean);
Procedure SetAutomaticMaximum(Value:Boolean);
Procedure SetAutoMinMax(Var Variable:Boolean; Var2,Value:Boolean);
Procedure SetAxis(Value:TChartAxisPen);
procedure SetAxisTitle(Value:TChartAxisTitle);
Procedure SetDateTimeFormat(Const Value:String);
Procedure SetDesiredIncrement(Const Value:Double);
Procedure SetExactDateTime(Value:Boolean);
Procedure SetGrid(Value:TAxisGridPen);
procedure SetGridCentered(Value:Boolean);
Procedure SetLabels(Value:Boolean);
Procedure SetLabelsAlign(Value:TAxisLabelAlign);
Procedure SetLabelsAlternate(Value:Boolean);
Procedure SetLabelsAngle(const Value:Integer);
Procedure SetLabelsFont(Value:TTeeFont);
Procedure SetLabelsMultiLine(Value:Boolean);
Procedure SetLabelsOnAxis(Value:Boolean);
Procedure SetLabelsSeparation(Value:Integer);
Procedure SetLabelsSize(Value:Integer);
Procedure SetLabelStyle(Value:TAxisLabelStyle);
Procedure SetLogarithmic(Value:Boolean);
Procedure SetLogarithmicBase(const Value:Double);
Procedure SetMaximum(Const Value:Double);
Procedure SetMinimum(Const Value:Double);
Procedure SetMinorGrid(Value:TChartHiddenPen);
Procedure SetMinorTickCount(Value:Integer);
Procedure SetMinorTickLength(Value:Integer);
Procedure SetMinorTicks(Value:TDarkGrayPen);
procedure SetStartPosition(Const Value:Double);
procedure SetEndPosition(Const Value:Double);
procedure SetPositionPercent(Const Value:Double);
procedure SetPosUnits(const Value: TTeeUnits);
procedure SetRoundFirstLabel(Value:Boolean);
Procedure SetTickLength(Value:Integer);
Procedure SetTickInnerLength(Value:Integer);
Procedure SetTicks(Value:TDarkGrayPen);
Procedure SetTicksInner(Value:TDarkGrayPen);
procedure SetTickOnLabelsOnly(Value:Boolean);
Procedure SetTitleSize(Value:Integer);
Procedure SetValuesFormat(Const Value:String);
Procedure SetVisible(Value:Boolean);
Function ApplyPosition(APos:Integer; Const R:TRect):Integer;
Function CalcDateTimeIncrement(MaxNumLabels:Integer):Double;
Function CalcLabelsIncrement(MaxNumLabels:Integer):Double;
Procedure CalcRect(Var R:TRect; InflateChartRectangle:Boolean);
Function CalcZPos:Integer;
Procedure DrawGridLine(tmp:Integer);
Procedure DrawTitle(x,y:Integer);
Function GetGridCentered:Boolean;
Function GetLabels:Boolean;
Function GetLabelsFont:TTeeFont;
Function GetRectangleEdge(Const R:TRect):Integer;
Procedure IncDecDateTime( Increment:Boolean;
Var Value:Double;
Const AnIncrement:Double;
tmpWhichDateTime:TDateTimeStep );
Function LogXPosValue(Const Value:TChartValue):Integer;
Function LogYPosValue(Const Value:TChartValue):Integer;
Function InternalCalcDepthPosValue(Const Value:TChartValue):Integer;
Procedure InternalCalcRange;
Procedure InternalCalcPositions;
Function InternalCalcSize( tmpFont:TTeeFont;
tmpAngle:Integer;
Const tmpText:String;
tmpSize:Integer):Integer;
Function InternalLabelSize(Const Value:Double; IsWidth:Boolean):Integer;
function IsAxisValuesFormatStored:Boolean;
function IsLogBaseStored: Boolean;
Function IsMaxStored:Boolean;
Function IsMinStored:Boolean;
Function IsPosStored:Boolean;
Function IsStartStored:Boolean;
Function IsEndStored:Boolean;
Function IsCustom:Boolean;
function IsZStored: Boolean;
Procedure RecalcSizeCenter;
procedure SetHorizontal(const Value: Boolean);
procedure SetOtherSide(const Value: Boolean);
procedure SetLabelsExponent(Value: Boolean);
Procedure SetCalcPosValue;
procedure SetMaximumOffset(const Value: Integer);
procedure SetMinimumOffset(const Value: Integer);
procedure SetZPosition(const Value: Double);
Function XPosValue(Const Value:TChartValue):Integer;
Function YPosValue(Const Value:TChartValue):Integer;
Function XPosValueCheck(Const Value:TChartValue):Integer;
Function YPosValueCheck(Const Value:TChartValue):Integer;
protected
IHideBackGrid : Boolean;
IHideSideGrid : Boolean;
OnDrawGrids : TAxisDrawGrids;
Function AxisRect:TRect;
Procedure DrawGrids(NumTicks:Integer);
Function InternalCalcLabelStyle:TAxisLabelStyle; virtual;
Procedure InternalSetInverted(Value:Boolean);
Procedure InternalSetMaximum(Const Value:Double);
Procedure InternalSetMinimum(Const Value:Double);
Procedure SetInverted(Value:Boolean); virtual;
Function SizeLabels:Integer;
Function SizeTickAxis:Integer;
public
IStartPos : Integer;
IEndPos : Integer;
IAxisSize : Integer;
CalcXPosValue : TAxisCalcPos;
CalcYPosValue : TAxisCalcPos;
CalcPosValue : TAxisCalcPos;
Tick : TAxisTicks; // 7.0 moved from protected
{$IFDEF D5}
Constructor Create(Chart:TCustomAxisPanel); reintroduce; overload;
{$ENDIF}
Constructor Create(Collection:TCollection); {$IFDEF D5}overload;{$ENDIF} override;
Destructor Destroy; override;
Procedure AdjustMaxMin;
Procedure AdjustMaxMinRect(Const Rect:TRect);
procedure Assign(Source: TPersistent); override;
Function CalcIncrement:Double;
Function CalcLabelStyle:TAxisLabelStyle;
Procedure CalcMinMax(Var AMin,AMax:Double);
Function CalcPosPoint(Value:Integer):Double;
Function CalcSizeValue(Const Value:Double):Integer;
Function CalcXYIncrement(MaxLabelSize:Integer):Double;
Procedure CustomDraw( APosLabels,APosTitle,APosAxis:Integer;
GridVisible:Boolean);
Procedure CustomDrawMinMax( APosLabels,
APosTitle,
APosAxis:Integer;
GridVisible:Boolean;
Const AMinimum,AMaximum,AIncrement:Double);
Procedure CustomDrawMinMaxStartEnd( APosLabels,
APosTitle,
APosAxis:Integer;
GridVisible:Boolean;
Const AMinimum,AMaximum,AIncrement:Double;
AStartPos,AEndPos:Integer);
Procedure CustomDrawStartEnd( APosLabels,APosTitle,APosAxis:Integer;
GridVisible:Boolean; AStartPos,AEndPos:Integer);
Function Clicked(x,y:Integer):Boolean;
Procedure Draw(CalcPosAxis:Boolean);
procedure DrawAxisLabel(x,y,Angle:Integer; Const St:String; Format:TTeeCustomShape=nil);
Function IsDateTime:Boolean;
Function LabelWidth(Const Value:Double):Integer;
Function LabelHeight(Const Value:Double):Integer;
Function LabelValue(Const Value:Double):String; virtual; // 7.0
Function MaxLabelsWidth:Integer;
Procedure Scroll(Const Offset:Double; CheckLimits:Boolean=False);
Procedure SetMinMax(AMin,AMax:Double);
{ public }
property IsDepthAxis : Boolean read IDepthAxis;
property Items : TAxisItems read FItems;
property MasterAxis : TChartAxis read FMaster write FMaster; // 7.0
property PosAxis : Integer read FPosAxis;
property PosLabels : Integer read FPosLabels;
property PosTitle : Integer read FPosTitle;
property ParentChart : TCustomAxisPanel read FParentChart;
published
property Automatic:Boolean read FAutomatic write SetAutomatic default True;
property AutomaticMaximum:Boolean read FAutomaticMaximum write SetAutomaticMaximum default True;
property AutomaticMinimum:Boolean read FAutomaticMinimum write SetAutomaticMinimum default True;
property Axis:TChartAxisPen read FAxis write SetAxis;
property AxisValuesFormat:String read FAxisValuesFormat
write SetValuesFormat stored IsAxisValuesFormatStored;
property DateTimeFormat:String read FDateTimeFormat write SetDateTimeFormat;
property ExactDateTime:Boolean read FExactDateTime write SetExactDateTime default True;
property Grid:TAxisGridPen read FGrid write SetGrid;
property GridCentered:Boolean read GetGridCentered write SetGridCentered default False;
property Increment:Double read FDesiredIncrement write SetDesiredIncrement;
property Inverted:Boolean read FInverted write SetInverted default False;
property Horizontal : Boolean read FHorizontal write SetHorizontal stored IsCustom;
property OtherSide : Boolean read FOtherSide write SetOtherSide stored IsCustom;
property Labels:Boolean read GetLabels write SetLabels default True;
property LabelsAlign:TAxisLabelAlign read FLabelsAlign write SetLabelsAlign default alDefault;
property LabelsAlternate:Boolean read FLabelsAlternate write SetLabelsAlternate default False;
property LabelsAngle:Integer read FLabelsAngle write SetLabelsAngle default 0;
property LabelsExponent:Boolean read FLabelsExponent write SetLabelsExponent default False;
property LabelsFont:TTeeFont read GetLabelsFont write SetLabelsFont {stored IsFontStored};
property LabelsMultiLine:Boolean read FLabelsMultiLine write SetLabelsMultiLine default False;
property LabelsOnAxis:Boolean read FLabelsOnAxis write SetLabelsOnAxis default True;
property LabelsSeparation:Integer read FLabelsSeparation
write SetLabelsSeparation default 10;
property LabelsSize:Integer read FLabelsSize write SetLabelsSize default 0;
property LabelStyle:TAxisLabelStyle read FLabelStyle write SetLabelStyle default talAuto;
property Logarithmic:Boolean read FLogarithmic write SetLogarithmic default False;
property LogarithmicBase:Double read FLogarithmicBase write SetLogarithmicBase stored IsLogBaseStored;
property Maximum:Double read FMaximumValue write SetMaximum stored IsMaxStored;
property MaximumOffset:Integer read FMaximumOffset write SetMaximumOffset default 0;
property Minimum:Double read FMinimumValue write SetMinimum stored IsMinStored;
property MinimumOffset:Integer read FMinimumOffset write SetMinimumOffset default 0;
property MinorGrid:TChartHiddenPen read FMinorGrid write SetMinorGrid;
property MinorTickCount:Integer read FMinorTickCount write SetMinorTickCount default 3;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -