📄 teengine.pas
字号:
cpAxis,
cpSeries,
cpTitle,
cpFoot,
cpChartRect,
cpSeriesMarks,
cpSubTitle,
cpSubFoot );
TChartClickedPart=Packed Record
Part : TChartClickedPartStyle;
PointIndex : Integer;
ASeries : TChartSeries;
AAxis : TChartAxis;
end;
TChartSeriesList=class(TList)
private
FOwner : TCustomAxisPanel;
procedure Put(Index:Integer; Value:TChartSeries);
function Get(Index:Integer):TChartSeries;
public
property Items[Index:Integer]:TChartSeries read Get write Put; default;
property Owner:TCustomAxisPanel read FOwner;
end;
TChartAxes=class(TList)
private
FChart : TCustomAxisPanel;
IFastCalc : Boolean; // default False
function Get(Index:Integer):TChartAxis;
function GetBottomAxis:TChartAxis;
function GetDepthAxis:TChartDepthAxis;
function GetLeftAxis:TChartAxis;
function GetRightAxis:TChartAxis;
function GetTopAxis:TChartAxis;
procedure SetFastCalc(const Value: Boolean);
function GetBehind: Boolean;
function GetVisible: Boolean;
procedure SetBehind(const Value: Boolean);
procedure SetVisible(const Value: Boolean);
public
procedure Clear; override;
property Items[Index:Integer]:TChartAxis read Get; default;
property Bottom:TChartAxis read GetBottomAxis;
property Depth:TChartDepthAxis read GetDepthAxis;
property Left:TChartAxis read GetLeftAxis;
property Right:TChartAxis read GetRightAxis;
property Top:TChartAxis read GetTopAxis;
property Behind:Boolean read GetBehind write SetBehind;
property FastCalc:Boolean read IFastCalc write SetFastCalc;
property Visible:Boolean read GetVisible write SetVisible;
end;
TChartCustomAxes=class(TOwnedCollection)
private
Function Get(Index:Integer):TChartAxis;
Procedure Put(Index:Integer; Const Value:TChartAxis);
public
property Items[Index:Integer]:TChartAxis read Get write Put; default;
end;
TTeeCustomDesigner=class(TObject)
public
Procedure Refresh; dynamic;
Procedure Repaint; dynamic;
end;
TChartSeriesEvent=( seAdd, seRemove, seChangeTitle, seChangeColor, seSwap,
seChangeActive, seDataChanged);
TChartChangePage=class(TTeeEvent);
TChartToolEvent=(cteAfterDraw,cteBeforeDrawSeries,cteBeforeDraw); // 5.02
TChartMouseEvent=(cmeDown,cmeMove,cmeUp);
TTeeCustomTool=class(TCustomChartElement)
protected
Procedure ChartEvent(AEvent:TChartToolEvent); virtual;
Procedure ChartMouseEvent( AEvent: TChartMouseEvent;
Button:TMouseButton;
Shift: TShiftState; X, Y: Integer); virtual;
procedure SetParentChart(const Value: TCustomAxisPanel); override;
public
class Function Description:String; virtual;
end;
TTeeCustomToolClass=class of TTeeCustomTool;
TChartTools=class(TList)
private
Owner : TCustomAxisPanel;
Function Get(Index:Integer):TTeeCustomTool;
public
Function Add(Tool:TTeeCustomTool):TTeeCustomTool;
procedure Clear; override;
property Items[Index:Integer]:TTeeCustomTool read Get; default;
end;
// Base object for tools that have a Series property
TTeeCustomToolSeries=class(TTeeCustomTool)
private
FSeries : TChartSeries;
protected
Function GetHorizAxis:TChartAxis;
Function GetVertAxis:TChartAxis;
class Function GetEditorClass:String; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure SetSeries(const Value: TChartSeries); virtual;
public
property Series:TChartSeries read FSeries write SetSeries;
end;
// Base object for tools that have an Axis property
TTeeCustomToolAxis=class(TTeeCustomTool)
private
FAxis: TChartAxis;
procedure ReadAxis(Reader: TReader);
procedure WriteAxis(Writer: TWriter);
protected
procedure DefineProperties(Filer: TFiler); override;
class Function GetEditorClass:String; override;
procedure SetAxis(const Value: TChartAxis); virtual;
public
property Axis:TChartAxis read FAxis write SetAxis stored False;
end;
TTeeEventClass=class of TTeeEvent;
TTeeSeriesEvent=class(TTeeEvent)
Event : TChartSeriesEvent;
Series : TCustomChartSeries;
end;
TChartSeriesClass=class of TChartSeries;
TCustomAxisPanel=class(TCustomTeePanelExtended)
private
{ Private declarations }
FAxes : TChartAxes;
FAxisBehind : Boolean;
FAxisVisible : Boolean;
FClipPoints : Boolean;
FCustomAxes : TChartCustomAxes;
FSeriesList : TChartSeriesList;
FDepthAxis : TChartDepthAxis;
FTopAxis : TChartAxis;
FBottomAxis : TChartAxis;
FLeftAxis : TChartAxis;
FRightAxis : TChartAxis;
FView3DWalls : Boolean;
FOnGetAxisLabel : TAxisOnGetLabel;
FOnGetNextAxisLabel:TAxisOnGetNextLabel;
FOnPageChange : TNotifyEvent;
FOnBeforeDrawChart: TNotifyEvent;
FOnBeforeDrawAxes : TNotifyEvent;
FOnBeforeDrawSeries:TNotifyEvent;
FPage : Integer;
FMaxPointsPerPage : Integer;
FScaleLastPage : Boolean;
FMaxZOrder : Integer;
FSeriesWidth3D : Integer;
FSeriesHeight3D : Integer;
FTools : TChartTools;
InvertedRotation : Boolean;
Procedure BroadcastTeeEventClass(Event:TTeeEventClass);
Procedure BroadcastToolEvent(AEvent:TChartToolEvent);
Procedure CalcInvertedRotation;
Procedure CheckOtherSeries(Dest,Source:TChartSeries);
Function GetAxisSeriesMaxPoints(Axis:TChartAxis):TChartSeries;
Function GetSeries(Index:Integer):TChartSeries;
Procedure InternalAddSeries(ASeries:TCustomChartSeries);
Function InternalMinMax(AAxis:TChartAxis; IsMin,IsX:Boolean):Double;
Function NoActiveSeries(AAxis:TChartAxis):Boolean;
Procedure SetAxisBehind(Value:Boolean);
Procedure SetAxisVisible(Value:Boolean);
Procedure SetBottomAxis(Value:TChartAxis);
procedure SetClipPoints(Value:Boolean);
Procedure SetCustomAxes(Value:TChartCustomAxes);
Procedure SetDepthAxis(Value:TChartDepthAxis);
Procedure SetLeftAxis(Value:TChartAxis);
Procedure SetMaxPointsPerPage(Value:Integer);
Procedure SetRightAxis(Value:TChartAxis);
Procedure SetScaleLastPage(Value:Boolean);
Procedure SetTopAxis(Value:TChartAxis);
procedure SetView3DWalls(Value:Boolean);
function IsCustomAxesStored: Boolean;
protected
{ Protected declarations }
LegendColor : TColor;
LegendPen : TChartPen;
Procedure BroadcastSeriesEvent(ASeries:TCustomChartSeries; Event:TChartSeriesEvent);
Procedure CalcWallsRect; virtual; abstract;
Function CalcWallSize(Axis:TChartAxis):Integer; virtual; abstract;
Function CheckMouseSeries(x,y:Integer):Boolean;
procedure DoOnAfterDraw; virtual;
procedure DoOnBeforeDrawAxes; virtual;
procedure DoOnBeforeDrawChart; virtual;
procedure DoOnBeforeDrawSeries; virtual;
procedure DrawTitlesAndLegend(BeforeSeries:Boolean); virtual; abstract;
Procedure DrawWalls; virtual; abstract;
Function IsAxisVisible(Axis:TChartAxis):Boolean;
Function MultiLineTextWidth(S:String; Var NumLines:Integer):Integer;
procedure RemovedDataSource( ASeries: TChartSeries;
AComponent: TComponent ); dynamic;
Procedure SetPage(Value:Integer);
Procedure GetChildren(Proc:TGetChildProc; Root:TComponent); override;
public
{ Public declarations }
Designer : TTeeCustomDesigner; { used only at Design-Time }
Constructor Create(AOwner: TComponent); override;
Destructor Destroy; override;
{ public methods }
procedure Assign(Source:TPersistent); override;
Function ActiveSeriesLegend(ItemIndex:Integer):TChartSeries;
Function AddSeries(ASeries:TChartSeries):TChartSeries; overload; { 5.01 }
Function AddSeries(ASeriesClass:TChartSeriesClass):TChartSeries; overload;
Procedure CalcSize3DWalls;
Procedure CheckDatasource(ASeries:TChartSeries); virtual;
Function CountActiveSeries:Integer;
Procedure ExchangeSeries(a,b:Integer); overload;
Procedure ExchangeSeries(a,b:TCustomChartSeries); overload;
Function FormattedValueLegend(ASeries:TChartSeries; ValueIndex:Integer):String; virtual;
Procedure FreeAllSeries( SeriesClass:TChartSeriesClass=nil );
Function GetAxisSeries(Axis:TChartAxis):TChartSeries;
Function GetFreeSeriesColor(CheckBackground:Boolean=True):TColor;
Function GetMaxValuesCount:Integer;
Procedure InternalDraw(Const UserRectangle: TRect); override;
Function IsFreeSeriesColor(AColor: TColor; CheckBackground: Boolean):Boolean; virtual; abstract;
Function IsValidDataSource(ASeries: TChartSeries; AComponent: TComponent):Boolean; dynamic;
Function MaxXValue(AAxis: TChartAxis):Double;
Function MaxYValue(AAxis: TChartAxis):Double;
Function MinXValue(AAxis: TChartAxis):Double;
Function MinYValue(AAxis: TChartAxis):Double;
Function MaxMarkWidth:Integer;
Function MaxTextWidth:Integer;
Function NumPages:Integer; dynamic;
procedure PrintPages(FromPage: Integer=1; ToPage: Integer=0);
Procedure RemoveSeries(ASeries: TCustomChartSeries);
property Series[Index: Integer]:TChartSeries read GetSeries; default;
Function SeriesCount:Integer;
Function SeriesLegend(ItemIndex: Integer; OnlyActive: Boolean):TChartSeries;
Function SeriesTitleLegend(SeriesIndex: Integer; OnlyActive: Boolean=False):String;
{ public properties }
property Axes:TChartAxes read FAxes;
property AxesList:TChartAxes read FAxes; // compatibility v4
property CustomAxes:TChartCustomAxes read FCustomAxes write SetCustomAxes stored IsCustomAxesStored;
property MaxZOrder:Integer read FMaxZOrder write FMaxZOrder;
property SeriesWidth3D:Integer read FSeriesWidth3D;
property SeriesHeight3D:Integer read FSeriesHeight3D;
{ to be published properties }
property AxisBehind:Boolean read FAxisBehind write SetAxisBehind default True;
property AxisVisible:Boolean read FAxisVisible write SetAxisVisible default True;
property BottomAxis:TChartAxis read FBottomAxis write SetBottomAxis;
property ClipPoints:Boolean read FClipPoints write SetClipPoints default True;
property Color;
property DepthAxis:TChartDepthAxis read FDepthAxis write SetDepthAxis;
property LeftAxis:TChartAxis read FLeftAxis write SetLeftAxis;
property MaxPointsPerPage:Integer read FMaxPointsPerPage write SetMaxPointsPerPage default 0;
property Page:Integer read FPage write SetPage default 1;
property RightAxis:TChartAxis read FRightAxis write SetRightAxis;
property ScaleLastPage:Boolean read FScaleLastPage write SetScaleLastPage default True;
property SeriesList:TChartSeriesList read FSeriesList;
property Tools:TChartTools read FTools;
property TopAxis:TChartAxis read FTopAxis write SetTopAxis;
property View3DWalls:Boolean read FView3DWalls write SetView3DWalls default True;
{ to be published events }
property OnBeforeDrawChart: TNotifyEvent read FOnBeforeDrawChart write FOnBeforeDrawChart;
property OnBeforeDrawAxes:TNotifyEvent read FOnBeforeDrawAxes write FOnBeforeDrawAxes;
property OnBeforeDrawSeries:TNotifyEvent read FOnBeforeDrawSeries write FOnBeforeDrawSeries;
property OnGetAxisLabel:TAxisOnGetLabel read FOnGetAxisLabel write FOnGetAxisLabel;
property OnGetNextAxisLabel:TAxisOnGetNextLabel read FOnGetNextAxisLabel
write FOnGetNextAxisLabel;
property OnPageChange:TNotifyEvent read FOnPageChange write FOnPageChange;
end;
TSeriesMarkPosition=class
public
ArrowFrom : TPoint;
ArrowFix : Boolean;
ArrowTo : TPoint;
Custom : Boolean;
Height : Integer;
LeftTop : TPoint;
Width : Integer;
Procedure Assign(Source:TSeriesMarkPosition);
Function Bounds:TRect;
end;
TSeriesMarksPositions=class(TList)
private
Function Get(Index:Integer):TSeriesMarkPosition;
Procedure Put(Index:Integer; APosition:TSeriesMarkPosition);
public
Procedure Automatic(Index:Integer);
procedure Clear; override;
Function ExistCustom:Boolean;
property Position[Index:Integer]:TSeriesMarkPosition read Get
write Put; default;
end;
TMarksItem=class(TTeeCustomShape)
published
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -