📄 chart.pas
字号:
function GetVisible: Boolean;
procedure SetBack(const Value: TChartBackWall);
procedure SetBottom(const Value: TChartWall);
procedure SetLeft(const Value: TChartWall);
procedure SetRight(const Value: TChartRightWall);
procedure SetSize(const Value: Integer);
procedure SetVisible(const Value: Boolean);
public
Constructor Create(Chart:TCustomChart);
Destructor Destroy; override;
Procedure Assign(Source:TPersistent); override;
property Back:TChartBackWall read FBack write SetBack;
property Bottom:TChartWall read FBottom write SetBottom;
property Left:TChartWall read FLeft write SetLeft;
property Right:TChartRightWall read FRight write SetRight;
property Size:Integer write SetSize; // 7.0
property Visible:Boolean read GetVisible write SetVisible;
end;
TChartAllowScrollEvent=Procedure( Sender:TChartAxis; Var AMin,AMax:Double;
Var AllowScroll:Boolean ) of object;
TCustomChart=class(TCustomAxisPanel)
private
FFoot : TChartTitle;
FLegend : TChartLegend;
FSavedScales : TAllAxisSavedScales;
FScrollMouse : TMouseButton;
FSubFoot : TChartTitle;
FSubTitle : TChartTitle;
FTitle : TChartTitle;
FWalls : TChartWalls;
{ events }
FOnAllowScroll : TChartAllowScrollEvent;
FOnClickAxis : TChartClickAxis;
FOnClickBackGround : TChartClick;
FOnClickLegend : TChartClick;
FOnClickSeries : TChartClickSeries;
FOnClickTitle : TChartClickTitle;
FOnGetLegendPos : TOnGetLegendPos;
FOnGetLegendRect : TOnGetLegendRect;
FOnGetLegendText : TOnGetLegendText;
Function ActiveSeriesUseAxis:Boolean;
procedure BroadcastMouseEvent(AEvent:TChartMouseEvent;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
Function CalcNeedClickedPart(Pos:TPoint; Needed:Boolean):TChartClickedPart;
Procedure DrawBackWall;
Procedure DrawLeftWall;
Procedure DrawRightWall;
Function DrawWallFirst(APos:Integer):Boolean;
function GetBackWall: TChartBackWall;
function GetBottomWall: TChartWall;
Function GetFrame:TChartPen;
function GetLeftWall: TChartWall;
function GetRightWall: TChartRightWall;
Procedure PrepareWallCanvas(AWall:TChartWall);
procedure ReadBackColor(Reader: TReader);
procedure ReadColorPalette(Reader: TReader);
Procedure RestoreScales(var Saved:TAllAxisSavedScales);
Function SaveScales:TAllAxisSavedScales;
Procedure ScrollVerticalAxes(Up:Boolean);
Procedure SetBackColor(Value:TColor);
Procedure SetBackWall(Value:TChartBackWall);
Procedure SetBottomWall(Value:TChartWall);
Procedure SetFoot(Value:TChartTitle);
Procedure SetFrame(Value:TChartPen);
Procedure SetLeftWall(Value:TChartWall);
Procedure SetLegend(Value:TChartLegend);
Procedure SetRightWall(Value:TChartRightWall);
procedure SetSubFoot(const Value: TChartTitle);
procedure SetSubTitle(const Value: TChartTitle);
procedure SetTitle(Value:TChartTitle);
procedure SetWalls(Value:TChartWalls);
procedure WriteColorPalette(Writer: TWriter);
protected
RestoredAxisScales : Boolean;
Procedure CalcWallsRect; override;
Function CalcWallSize(Axis:TChartAxis):Integer; override;
Procedure CalcZoomPoints; dynamic;
Procedure DefineProperties(Filer:TFiler); override;
{$IFDEF CLX}
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer;
const MousePos: TPoint): Boolean; override;
function DoMouseWheelDown(Shift: TShiftState; const MousePos: TPoint): Boolean; override;
function DoMouseWheelUp(Shift: TShiftState; const MousePos: TPoint): Boolean; override;
{$ELSE}
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer;
MousePos: TPoint): Boolean; override;
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
{$ENDIF}
Procedure DoZoom(Const TopI,TopF,BotI,BotF,LefI,LefF,RigI,RigF:Double);
{$IFNDEF CLR}
Function DrawLeftWallFirst:Boolean;
Function DrawRightWallAfter:Boolean;
{$ENDIF}
procedure DrawTitlesAndLegend(BeforeSeries:Boolean); override;
Procedure DrawWalls; override;
Function GetBackColor:TColor; override;
{$IFNDEF CLR}
Procedure GetChildren(Proc:TGetChildProc; Root:TComponent); override;
{$ENDIF}
Function InternalFormattedLegend( ALegend:TCustomChartLegend;
SeriesOrValueIndex:Integer):String;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
public
ColorPaletteIndex : Integer;
Constructor Create(AOwner: TComponent); override;
Destructor Destroy; override;
Procedure Assign(Source:TPersistent); override;
Function AxisTitleOrName(Axis:TChartAxis):String;
Procedure CalcClickedPart(Pos:TPoint; Var Part:TChartClickedPart);
{$IFDEF CLR}
Function DrawLeftWallFirst:Boolean;
Function DrawRightWallAfter:Boolean;
{$ENDIF}
Procedure FillSeriesSourceItems(ASeries:TChartSeries; Proc:TGetStrProc); dynamic;
Procedure FillValueSourceItems(ValueList:TChartValueList; Proc:TGetStrProc); dynamic;
Function GetASeries:TChartSeries; { return first active Series }
{$IFDEF CLR}
Procedure GetChildren(Proc:TGetChildProc; Root:TComponent); override;
{$ENDIF}
Function IsFreeSeriesColor(AColor:TColor; CheckBackground:Boolean;
ASeries:TChartSeries=nil):Boolean; override;
Procedure NextPage;
Procedure PreviousPage;
Procedure RemoveAllSeries;
Procedure SeriesDown(ASeries:TChartSeries);
Procedure SeriesUp(ASeries:TChartSeries);
procedure UndoZoom; override;
Procedure ZoomPercent(Const PercentZoom:Double);
Procedure ZoomRect(Const Rect:TRect);
Function FormattedValueLegend(ASeries:TChartSeries; ValueIndex:Integer):String; override;
Function FormattedLegend(SeriesOrValueIndex:Integer):String;
property BackColor:TColor read GetBackColor write SetBackColor; { compatibility }
{ to be published }
property BackWall:TChartBackWall read GetBackWall write SetBackWall;
property Frame:TChartPen read GetFrame write SetFrame;
property BottomWall:TChartWall read GetBottomWall write SetBottomWall;
property Foot:TChartTitle read FFoot write SetFoot;
property LeftWall:TChartWall read GetLeftWall write SetLeftWall;
property Legend:TChartLegend read FLegend write SetLegend;
property RightWall:TChartRightWall read GetRightWall write SetRightWall;
property ScrollMouseButton:TMouseButton read FScrollMouse write FScrollMouse default mbRight;
property SubFoot:TChartTitle read FSubFoot write SetSubFoot;
property SubTitle:TChartTitle read FSubTitle write SetSubTitle;
property Title:TChartTitle read FTitle write SetTitle;
property Walls:TChartWalls read FWalls write SetWalls;
{ events }
property OnAllowScroll:TChartAllowScrollEvent read FOnAllowScroll write FOnAllowScroll;
property OnClickAxis:TChartClickAxis read FOnClickAxis write FOnClickAxis;
property OnClickBackground:TChartClick read FOnClickbackground write FOnClickBackGround;
property OnClickLegend:TChartClick read FOnClickLegend write FOnClickLegend;
property OnClickSeries:TChartClickSeries read FOnClickSeries write FOnClickSeries;
property OnClickTitle:TChartClickTitle read FOnClickTitle write FOnClickTitle;
property OnGetLegendPos:TOnGetLegendPos read FOnGetLegendPos write FOnGetLegendPos;
property OnGetLegendRect:TOnGetLegendRect read FOnGetLegendRect write FOnGetLegendRect;
property OnGetLegendText:TOnGetLegendText read FOnGetLegendText write FOnGetLegendText;
{ TPanel properties }
property Align;
property BevelInner;
property BevelOuter;
property BevelWidth;
{$IFDEF CLX}
property Bitmap;
{$ENDIF}
property BorderWidth;
property Color;
{$IFNDEF CLX}
property UseDockManager default True;
property DockSite;
property DragCursor;
{$ENDIF}
property DragMode;
property Enabled;
property ParentColor;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property Anchors;
{$IFNDEF CLX}
property AutoSize;
{$ENDIF}
property Constraints;
{$IFNDEF CLX}
property DragKind;
property Locked;
{$ENDIF}
{ TPanel events }
property OnClick;
{$IFDEF D5}
property OnContextPopup;
{$ENDIF}
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnStartDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
{$IFNDEF CLX}
property OnCanResize;
{$ENDIF}
property OnConstrainedResize;
{$IFNDEF CLX}
property OnDockDrop;
property OnDockOver;
property OnEndDock;
property OnGetSiteInfo;
property OnStartDock;
property OnUnDock;
{$ENDIF}
{$IFDEF K3}
property OnMouseEnter;
property OnMouseLeave;
{$ENDIF}
end;
TChart=class(TCustomChart)
{$IFNDEF CLX}
public
property DockManager;
{$ENDIF}
published
{ TCustomChart Properties }
property AllowPanning;
property BackImage;
property BackImageInside;
property BackImageMode;
property BackImageTransp;
property BackWall;
property Border;
property BorderRound;
property BottomWall;
property Foot;
property Gradient;
property LeftWall;
property Legend;
property MarginBottom;
property MarginLeft;
property MarginRight;
property MarginTop;
property MarginUnits;
property PrintProportional;
property RightWall;
property ScrollMouseButton;
property SubFoot;
property SubTitle;
property Title;
{ TCustomChart Events }
property OnAllowScroll;
property OnClickAxis;
property OnClickBackground;
property OnClickLegend;
property OnClickSeries;
property OnClickTitle;
property OnGetLegendPos;
property OnGetLegendRect;
property OnScroll;
property OnUndoZoom;
property OnZoom;
{ TCustomAxisPanel properties }
property AxisBehind;
property AxisVisible;
property BottomAxis;
property Chart3DPercent;
property ClipPoints;
property DepthAxis;
property DepthTopAxis;
property CustomAxes;
property Frame;
property LeftAxis;
property MaxPointsPerPage;
property Monochrome;
property Page;
property RightAxis;
property ScaleLastPage;
property SeriesList;
property Shadow;
property TopAxis;
property View3D;
property View3DOptions;
property View3DWalls;
property Zoom;
{ TCustomAxisPanel events }
property OnAfterDraw;
property OnBeforeDrawAxes;
property OnBeforeDrawChart;
property OnBeforeDrawSeries;
property OnGetAxisLabel;
property OnGetLegendText;
property OnGetNextAxisLabel;
property OnPageChange;
{ TPanel properties }
property Align;
property BevelInner;
property BevelOuter;
property BevelWidth;
property BorderWidth;
property Color;
{$IFNDEF CLX}
property UseDockManager default True;
property DockSite;
property DragCursor;
property DragMode;
{$ELSE}
property DragMode;
{$ENDIF}
property Enabled;
property ParentColor;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property Anchors;
{$IFNDEF CLX}
property AutoSize;
{$ENDIF}
property Constraints;
{$IFNDEF CLX}
property DragKind;
property Locked;
{$ENDIF}
{$IFDEF CLX}
property Bitmap;
{$ENDIF}
{ TPanel events }
property OnClick;
{$IFDEF D5}
property OnContextPopup;
{$ENDIF}
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnStartDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResize;
{$IFNDEF CLX}
property OnCanResize;
{$ENDIF}
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnConstrainedResize;
{$IFNDEF CLX}
property OnDockDrop;
property OnDockOver;
property OnEndDock;
property OnGetSiteInfo;
property OnStartDock;
property OnUnDock;
{$ENDIF}
end;
TTeeSeriesTypes=class(TList)
private
Function Get(Index:Integer):TTeeSeriesType;
public
Procedure Clear; override;
Function Find(ASeriesClass:TChartSeriesClass):TTeeSeriesType;
property Items[Index:Integer]:TTeeSeriesType read Get; default;
end;
TTeeToolTypes=class(TList)
private
Function Get(Index:Integer):TTeeCustomToolClass;
public
property Items[Index:Integer]:TTeeCustomToolClass read Get; default;
end;
{$IFNDEF CLX}
TTeeDragObject = class(TDragObject)
private
FPart: TChartClickedPart;
protected
function GetDragCursor(Accepted: Boolean; X, Y: Integer): TCursor; override;
procedure Finished(Target: TObject; X, Y: Integer; Accepted: Boolean); override;
public
constructor Create(Const APart: TChartClickedPart);
property Part: TChartClickedPart read FPart;
end;
{$ENDIF}
TColorPalettes=class(TStringList)
public
class procedure ApplyPalette(Chart:TCustomAxisPanel; Index:Integer); overload; {$IFDEF CLR}static;{$ENDIF}
class procedure ApplyPalette(Chart:TCustomAxisPanel; const Palette:Array of TColor); overload; {$IFDEF CLR}static;{$ENDIF}
end;
var ColorPalettes : TColorPalettes=nil;
TeeSeriesTypes: TTeeSeriesTypes=nil; { List of Series types }
TeeToolTypes: TTeeToolTypes=nil; { List of Tool types }
{ Adds a new Series component definition for the Gallery }
{ Setting ANumGallerySeries to zero makes the Series to not appear on the
Gallery. }
Procedure RegisterTeeSeries( ASeriesClass:TChartSeriesClass;
ADescription,AGalleryPage:PString;
ANumGallerySeries : Integer ); overload;
// Same as above, at default "Standard" tab with NumSeries = 2
Procedure RegisterTeeSeries( ASeriesClass:TChartSeriesClass;
ADescription:PString); overload;
{ Adds a new Function component definition for the Gallery }
Procedure RegisterTeeFunction( AFunctionClass:TTeeFunctionClass;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -