📄 teetools.pas
字号:
Point : Integer;
Constructor Create(AOwner:TComponent); override;
Destructor Destroy; override;
class Function GetNearestPoint(Series:TChartSeries; X,Y:Integer):Integer; overload;
class Function GetNearestPoint(Series:TChartSeries; X,Y:Integer; IncludeNulls:Boolean):Integer; overload;
class Function Description:String; override;
published
property Active;
property Brush;
property DrawLine:Boolean read GetDrawLine write SetDrawLine default True;
property FullRepaint:Boolean read FFullRepaint write FFullRepaint default True;
property LinePen:TChartPen read FLinePen write SetLinePen; // 7.0
property Pen;
property Series;
property Size:Integer read FSize write SetSize default 20;
property Style:TNearestToolStyle read FStyle write SetStyle default hsCircle;
property OnChange:TNotifyEvent read FOnChange write FOnChange;
end;
TColorLineTool=class;
// Color band tool, use it to display a coloured rectangle (band)
// at the specified axis and position.
TColorBandTool=class(TTeeCustomToolAxis)
private
FColor : TColor;
FCursor : TCursor; // 7.0
FDrawBehind : Boolean;
FDrawBehindAxes: Boolean;
FEnd : Double;
FGradient : TChartGradient;
FOnClick : TMouseEvent;
FStart : Double;
FTransparency : TTeeTransparency;
FLineEnd : TColorLineTool;
FLineStart : TColorLineTool;
procedure DragLine(Sender:TColorLineTool);
procedure EndDragLine(Sender:TColorLineTool);
function GetEndLinePen: TChartPen;
function GetResizeEnd: Boolean;
function GetResizeStart: Boolean;
function GetStartLinePen: TChartPen;
Function NewColorLine:TColorLineTool;
procedure PaintBand;
Procedure SetColor(Value:TColor);
procedure SetDrawBehind(const Value: Boolean);
procedure SetDrawBehindAxes(const Value: Boolean);
procedure SetEnd(const Value: Double);
procedure SetEndLinePen(const Value: TChartPen);
procedure SetGradient(const Value: TChartGradient);
procedure SetLines;
procedure SetResizeEnd(const Value: Boolean);
procedure SetResizeStart(const Value: Boolean);
procedure SetStart(const Value: Double);
procedure SetStartLinePen(const Value: TChartPen);
procedure SetTransparency(const Value: TTeeTransparency);
protected
procedure ChartEvent(AEvent: TChartToolEvent); override;
Procedure ChartMouseEvent( AEvent: TChartMouseEvent;
Button:TMouseButton;
Shift: TShiftState; X, Y: Integer); override;
class function GetEditorClass: String; override;
procedure Loaded; override;
procedure SetAxis(const Value: TChartAxis); override;
procedure SetParentChart(const Value: TCustomAxisPanel); override;
Function ZPosition:Integer;
public
Constructor Create(AOwner: TComponent); override;
Destructor Destroy; override;
Function BoundsRect:TRect; // 6.02
Function Clicked(X,Y:Integer):Boolean; // 6.02
class Function Description:String; override;
property StartLine:TColorLineTool read FLineStart;
property EndLine:TColorLineTool read FLineEnd;
published
property Active;
property Axis;
property Brush;
property Color:TColor read FColor write SetColor default clWhite;
property Cursor:TCursor read FCursor write FCursor default crDefault; // 7.0
property DrawBehind:Boolean read FDrawBehind write SetDrawBehind default True;
property DrawBehindAxes:Boolean read FDrawBehindAxes write SetDrawBehindAxes default False; // 7.0
property EndLinePen:TChartPen read GetEndLinePen write SetEndLinePen;
property EndValue:Double read FEnd write SetEnd;
property Gradient:TChartGradient read FGradient write SetGradient;
property Pen;
property ResizeEnd:Boolean read GetResizeEnd write SetResizeEnd default False;
property ResizeStart:Boolean read GetResizeStart write SetResizeStart default False;
property StartLinePen:TChartPen read GetStartLinePen write SetStartLinePen;
property StartValue:Double read FStart write SetStart;
property Transparency:TTeeTransparency read FTransparency
write SetTransparency default 0;
// Events
property OnClick:TMouseEvent read FOnClick write FOnClick; // 6.02
end;
TGridBandBrush=class(TChartBrush)
private
FBackColor : TColor;
FGradient : TTeeGradient;
FTransp : TTeeTransparency;
procedure SetBackColor(const Value: TColor);
procedure SetGradient(const Value: TTeeGradient);
procedure SetTransp(const Value: TTeeTransparency);
public
Constructor Create(OnChangeEvent:TNotifyEvent); override;
Destructor Destroy; override;
Procedure Assign(Source:TPersistent); override;
published
property BackColor:TColor read FBackColor write SetBackColor default clNone;
property Gradient:TTeeGradient read FGradient write SetGradient;
property Transparency:TTeeTransparency read FTransp write SetTransp default 0;
end;
// TGridBandTool
// Draws alternate color bands on axis grid space.
TGridBandTool=class(TTeeCustomToolAxis)
private
FBand1 : TGridBandBrush;
FBand2 : TGridBandBrush;
Procedure DrawGrids(Sender:TChartAxis);
Procedure SetBand1(Value:TGridBandBrush);
Procedure SetBand2(Value:TGridBandBrush);
protected
class function GetEditorClass: String; override;
procedure SetAxis(const Value: TChartAxis); override;
public
Constructor Create(AOwner: TComponent); override;
Destructor Destroy; override;
Function BandBackColor(ABand:TGridBandBrush):TColor;
class Function Description:String; override;
published
property Active;
property Axis;
property Band1:TGridBandBrush read FBand1 write SetBand1;
property Band2:TGridBandBrush read FBand2 write SetBand2;
end;
TColorLineStyle=(clCustom,clMaximum,clCenter,clMinimum);
TColorLineToolOnDrag=procedure(Sender:TColorLineTool) of object;
// Color line tool, use it to display a vertical or horizontal line
// at the specified axis and position.
// The line can be optionally dragged at runtime.
TColorLineTool=class(TTeeCustomToolAxis)
private
FAllowDrag : Boolean;
FDragRepaint : Boolean;
FDraw3D : Boolean;
FDrawBehind : Boolean;
FNoLimitDrag : Boolean;
FOnBeginDragLine: TColorLineToolOnDrag;
FOnDragLine : TColorLineToolOnDrag;
FOnEndDragLine : TColorLineToolOnDrag;
FStyle : TColorLineStyle;
FValue : Double;
IDragging : Boolean;
IParent : TCustomAxisPanel;
InternalOnEndDragLine : TColorLineToolOnDrag;
Function Chart:TCustomAxisPanel;
Procedure DrawColorLine(Back:Boolean); { 5.02 }
procedure SetDraw3D(const Value: Boolean);
procedure SetDrawBehind(const Value: Boolean);
procedure SetStyle(const Value: TColorLineStyle);
procedure SetValue(const AValue: Double);
protected
Function CalcValue:Double;
procedure ChartEvent(AEvent: TChartToolEvent); override;
Procedure ChartMouseEvent( AEvent: TChartMouseEvent;
Button:TMouseButton;
Shift: TShiftState; X, Y: Integer); override;
procedure DoEndDragLine; virtual; { 5.02 }
class function GetEditorClass: String; override;
procedure InternalDrawLine(Back:Boolean);
public
Constructor Create(AOwner:TComponent); override;
Procedure Assign(Source:TPersistent); override;
Function Clicked(x,y:Integer):Boolean;
class Function Description:String; override;
Function LimitValue(const AValue:Double):Double; // 7.0 moved from private
published
property Active;
property Axis;
property AllowDrag:Boolean read FAllowDrag write FAllowDrag default True;
property DragRepaint:Boolean read FDragRepaint write FDragRepaint default False;
property Draw3D:Boolean read FDraw3D write SetDraw3D default True;
property DrawBehind:Boolean read FDrawBehind write SetDrawBehind default False;
property NoLimitDrag:Boolean read FNoLimitDrag write FNoLimitDrag default False;
property Pen;
property Style:TColorLineStyle read FStyle write SetStyle default clCustom;
property Value:Double read FValue write SetValue;
property OnBeginDragLine:TColorLineToolOnDrag read FOnBeginDragLine write FOnBeginDragLine; // 7.0
property OnDragLine:TColorLineToolOnDrag read FOnDragLine write FOnDragLine;
property OnEndDragLine:TColorLineToolOnDrag read FOnEndDragLine write FOnEndDragLine;
end;
// Rotate tool, use it to allow the end-user to do 3D rotation of the chart
// at runtime by dragging the chart using the specified mouse button.
TRotateToolStyles = ( rsAll, rsRotation, rsElevation );
TRotateTool=class(TTeeCustomTool)
private
FButton : TMouseButton;
FInverted : Boolean;
FOnRotate : TNotifyEvent;
FStyle : TRotateToolStyles;
IOldX : Integer;
IOldY : Integer;
IDragging : Boolean;
IFirstTime : Boolean;
IOldRepaint: Boolean;
protected
Procedure ChartMouseEvent( AEvent: TChartMouseEvent;
AButton:TMouseButton;
AShift: TShiftState; X, Y: Integer); override;
class function GetEditorClass: String; override;
public
Constructor Create(AOwner:TComponent); override;
class Function Description:String; override;
class function ElevationChange(FullRotation:Boolean; AAngle,AChange:Integer):Integer;
class function RotationChange(FullRotation:Boolean; AAngle,AChange:Integer):Integer;
published
property Active;
property Button:TMouseButton read FButton write FButton default mbLeft;
property Inverted:Boolean read FInverted write FInverted default False;
property Pen;
property Style:TRotateToolStyles read FStyle write FStyle default rsAll;
property OnRotate:TNotifyEvent read FOnRotate write FOnRotate;
end;
// Chart Image tool, use it to display a picture using the specified
// Series axes as boundaries. When the axis are zoomed or scrolled,
// the picture will follow the new boundaries.
TChartImageTool=class(TTeeCustomToolSeries)
private
FPicture : TPicture;
procedure SetPicture(const Value: TPicture);
protected
procedure ChartEvent(AEvent: TChartToolEvent); override;
class function GetEditorClass: String; override;
procedure SetSeries(const Value: TChartSeries); override;
public
Constructor Create(AOwner:TComponent); override;
Destructor Destroy; override;
class Function Description:String; override;
published
property Active;
property Picture:TPicture read FPicture write SetPicture;
property Series;
end;
// A Shape object (with Left and Top), publishing all properties.
TTeeShapePosition=class(TTeeCustomShapePosition)
published
property Bevel;
property BevelWidth;
property Brush;
property Color;
property CustomPosition;
property Font;
property Frame;
property Gradient;
property Left;
property Shadow;
property ShapeStyle;
property Top;
property Transparency;
property Transparent;
property Visible default True;
end;
TAnnotationTool=class;
TAnnotationPosition=(ppLeftTop,ppLeftBottom,ppRightTop,ppRightBottom);
TAnnotationClick=procedure( Sender:TAnnotationTool;
Button:TMouseButton;
Shift: TShiftState;
X, Y: Integer) of object;
TAnnotationCallout=class(TCallout)
private
FX : Integer;
FY : Integer;
FZ : Integer;
Function CloserPoint(const R:TRect; const P:TPoint):TPoint;
procedure SetX(const Value:Integer);
procedure SetY(const Value:Integer);
procedure SetZ(const Value:Integer);
public
constructor Create(AOwner: TChartSeries);
Procedure Assign(Source:TPersistent); override;
published
property Visible default False;
property XPosition:Integer read FX write SetX default 0;
property YPosition:Integer read FY write SetY default 0;
property ZPosition:Integer read FZ write SetZ default 0;
end;
// Annotation tool, use it to display text anywhere on the chart.
TAnnotationTool=class(TTeeCustomTool)
private
FAutoSize : Boolean; // 7.0
FCallout : TAnnotationCallout;
FCursor : TCursor;
FOnClick : TAnnotationClick; // 5.03
FPosition : TAnnotationPosition;
FPositionUnits: TTeeUnits;
FShape : TTeeShapePosition;
FText : String;
FTextAlign : TAlignment;
function GetBounds:TRect;
function GetHeight: Integer;
function GetLeft: Integer;
function GetTop: Integer;
function GetWidth: Integer;
function IsNotAutoSize: Boolean;
procedure SetAutoSize(const Value: Boolean);
procedure SetBounds(const Value: TRect);
procedure SetCallout(const Value: TAnnotationCallout);
procedure SetHeight(const Value: Integer);
procedure SetLeft(const Value: Integer);
procedure SetPosition(const Value: TAnnotationPosition);
procedure SetPositionUnits(const Value: TTeeUnits);
procedure SetShape(const Value: TTeeShapePosition);
procedure SetTextAlign(const Value: TAlignment);
procedure SetTop(const Value: Integer);
procedure SetWidth(const Value: Integer);
protected
Procedure ChartEvent(AEvent:TChartToolEvent); override;
Procedure ChartMouseEvent( AEvent: TChartMouseEvent;
Button:TMouseButton;
Shift: TShiftState; X, Y: Integer); override;
Procedure DrawText;
Function GetTextBounds(var NumLines,x,y:Integer):TRect;
class Function GetEditorClass:String; override;
Function GetText:String; virtual;
procedure SetParentChart(const Value: TCustomAxisPanel); override;
Procedure SetText(Const Value:String);
public
Constructor Create(AOwner:TComponent); override;
Destructor Destroy; override;
Function Clicked(x,y:Integer):Boolean;
class Function Description:String; override;
property Bounds:TRect read GetBounds write SetBounds; // 7.05 (do not publish)
published
property Active;
property AutoSize:Boolean read FAutoSize write SetAutoSize default True; // 7.0
property Callout:TAnnotationCallout read FCallout write SetCallout;
property Cursor:TCursor read FCursor write FCursor default crDefault;
property Position:TAnnotationPosition read FPosition write SetPosition
default ppLeftTop;
property PositionUnits:TTeeUnits read FPositionUnits write SetPositionUnits // 7.0
default muPixels;
property Shape:TTeeShapePosition read FShape write SetShape;
property Text:String read FText write SetText;
property TextAlignment:TAlignment read FTextAlign
write SetTextAlign default taLeftJustify;
property Height: Integer read GetHeight write SetHeight stored IsNotAutoSize; // 7.0
property Left: Integer read GetLeft write SetLeft stored False; // 7.04
property Top: Integer read GetTop write SetTop stored False; // 7.04
property Width: Integer read GetWidth write SetWidth stored IsNotAutoSize; // 7.0
property OnClick:TAnnotationClick read FOnClick write FOnClick; // 5.03
end;
TSeriesAnimationTool=class;
TSeriesAnimationStep=procedure(Sender:TSeriesAnimationTool; Step:Integer) of object;
TSeriesAnimationLoop=(salNo, salOneWay, salCircular);
TSeriesAnimationTool=class(TTeeCustomToolSeries)
private
FBackup : TChartSeries;
FDrawEvery : Integer;
FLoop : TSeriesAnimationLoop;
FStartValue : Double;
FSteps : Integer;
FStartAtMin : Boolean;
{ events }
FOnStep : TSeriesAnimationStep;
{ internal }
IStopped : Boolean;
protected
class Function GetEditorClass:String; override;
public
Constructor Create(AOwner:TComponent); override;
class Function Description:String; override;
procedure Execute; virtual;
function Running:Boolean;
procedure Stop;
published
property Active;
property DrawEvery:Integer read FDrawEvery write FDrawEvery default 0;
property Loop:TSeriesAnimationLoop read FLoop write FLoop default salNo;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -