Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
TeEngine.pas
Package: TeeChartPro_v7.04_FS.rar [view]
Upload User: waiaoji
Upload Date: 2010-04-10
Package Size: 2693k
Code Size: 341k
Category:
Delphi VCL
Development Platform:
Delphi
- {********************************************}
- { TeeChart Pro Charting Library }
- { For Borland Delphi, C++ Builder & Kylix }
- { Copyright (c) 1995-2005 by David Berneda }
- { All Rights Reserved }
- {********************************************}
- unit TeEngine;
- {$I TeeDefs.inc}
- interface
- uses {$IFNDEF LINUX}
- Windows,
- Messages,
- {$ENDIF}
- SysUtils, Classes,
- {$IFDEF CLX}
- QGraphics, QControls, QDialogs, Types,
- {$ELSE}
- Graphics, Controls,
- {$ENDIF}
- {$IFDEF TEETRIAL}
- TeeAbout,
- {$ENDIF}
- {$IFDEF CLR}
- System.ComponentModel,
- {$ENDIF}
- TeeProcs, TeCanvas;
- Const ChartMarkColor = clInfoBk (* $80FFFF *); { default Series Mark back color }
- MinAxisIncrement :Double = 0.000000000001; { <-- "double" for BCB }
- MinAxisRange :Double = 0.0000000001; { <-- "double" for BCB }
- TeeAllValues = -1;
- {$IFDEF D6}
- clTeeColor =TColor(clDefault);
- {$ELSE}
- clTeeColor =TColor($20000000);
- {$ENDIF}
- ChartSamplesMax = 1000;
- TeeAutoZOrder = -1;
- TeeAutoDepth = -1;
- TeeNoPointClicked = -1;
- TeeDef3DPercent = 15;
- TeeColumnSeparator: {$IFDEF CLR}Char{$ELSE}AnsiChar{$ENDIF} = #6; // To separate columns in Legend
- TeeLineSeparator : {$IFDEF CLR}Char{$ELSE}AnsiChar{$ENDIF} = #13; // To separate lines of text
- // Index of first custom axis (0 to 5 are pre-created axes: Left,Top,
- // Right,Bottom,Depth and DepthTop.
- TeeInitialCustomAxis = 6;
- var TeeCheckMarkArrowColor : Boolean=False; // when True, the Marks arrow pen
- // color is changed if the point has
- // the same color.
- TeeRandomAtRunTime : Boolean=False; // adds random values at run-time too
- clTeeGallery1:Integer = 0; // index of ColorPalette[] global variable
- clTeeGallery2:Integer = 3; // index of ColorPalette[] global variable
- type
- TCustomAxisPanel=class;
- {$IFDEF CLR}
- [ToolBoxItem(False)]
- {$ENDIF}
- TCustomChartElement=class(TComponent)
- private
- FActive : Boolean;
- FBrush : TChartBrush;
- FParent : TCustomAxisPanel;
- FPen : TChartPen;
- protected
- InternalUse : Boolean; // 7.0
- Procedure CanvasChanged(Sender:TObject); virtual;
- Function CreateChartPen:TChartPen;
- class Function GetEditorClass:String; virtual;
- Procedure SetActive(Value:Boolean); virtual;
- Procedure SetBooleanProperty(Var Variable:Boolean; Value:Boolean); {$IFDEF D9}inline;{$ENDIF}
- procedure SetBrush(const Value: TChartBrush);
- Procedure SetColorProperty(Var Variable:TColor; Value:TColor);
- Procedure SetDoubleProperty(Var Variable:Double; Const Value:Double);
- Procedure SetIntegerProperty(Var Variable:Integer; Value:Integer);
- Procedure SetParentChart(Const Value:TCustomAxisPanel); virtual;
- {$IFNDEF CLR}
- procedure SetParentComponent(AParent: TComponent); override;
- {$ENDIF}
- procedure SetPen(const Value: TChartPen); virtual;
- Procedure SetStringProperty(Var Variable:String; Const Value:String);
- public
- Constructor Create(AOwner: TComponent); override;
- Destructor Destroy; override;
- procedure Assign(Source:TPersistent); override;
- class Function EditorClass:String; // 7.01 returns class name of editor form
- Function GetParentComponent: TComponent; override;
- Function HasParent:Boolean; override;
- {$IFDEF CLR}
- procedure SetParentComponent(AParent: TComponent); override;
- {$ENDIF}
- Procedure Repaint;
- property Active:Boolean read FActive write SetActive default True;
- property Brush:TChartBrush read FBrush write SetBrush;
- property ParentChart:TCustomAxisPanel read FParent write SetParentChart stored False;
- property Pen:TChartPen read FPen write SetPen;
- // Alias for Active property.
- property Visible:Boolean read FActive write SetActive default True;
- end;
- TCustomChartSeries=class;
- TChartSeries=class;
- {$IFDEF TEEVALUESINGLE}
- TChartValue=Single;
- {$ELSE}
- {$IFDEF TEEVALUEDOUBLE}
- TChartValue=Double;
- {$ELSE}
- {$IFDEF TEEVALUEEXTENDED}
- TChartValue=Extended;
- {$ELSE}
- TChartValue=Double; { <-- default }
- {$ENDIF}
- {$ENDIF}
- {$ENDIF}
- {$IFDEF TEEARRAY}
- TChartValues=Array of TChartValue;
- {$ELSE}
- PChartValue=^TChartValue;
- {$ENDIF}
- TChartListOrder=(loNone,loAscending,loDescending);
- // CLR: cannot be sealed due to cast tricks
- TChartValueList=class(TPersistent)
- private
- FDateTime : Boolean;
- {$IFNDEF TEEARRAY}
- FList : TList;
- {$ENDIF}
- FMaxValue : TChartValue;
- FMinValue : TChartValue;
- {$IFDEF TEEMULTIPLIER}
- FMultiplier : Double; { obsolete }
- {$ENDIF}
- FName : String;
- FOrder : TChartListOrder;
- FOwner : TChartSeries;
- FTempValue : TChartValue;
- FTotal : Double;
- FTotalABS : Double;
- FValueSource : String;
- { internal }
- IDefDateTime : Boolean;
- {$IFOPT C+}
- FCount : Integer;
- function GetCount:Integer;
- procedure SetCount(const Value:Integer);
- {$ENDIF}
- Function CompareValueIndex(a,b:Integer):Integer;
- Function GetMaxValue:TChartValue;
- Function GetMinValue:TChartValue;
- Function GetTotal:Double;
- Function GetTotalABS:Double;
- function IsDateStored: Boolean;
- procedure SetDateTime(Const Value:Boolean);
- {$IFDEF TEEMULTIPLIER}
- Function IsMultiStored:Boolean;
- Procedure SetMultiplier(Const Value:Double); { obsolete }
- {$ELSE}
- procedure ReadMultiplier(Reader: TReader);
- {$ENDIF}
- Procedure SetValueSource(Const Value:String);
- protected
- IData : TObject;
- Function AddChartValue:Integer; overload;
- Function AddChartValue(Const AValue:TChartValue):Integer; overload; virtual;
- Procedure ClearValues; virtual;
- {$IFNDEF TEEMULTIPLIER}
- procedure DefineProperties(Filer: TFiler); override;
- {$ENDIF}
- Function GetValue(ValueIndex:Integer):TChartValue;
- Procedure InitDateTime(Value:Boolean);
- Procedure InsertChartValue(ValueIndex:Integer; Const AValue:TChartValue); virtual;
- Procedure RecalcStats; overload;
- procedure RecalcStats(StartIndex:Integer); overload;
- Procedure SetValue(ValueIndex:Integer; Const AValue:TChartValue);
- public
- {$IFDEF TEEARRAY}
- Value : TChartValues;
- {$IFOPT C-} // When not using runtime assertions
- Count : Integer;
- {$ENDIF}
- {$ENDIF}
- Modified : Boolean;
- Constructor Create(AOwner:TChartSeries; Const AName:String); virtual;
- Destructor Destroy; override;
- Procedure Assign(Source:TPersistent); override;
- {$IFNDEF TEEARRAY}
- Function Count:Integer; virtual;
- {$ELSE}
- {$IFOPT C+}
- property Count:Integer read GetCount write SetCount;
- {$ENDIF}
- {$ENDIF}
- Procedure Delete(ValueIndex:Integer); overload; virtual;
- Procedure Delete(Start,Quantity:Integer); overload;
- {$IFDEF TEEARRAY}
- Procedure Exchange(Index1,Index2:Integer);
- {$ENDIF}
- Procedure FillSequence;
- Function First:TChartValue;
- Function Last:TChartValue;
- Function Locate(Const AValue:TChartValue):Integer; overload;
- Function Locate(Const AValue:TChartValue; FirstIndex,LastIndex:Integer):Integer; overload; // 7.0
- Function Range:TChartValue;
- Procedure Scroll; dynamic;
- Procedure Sort;
- property MaxValue:TChartValue read GetMaxValue;
- property MinValue:TChartValue read GetMinValue;
- property Owner:TChartSeries read FOwner;
- property TempValue:TChartValue read FTempValue write FTempValue;
- Function ToString(Index:Integer):String; {$IFDEF CLR}reintroduce;{$ENDIF}
- property Total:Double read GetTotal;
- property TotalABS:Double read GetTotalABS write FTotalABS;
- {$IFDEF TEEARRAY}
- property Items[Index:Integer]:TChartValue read GetValue write SetValue; default;
- {$ELSE}
- property Value[Index:Integer]:TChartValue read GetValue write SetValue; default;
- {$ENDIF}
- published
- property DateTime:Boolean read FDateTime write SetDateTime stored IsDateStored;
- property Name:String read FName write FName;
- {$IFDEF TEEMULTIPLIER}
- property Multiplier:Double read FMultiplier write SetMultiplier stored IsMultiStored; { obsolete }
- {$ENDIF}
- property Order:TChartListOrder read FOrder write FOrder;
- property ValueSource:String read FValueSource write SetValueSource;
- end;
- TChartAxisTitle=class {$IFDEF CLR}sealed{$ENDIF} (TTeeCustomShape)
- private
- FAngle : Integer;
- FCaption : String;
- IDefaultAngle : Integer;
- Function IsAngleStored:Boolean;
- Procedure SetAngle(const Value:Integer);
- Procedure SetCaption(Const Value:String);
- public
- Procedure Assign(Source:TPersistent); override;
- published
- property Angle:Integer read FAngle write SetAngle stored IsAngleStored;
- property Caption:String read FCaption write SetCaption;
- property Font;
- property Visible default True;
- end;
- AxisException=class {$IFDEF CLR}sealed{$ENDIF} (Exception);
- TAxisLabelStyle=(talAuto,talNone,talValue,talMark,talText);
- TAxisLabelAlign=(alDefault,alOpposite);
- TAxisCalcPos=function(const Value:TChartValue):Integer of object;
- TCustomSeriesList=class;
- TAxisGridPen=class {$IFDEF CLR}sealed{$ENDIF} (TDottedGrayPen)
- private
- FZ : Double;
- IDefaultZ : Double;
- FCentered: Boolean;
- function IsZStored:Boolean;
- procedure SetZ(const Value:Double);
- procedure SetCentered(const Value: Boolean);
- public
- // (pending to move Centered to "published" after removing Axis.GridCentered)
- property Centered:Boolean read FCentered write SetCentered default False;
- published
- property ZPosition:Double read FZ write SetZ stored IsZStored;
- end;
- TAxisTicks=Array of Integer;
- // TAxisTickValues=TChartValues;
- TChartAxis=class;
- TAxisItems=class;
- TAxisItem=class(TTeeCustomShape)
- private
- FValue : Double;
- FText : String;
- IAxisItems : TAxisItems;
- procedure SetText(const Value: String);
- procedure SetValue(const Value: Double);
- public
- procedure Repaint;
- published
- property Bevel;
- property BevelWidth;
- property Color;
- property Font;
- property Gradient;
- property Shadow;
- property ShapeStyle;
- property Text:String read FText write SetText;
- property Transparency;
- property Transparent default True;
- 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;
- property MinorTickLength:Integer read FMinorTickLength write SetMinorTickLength default 2;
- property MinorTicks:TDarkGrayPen read FMinorTicks write SetMinorTicks;
- property StartPosition:Double read FStartPosition write SetStartPosition
- stored IsStartStored;
- property EndPosition:Double read FEndPosition write SetEndPosition
- stored IsEndStored;
- property PositionPercent:Double read FPositionPercent write SetPositionPercent
- stored IsPosStored;
- property PositionUnits:TTeeUnits read FPosUnits write SetPosUnits default muPercent;
- property RoundFirstLabel:Boolean read FRoundFirstLabel write SetRoundFirstLabel default True;
- property TickInnerLength:Integer read FTickInnerLength write SetTickInnerLength default 0;
- property TickLength:Integer read FTickLength write SetTickLength default 4;
- property Ticks:TDarkGrayPen read FTicks write SetTicks;
- property TicksInner:TDarkGrayPen read FTicksInner write SetTicksInner;
- property TickOnLabelsOnly:Boolean read FTickOnLabelsOnly write SetTickOnLabelsOnly default True;
- property Title:TChartAxisTitle read FAxisTitle write SetAxisTitle;
- property TitleSize:Integer read FTitleSize write SetTitleSize default 0;
- property Visible:Boolean read FVisible write SetVisible default True;
- property ZPosition:Double read FZPosition write SetZPosition stored IsZStored;
- // Events
- property OnDrawLabel:TAxisDrawLabelEvent read FOnDrawLabel write FOnDrawLabel; // 7.0
- end;
- TChartDepthAxis=class(TChartAxis)
- protected
- Function InternalCalcLabelStyle:TAxisLabelStyle; override;
- Procedure SetInverted(Value:Boolean); override;
- published
- property Visible default False;
- end;
- TAxisOnGetLabel=Procedure( Sender:TChartAxis; Series:TChartSeries;
- ValueIndex:Integer; Var LabelText:String) of object;
- TAxisOnGetNextLabel=Procedure( Sender:TChartAxis; LabelIndex:Integer;
- Var LabelValue:Double; Var Stop:Boolean) of object;
- TSeriesClick=procedure( Sender:TChartSeries;
- ValueIndex:Integer;
- Button:TMouseButton;
- Shift: TShiftState;
- X, Y: Integer) of object;
- TValueEvent=(veClear,veAdd,veDelete,veRefresh,veModify);
- THorizAxis = (aTopAxis,aBottomAxis,aBothHorizAxis,aCustomHorizAxis);
- TVertAxis = (aLeftAxis,aRightAxis,aBothVertAxis,aCustomVertAxis);
- TChartClickedPartStyle=( cpNone,
- cpLegend,
- cpAxis,
- cpSeries,
- cpTitle,
- cpFoot,
- cpChartRect,
- cpSeriesMarks,
- cpSubTitle,
- cpSubFoot );
- TChartClickedPart=Packed Record
- Part : TChartClickedPartStyle;
- PointIndex : Integer;
- ASeries : TChartSeries;
- AAxis : TChartAxis;
- end;
- TCustomSeriesList=class(TList)
- private
- FOwner : TCustomAxisPanel;
- procedure Put(Index:Integer; Value:TChartSeries);
- function Get(Index:Integer):TChartSeries;
- public
- procedure ClearValues;
- procedure FillSampleValues(Num:Integer=0);
- property Items[Index:Integer]:TChartSeries read Get write Put; default;
- property Owner:TCustomAxisPanel read FOwner;
- end;
- TSeriesGroup=class;
- TSeriesGroups=class;
- TChartSeriesList=class {$IFDEF CLR}sealed{$ENDIF} (TCustomSeriesList)
- private
- FGroups : TSeriesGroups;
- function GetAllActive: Boolean;
- procedure SetAllActive(const Value: Boolean);
- public
- Destructor Destroy; override;
- Function AddGroup(const Name:String):TSeriesGroup;
- property AllActive:Boolean read GetAllActive write SetAllActive;
- property Groups:TSeriesGroups read FGroups;
- end;
- TSeriesGroupActive=(gaYes, gaNo, gaSome);
- TSeriesGroup=class {$IFDEF CLR}sealed{$ENDIF} (TCollectionItem)
- private
- FName : String;
- FSeries : TCustomSeriesList;
- procedure SetActive(const Value:TSeriesGroupActive);
- function IsSeriesStored: Boolean;
- procedure SetSeries(const Value: TCustomSeriesList);
- function GetActive: TSeriesGroupActive;
- public
- Constructor Create(Collection:TCollection); {$IFDEF D5}overload;{$ENDIF} override;
- Destructor Destroy; override;
- procedure Add(Series:TChartSeries);
- procedure Hide;
- procedure Show;
- published
- property Active:TSeriesGroupActive read GetActive write SetActive default gaYes;
- property Name:String read FName write FName;
- property Series:TCustomSeriesList read FSeries write SetSeries stored IsSeriesStored;
- end;
- TSeriesGroups=class {$IFDEF CLR}sealed{$ENDIF} (TOwnedCollection)
- private
- Function Get(Index:Integer):TSeriesGroup;
- Procedure Put(Index:Integer; Const Value:TSeriesGroup);
- public
- Function Contains(Series:TChartSeries):Integer;
- property Items[Index:Integer]:TSeriesGroup read Get write Put; default;
- end;
- TChartAxes=class {$IFDEF CLR}sealed{$ENDIF} (TList)
- private
- FChart : TCustomAxisPanel;
- IFastCalc : Boolean; // default False
- function Get(Index:Integer):TChartAxis;
- function GetBottomAxis:TChartAxis;
- function GetDepthAxis:TChartDepthAxis;
- function GetDepthTopAxis: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;
- procedure Hide; // 7.04
- procedure Reset;
- property Items[Index:Integer]:TChartAxis read Get; default;
- property Bottom:TChartAxis read GetBottomAxis;
- property Depth:TChartDepthAxis read GetDepthAxis;
- property DepthTop:TChartDepthAxis read GetDepthTopAxis;
- 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 {$IFDEF CLR}sealed{$ENDIF} (TOwnedCollection)
- private
- Function Get(Index:Integer):TChartAxis;
- Procedure Put(Index:Integer; Const Value:TChartAxis);
- public
- procedure ResetScales(Axis:TChartAxis);
- 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 {$IFDEF CLR}sealed{$ENDIF} (TTeeEvent);
- TChartToolEvent=( cteAfterDraw,
- cteBeforeDrawSeries,
- cteBeforeDraw,
- cteBeforeDrawAxes, // 7.0
- cteAfterDrawSeries, // 7.0
- cteMouseLeave); // 7.0
- 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 {$IFDEF CLR}sealed{$ENDIF} (TList)
- private
- Owner : TCustomAxisPanel;
- Function Get(Index:Integer):TTeeCustomTool;
- procedure SetActive(Value:Boolean);
- public
- Function Add(Tool:TTeeCustomTool):TTeeCustomTool;
- procedure Clear; override;
- property Active:Boolean write SetActive;
- 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
- class Function GetEditorClass:String; override;
- Function GetHorizAxis:TChartAxis;
- Function GetVertAxis:TChartAxis;
- 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 }
- F3DPercent : Integer;
- FAxes : TChartAxes;
- FAxisBehind : Boolean;
- FAxisVisible : Boolean;
- FClipPoints : Boolean;
- FCustomAxes : TChartCustomAxes;
- FSeriesList : TChartSeriesList;
- FDepthAxis : TChartDepthAxis;
- FDepthTopAxis : 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; {$IFDEF D9}inline;{$ENDIF}
- Procedure InternalAddSeries(ASeries:TCustomChartSeries);
- Function InternalMinMax(AAxis:TChartAxis; IsMin,IsX:Boolean):Double;
- Function NoActiveSeries(AAxis:TChartAxis):Boolean;
- Procedure Set3DPercent(Value:Integer);
- 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 SetDepthTopAxis(const 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);
- Function CalcIsAxisVisible(Axis:TChartAxis):Boolean;
- Procedure CalcWallsRect; virtual; abstract;
- Function CalcWallSize(Axis:TChartAxis):Integer; virtual; abstract;
- Function CheckMouseSeries(x,y:Integer):Boolean;
- procedure ColorPaletteChanged;
- procedure DoOnAfterDraw; virtual;
- procedure DoOnBeforeDrawAxes; virtual;
- procedure DoOnBeforeDrawChart; virtual;
- procedure DoOnBeforeDrawSeries; virtual;
- procedure DrawTitlesAndLegend(BeforeSeries:Boolean); virtual; abstract;
- Function DrawBackWallAfter(Z:Integer):Boolean; virtual;
- Procedure DrawWalls; virtual; abstract;
- Procedure InternalDraw(Const UserRectangle: TRect); override;
- Function IsAxisVisible(Axis:TChartAxis):Boolean;
- Function MultiLineTextWidth(S:String; Var NumLines:Integer):Integer;
- procedure RemovedDataSource( ASeries: TChartSeries;
- AComponent: TComponent ); dynamic;
- Procedure SetPage(Value:Integer);
- {$IFNDEF CLR}
- Procedure GetChildren(Proc:TGetChildProc; Root:TComponent); override;
- {$ENDIF}
- {$IFNDEF CLX}
- procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
- {$ELSE}
- procedure MouseLeave(AControl: TControl); override;
- {$ENDIF}
- public
- { Public declarations }
- Designer : TTeeCustomDesigner; { used only at Design-Time }
- ColorPalette : TColorArray;
- Constructor Create(AOwner: TComponent); override;
- Destructor Destroy; override;
- { public methods }
- procedure Assign(Source:TPersistent); override;
- Function ActiveSeriesLegend(ItemIndex:Integer):TChartSeries;
- Function AddSeries(const ASeries:TChartSeries):TChartSeries; overload; { 5.01 }
- Function AddSeries({$IFNDEF BCB}const{$ENDIF} ASeriesClass:TChartSeriesClass):TChartSeries; overload;
- {$IFNDEF BCB}
- procedure AddSeries(const SeriesArray:Array of TChartSeries); overload;
- {$ENDIF}
- 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;
- {$IFDEF CLR}
- Procedure GetChildren(Proc:TGetChildProc; Root:TComponent); override;
- {$ENDIF}
- Function GetDefaultColor(Index:Integer):TColor;
- Function GetFreeSeriesColor(CheckBackground:Boolean=True; Series:TChartSeries=nil):TColor;
- Function GetMaxValuesCount:Integer;
- Function IsFreeSeriesColor(AColor: TColor; CheckBackground: Boolean;
- Series:TChartSeries=nil):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); overload;
- Procedure RemoveSeries(SeriesIndex: Integer); overload;
- property Series[Index: Integer]:TChartSeries read GetSeries; default;
- Function SeriesCount:Integer; //{$IFDEF D9}inline;{$ENDIF}
- 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 Chart3DPercent:Integer read F3DPercent write Set3DPercent
- default TeeDef3DPercent; // obsolete;
- property ClipPoints:Boolean read FClipPoints write SetClipPoints default True;
- property Color;
- property DepthAxis:TChartDepthAxis read FDepthAxis write SetDepthAxis;
- property DepthTopAxis:TChartDepthAxis read FDepthTopAxis write SetDepthTopAxis; // 7.0
- 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 {$IFDEF CLR}sealed{$ENDIF} (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 {$IFDEF CLR}sealed{$ENDIF} (TTeeCustomShape)
- published
- property Bevel;
- property BevelWidth;
- property Color default ChartMarkColor;
- property Font;
- property Gradient;
- property Shadow;
- property ShapeStyle;
- property Transparency;
- property Transparent;
- end;
- TMarksItems=class {$IFDEF CLR}sealed{$ENDIF} (TList)
- private
- IMarks : TTeeCustomShape;
- ILoadingCustom : Boolean;
- function Get(Index:Integer):TMarksItem;
- public
- Procedure Clear; override;
- property Format[Index:Integer]:TMarksItem read Get; default;
- end;
- TSeriesMarksStyle=( smsValue, { 1234 }
- smsPercent, { 12 % }
- smsLabel, { Cars }
- smsLabelPercent, { Cars 12 % }
- smsLabelValue, { Cars 1234 }
- smsLegend, { (Legend.Style) }
- smsPercentTotal, { 12 % of 1234 }
- smsLabelPercentTotal, { Cars 12 % of 1234 }
- smsXValue, { 1..2..3.. or 21/6/1996 }
- smsXY { 123 456 }
- );
- TSeriesMarksGradient=class {$IFDEF CLR}sealed{$ENDIF} (TChartGradient)
- public
- Constructor Create(ChangedEvent:TNotifyEvent); override;
- published
- property Direction default gdRightLeft;
- property EndColor default clWhite;
- property StartColor default clSilver;
- end;
- TSeriesPointerStyle=( psRectangle,psCircle,psTriangle,psDownTriangle,
- psCross,psDiagCross,psStar,psDiamond,psSmallDot,
- psNothing,psLeftTriangle,psRightTriangle );
- TSeriesPointer=class(TTeeCustomShapeBrushPen)
- private
- FDark3D : Boolean;
- FDraw3D : Boolean;
- FGradient : TTeeGradient;
- FHorizSize : Integer;
- FInflate : Boolean;
- FSeries : TChartSeries;
- FStyle : TSeriesPointerStyle;
- FTransparency : TTeeTransparency; // 6.02
- FVertSize : Integer;
- Procedure CheckPointerSize(Value:Integer);
- function GetColor: TColor;
- function GetSize:Integer; // 7.01
- function GetStartZ:Integer; // 6.01
- function GetMiddleZ:Integer; // 6.01
- function GetEndZ:Integer; // 6.01
- procedure SetColor(const Value: TColor);
- Procedure SetDark3D(Value:Boolean);
- Procedure SetDraw3D(Value:Boolean);
- procedure SetGradient(const Value: TTeeGradient);
- Procedure SetHorizSize(Value:Integer);
- Procedure SetInflate(Value:Boolean);
- procedure SetSize(const Value:Integer); // 7.01
- Procedure SetStyle(Value:TSeriesPointerStyle);
- procedure SetTransparency(const Value: TTeeTransparency);
- Procedure SetVertSize(Value:Integer);
- protected
- AllowChangeSize : Boolean;
- FullGradient : Boolean;
- Procedure CalcHorizMargins(Var LeftMargin,RightMargin:Integer);
- Procedure CalcVerticalMargins(Var TopMargin,BottomMargin:Integer);
- Procedure Change3D(Value:Boolean);
- Procedure ChangeHorizSize(NewSize:Integer);
- Procedure ChangeStyle(NewStyle:TSeriesPointerStyle);
- Procedure ChangeVertSize(NewSize:Integer);
- Procedure Prepare;
- public
- Constructor Create(AOwner:TChartSeries);
- Destructor Destroy; override;
- Procedure Assign(Source:TPersistent); override;
- Procedure Draw(P:TPoint); overload;
- Procedure Draw(X,Y:Integer); overload;
- Procedure Draw(px,py:Integer; ColorValue:TColor; AStyle:TSeriesPointerStyle); overload;
- Procedure DrawPointer( ACanvas:TCanvas3D;
- Is3D:Boolean; px,py,tmpHoriz,tmpVert:Integer;
- ColorValue:TColor; AStyle:TSeriesPointerStyle);
- Procedure PrepareCanvas(ACanvas:TCanvas3D; ColorValue:TColor);
- property Color:TColor read GetColor write SetColor;
- property ParentSeries:TChartSeries read FSeries;
- property Size:Integer read GetSize write SetSize; // do not move to published
- published
- property Brush;
- property Dark3D:Boolean read FDark3D write SetDark3D default True;
- Property Draw3D:Boolean read FDraw3D write SetDraw3D default True;
- property Gradient:TTeeGradient read FGradient write SetGradient; // 6.0
- Property HorizSize:Integer read FHorizSize write SetHorizSize default 4;
- property InflateMargins:Boolean read FInflate write SetInflate;
- property Pen;
- property Style:TSeriesPointerStyle read FStyle write SetStyle;
- property Transparency:TTeeTransparency read FTransparency write SetTransparency default 0;
- Property VertSize:Integer read FVertSize write SetVertSize default 4;
- Property Visible;
- end;
- TArrowHeadStyle=(ahNone,ahLine,ahSolid);
- TChartArrowPen=TWhitePen;
- TCallout=class(TSeriesPointer)
- private
- FArrow : TChartArrowPen;
- FArrowHead : TArrowHeadStyle;
- FDistance : Integer;
- FArrowHeadSize: Integer;
- procedure SetDistance(const Value: Integer);
- procedure SetArrow(const Value: TChartArrowPen);
- procedure SetArrowHead(const Value: TArrowHeadStyle);
- procedure SetArrowHeadSize(const Value: Integer);
- protected
- procedure Draw(AColor:TColor; AFrom,ATo:TPoint; Z:Integer); overload;
- public
- Constructor Create(AOwner:TChartSeries);
- Procedure Assign(Source:TPersistent); override;
- destructor Destroy; override;
- published
- property Arrow:TChartArrowPen read FArrow write SetArrow;
- property ArrowHead:TArrowHeadStyle read FArrowHead write SetArrowHead default ahNone;
- property ArrowHeadSize:Integer read FArrowHeadSize write SetArrowHeadSize default 8;
- property Distance:Integer read FDistance write SetDistance default 0;
- property Draw3D default False;
- property InflateMargins default True;
- property Style default psRectangle;
- property Visible default True;
- end;
- TMarksCallout=class(TCallout)
- private
- FLength : Integer;
- procedure ApplyArrowLength(APosition:TSeriesMarkPosition);
- Function IsLengthStored:Boolean;
- procedure SetLength(const Value:Integer);
- protected
- DefaultLength : Integer;
- public
- Constructor Create(AOwner: TChartSeries);
- Procedure Assign(Source:TPersistent); override;
- published
- property Length:Integer read FLength write SetLength stored IsLengthStored;
- property Visible default False;
- end;
- TSeriesMarksSymbol=class {$IFDEF CLR}sealed{$ENDIF} (TTeeCustomShape)
- private
- Function ShouldDraw:Boolean;
- public
- Constructor Create(AOwner:TCustomTeePanel); override;
- published
- property Bevel; { 5.01 }
- property BevelWidth; { 5.01 }
- property Brush;
- property Frame;
- property Gradient;
- property Pen;
- property Shadow;
- property ShapeStyle;
- property Transparency; { 5.01 }
- property Visible default False;
- end;
- // CLR Note: This class cannot be marked as "sealed"
- // due to required cast access tricks.
- TSeriesMarks=class(TTeeCustomShape)
- private
- FAngle : Integer;
- FCallout : TMarksCallout;
- FClip : Boolean;
- FDrawEvery : Integer;
- FItems : TMarksItems;
- FMarkerStyle : TSeriesMarksStyle;
- FMultiLine : Boolean;
- FSeries : TChartSeries;
- FPositions : TSeriesMarksPositions;
- FSymbol : TSeriesMarksSymbol;
- FZPosition : Integer;
- function GetArrowLength: Integer;
- function GetArrowPen: TChartArrowPen;
- Function GetBackColor:TColor;
- Function GetCallout:TMarksCallout;
- function GetItem(Index:Integer):TMarksItem;
- Function GetSymbol: TSeriesMarksSymbol;
- Procedure InternalDraw(Index:Integer; AColor:TColor; Const St:String; APosition:TSeriesMarkPosition);
- procedure ReadItems(Stream: TStream);
- Procedure SetAngle(Value:Integer);
- procedure SetCallout(const Value: TMarksCallout);
- Procedure SetArrowPen(const Value:TChartArrowPen);
- Procedure SetArrowLength(Value:Integer);
- Procedure SetBackColor(Value:TColor);
- Procedure SetClip(Value:Boolean);
- Procedure SetDrawEvery(Value:Integer);
- Procedure SetMultiline(Value:Boolean);
- Procedure SetStyle(Value:TSeriesMarksStyle);
- procedure SetSymbol(const Value: TSeriesMarksSymbol);
- procedure WriteItems(Stream: TStream);
- protected
- Procedure AntiOverlap(First, ValueIndex:Integer; APosition:TSeriesMarkPosition);
- Procedure ConvertTo2D(Point:TPoint; var P:TPoint);
- procedure DefineProperties(Filer: TFiler); override;
- Function GetGradientClass:TChartGradientClass; override;
- Procedure InitShadow(AShadow:TTeeShadow); override;
- Function MarkItem(ValueIndex:Integer):TTeeCustomShape;
- procedure SetParent(Value:TCustomTeePanel); override;
- Function TextWidth(ValueIndex:Integer):Integer;
- Procedure UsePosition(Index:Integer; Var MarkPosition:TSeriesMarkPosition);
- public
- Constructor Create(AOwner:TChartSeries); overload;
- Destructor Destroy; override;
- Procedure ApplyArrowLength(APosition:TSeriesMarkPosition);
- Procedure Assign(Source:TPersistent); override;
- procedure Clear;
- Function Clicked(X,Y:Integer):Integer;
- Procedure DrawText(Const R:TRect; Const St:String);
- property Item[Index:Integer]:TMarksItem read GetItem; default;
- property Items:TMarksItems read FItems;
- property ParentSeries:TChartSeries read FSeries;
- property Positions:TSeriesMarksPositions read FPositions;
- procedure ResetPositions;
- property ZPosition : Integer read FZPosition write FZPosition;
- published
- property Angle:Integer read FAngle write SetAngle default 0;
- property Arrow:TChartArrowPen read GetArrowPen write SetArrowPen; // obsolete
- property ArrowLength:Integer read GetArrowLength write SetArrowLength stored False; // obsolete
- property Callout:TMarksCallout read GetCallout write SetCallout; // 6.0
- property BackColor:TColor read GetBackColor write SetBackColor default ChartMarkColor;
- property Bevel; { 5.01 }
- property BevelWidth; { 5.01 }
- property Brush;
- property Clip:Boolean read FClip write SetClip default False;
- property Color default ChartMarkColor;
- property DrawEvery:Integer read FDrawEvery write SetDrawEvery default 1;
- property Font;
- property Frame;
- property Gradient;
- property MultiLine:Boolean read FMultiLine write SetMultiLine default False;
- property Shadow;
- property ShapeStyle;
- property Style:TSeriesMarksStyle read FMarkerStyle
- write SetStyle default smsLabel;
- property Symbol:TSeriesMarksSymbol read GetSymbol write SetSymbol;
- property Transparency; { 5.01 }
- property Transparent;
- property Visible;
- end;
- TSeriesOnBeforeAdd=Function(Sender:TChartSeries):Boolean of object;
- TSeriesOnAfterAdd=Procedure(Sender:TChartSeries; ValueIndex:Integer) of object;
- TSeriesOnClear=Procedure(Sender:TChartSeries) of object;
- TSeriesOnGetMarkText=Procedure(Sender:TChartSeries; ValueIndex:Integer; Var MarkText:String) of object;
- TSeriesRecalcOptions=set of (rOnDelete, rOnModify, rOnInsert, rOnClear);
- TFunctionPeriodStyle=( psNumPoints, psRange );
- TFunctionPeriodAlign=( paFirst,paCenter,paLast );
- {$IFDEF CLR}
- [ToolBoxItem(False)]
- {$ENDIF}
- TTeeFunction=class(TComponent)
- private
- FPeriod : Double;
- FPeriodStyle : TFunctionPeriodStyle;
- FPeriodAlign : TFunctionPeriodAlign;
- FParent : TChartSeries;
- IUpdating : Boolean;
- Procedure SetPeriod(Const Value:Double);
- Procedure SetParentSeries(AParent:TChartSeries);
- Procedure SetPeriodAlign(Value:TFunctionPeriodalign);
- Procedure SetPeriodStyle(Value:TFunctionPeriodStyle);
- protected
- CanUsePeriod : Boolean; // function uses Period property ?
- NoSourceRequired : Boolean; // function requires source Series ?
- SingleSource : Boolean; // function allows more than one source ?
- HideSourceList : Boolean; // For single-source, allow select value-list ?
- Procedure AddFunctionXY(YMandatorySource:Boolean; const tmpX,tmpY:Double);
- Procedure CalculatePeriod( Source:TChartSeries;
- Const tmpX:Double;
- FirstIndex,LastIndex:Integer); virtual;
- Procedure CalculateAllPoints(Source:TChartSeries; NotMandatorySource:TChartValueList); virtual;
- Procedure CalculateByPeriod(Source:TChartSeries; NotMandatorySource:TChartValueList); virtual;
- procedure Clear; dynamic;
- Procedure DoCalculation( Source:TChartSeries;
- NotMandatorySource:TChartValueList); virtual;
- class Function GetEditorClass:String; virtual;
- Procedure InternalSetPeriod(Const APeriod:Double);
- Function IsValidSource(Value:TChartSeries):Boolean; dynamic;
- class Procedure PrepareForGallery(Chart:TCustomAxisPanel); virtual;
- {$IFNDEF CLR}
- procedure SetParentComponent(Value: TComponent); override;
- {$ENDIF}
- Function ValueList(ASeries:TChartSeries):TChartValueList;
- public
- Constructor Create(AOwner: TComponent); override;
- Procedure Assign(Source:TPersistent); override;
- procedure AddPoints(Source:TChartSeries); dynamic;
- procedure BeginUpdate;
- Function Calculate(SourceSeries:TChartSeries; First,Last:Integer):Double; virtual;
- Function CalculateMany(SourceSeriesList:TList; ValueIndex:Integer):Double; virtual;
- procedure EndUpdate;
- function GetParentComponent: TComponent; override;
- function HasParent: Boolean; override;
- property ParentSeries:TChartSeries read FParent write SetParentSeries;
- Procedure ReCalculate;
- {$IFDEF CLR}
- procedure SetParentComponent(Value: TComponent); override;
- {$ENDIF}
- published
- property Period:Double read FPeriod write SetPeriod;
- property PeriodAlign:TFunctionPeriodAlign read FPeriodAlign
- write SetPeriodAlign default paCenter;
- property PeriodStyle:TFunctionPeriodStyle read FPeriodStyle
- write SetPeriodStyle default psNumPoints;
- end;
- TTeeMovingFunction=class(TTeeFunction)
- protected
- Procedure DoCalculation( Source:TChartSeries;
- NotMandatorySource:TChartValueList); override;
- public
- Constructor Create(AOwner:TComponent); override;
- published
- property Period;
- end;
- TChartValueLists=class {$IFDEF CLR}sealed{$ENDIF} (TList)
- private
- Function Get(Index:Integer):TChartValueList;
- public
- Procedure Clear; override;
- property ValueList[Index:Integer]:TChartValueList read Get; default;
- end;
- TChartSeriesStyle=set of ( tssIsTemplate,
- tssDenyChangeType,
- tssDenyDelete,
- tssDenyClone,
- tssIsPersistent,
- tssHideDataSource );
- TCustomChartSeries=class(TCustomChartElement)
- private
- FShowInLegend : Boolean;
- FTitle : String;
- FIdentifier : String; { DecisionCube }
- FStyle : TChartSeriesStyle; { DecisionCube }
- procedure ReadIdentifier(Reader: TReader);
- procedure WriteIdentifier(Writer: TWriter);
- procedure ReadStyle(Reader: TReader);
- procedure WriteStyle(Writer: TWriter);
- Procedure RepaintDesigner;
- Procedure SetShowInLegend(Value:Boolean);
- Procedure SetTitle(Const Value:String);
- protected
- Procedure Added; dynamic;
- Procedure CalcHorizMargins(Var LeftMargin,RightMargin:Integer); virtual;
- Procedure CalcVerticalMargins(Var TopMargin,BottomMargin:Integer); virtual;
- procedure DefineProperties(Filer: TFiler); override;
- procedure DoBeforeDrawChart; virtual;
- Procedure GalleryChanged3D(Is3D:Boolean); dynamic;
- Procedure Removed; dynamic;
- Procedure SetActive(Value:Boolean); override;
- public
- Constructor Create(AOwner: TComponent); override;
- procedure Assign(Source:TPersistent); override;
- Function SameClass(tmpSeries:TChartSeries):Boolean;
- property ShowInLegend:Boolean read FShowInLegend write SetShowInLegend default True;
- property Title:String read FTitle write SetTitle;
- { DSS, hidden }
- property Identifier:String read FIdentifier write FIdentifier;
- property Style:TChartSeriesStyle read FStyle write FStyle default [];
- end;
- TSeriesRandomBounds=packed record
- tmpX,StepX,tmpY,MinY,DifY:Double;
- end;
- TTeeFunctionClass=class of TTeeFunction;
- {$IFDEF CLR}
- PString=string;
- {$ENDIF}
- TTeeSeriesType=class {$IFDEF CLR}sealed{$ENDIF} (TObject)
- SeriesClass : TChartSeriesClass;
- FunctionClass : TTeeFunctionClass;
- Description : PString;
- GalleryPage : PString;
- NumGallerySeries : Integer;
- end;
- TChartSubGalleryProc=Function(Const AName:String):TCustomAxisPanel of object;
- TLegendTextStyle=( ltsPlain,ltsLeftValue,ltsRightValue,
- ltsLeftPercent,ltsRightPercent,ltsXValue,ltsValue,
- ltsPercent,ltsXAndValue,ltsXAndPercent);
- TeeFormatFlags = (tfNoMandatory,tfColor,tfLabel,tfMarkPosition);
- TeeFormatFlag = set of TeeFormatFlags;
- TLabelsList=class {$IFDEF CLR}sealed{$ENDIF} (TList)
- private
- Series : TChartSeries;
- Procedure DeleteLabel(ValueIndex:Integer);
- Function GetLabel(ValueIndex:Integer):String;
- Procedure SetLabel(ValueIndex:Integer; Const ALabel:String);
- Procedure InsertLabel(ValueIndex:Integer; Const ALabel:String);
- public
- procedure Assign(Source:TLabelsList);
- procedure Clear; override;
- Function IndexOfLabel(const ALabel:String; CaseSensitive:Boolean=True):Integer;
- property Labels[Index:Integer]:String read GetLabel write SetLabel; default;
- end;
- TDataSourcesList=class {$IFDEF CLR}sealed{$ENDIF} (TList) // 6.02
- private
- Series : TChartSeries;
- function InheritedAdd(Value:TComponent):Integer;
- procedure InheritedClear;
- {$IFDEF D5}
- protected
- {$IFDEF CLR}
- procedure Notify(Instance:TObject; Action: TListNotification); override;
- {$ELSE}
- procedure Notify(Ptr: Pointer; Action: TListNotification); override;
- {$ENDIF}
- {$ENDIF}
- public
- function Add(Value:TComponent):Integer;
- procedure Clear; override;
- end;
- TChartSeries=class(TCustomChartSeries)
- private
- FColor : TColor;
- FColorEachPoint : Boolean;
- FColors : TList;
- FColorSource : String;
- FCursor : TCursor;
- FDataSources : TDataSourcesList;
- FDepth : Integer;
- FGetHorizAxis : TChartAxis;
- FGetVertAxis : TChartAxis;
- FLabelsSource : String;
- FLinkedSeries : TCustomSeriesList;
- FMarks : TSeriesMarks;
- FPercentFormat : String;
- FTempDataSources : TStringList;
- FValueFormat : String;
- FValuesList : TChartValueLists;
- FX : TChartValueList;
- FLabels : TLabelsList;
- FY : TChartValueList;
- FHorizAxis : THorizAxis;
- FCustomHorizAxis : TChartAxis;
- FCustomVertAxis : TChartAxis;
- FZOrder : Integer;
- FVertAxis : TVertAxis;
- FRecalcOptions : TSeriesRecalcOptions;
- FTeeFunction : TTeeFunction;
- { Private }
- IsMouseInside : Boolean;
- ILabelOrder : TChartListOrder;
- ISeriesColor : TColor; // Color assigned when creating the Series.
- { Events }
- FAfterDrawValues : TNotifyEvent;
- FBeforeDrawValues : TNotifyEvent;
- FOnAfterAdd : TSeriesOnAfterAdd;
- FOnBeforeAdd : TSeriesOnBeforeAdd;
- FOnClearValues : TSeriesOnClear;
- FOnClick : TSeriesClick;
- FOnDblClick : TSeriesClick;
- FOnGetMarkText : TSeriesOnGetMarkText;
- FOnMouseEnter : TNotifyEvent;
- FOnMouseLeave : TNotifyEvent;
- Function CanAddRandomPoints:Boolean;
- Procedure ChangeInternalColor(Value:TColor);
- Function CompareLabelIndex(a,b:Integer):Integer;
- Function GetDataSource:TComponent;
- Function GetZOrder:Integer;
- Procedure GrowColors;
- Function InternalAddDataSource(Value:TComponent):Integer;
- Function InternalSetDataSource(Value:TComponent; ClearAll:Boolean):Integer;
- Procedure InternalRemoveDataSource(Value:TComponent);
- Function IsColorStored:Boolean;
- Function IsPercentFormatStored:Boolean;
- Function IsValueFormatStored:Boolean;
- Procedure NotifyColorChanged;
- procedure ReadCustomHorizAxis(Reader: TReader);
- procedure ReadCustomVertAxis(Reader: TReader);
- procedure ReadDataSources(Reader: TReader);
- Procedure RecalcGetAxis;
- Procedure RemoveAllLinkedSeries;
- Procedure SetColorSource(Const Value:String);
- Procedure SetCustomHorizAxis(Value:TChartAxis);
- Procedure SetCustomVertAxis(Value:TChartAxis);
- Procedure SetDataSource(Value:TComponent);
- procedure SetDepth(const Value: Integer);
- Procedure SetHorizAxis(const Value:THorizAxis);
- Procedure SetLabelsSource(Const Value:String);
- procedure SetMarks(Value:TSeriesMarks);
- Procedure SetPercentFormat(Const Value:String);
- Procedure SetValueColor(ValueIndex:Integer; AColor:TColor);
- Procedure SetValueFormat(Const Value:String);
- Procedure SetVertAxis(const Value:TVertAxis);
- Procedure SetXValue(Index:Integer; Const Value:Double);
- Procedure SetYValue(Index:Integer; Const Value:Double);
- Procedure SetZOrder(Value:Integer);
- procedure WriteCustomHorizAxis(Writer: TWriter);
- procedure WriteCustomVertAxis(Writer: TWriter);
- procedure WriteDataSources(Writer: TWriter);
- function GetXLabel(Index: Integer): String;
- procedure SetXLabel(Index: Integer; const Value: String);
- protected
- DontSaveData : Boolean;
- ForceSaveData : Boolean;
- ManualData : Boolean;
- FFirstVisibleIndex : Integer;
- FLastVisibleIndex : Integer;
- INumSampleValues : Integer;
- IUpdating : Integer;
- IUseSeriesColor : Boolean;
- IUseNotMandatory : Boolean;
- IZOrder : Integer;
- ILegend : TTeeCustomShape;
- IFirstDrawIndex : Integer;
- Function AddChartValue(Source:TChartSeries; ValueIndex:Integer):Integer; virtual;
- Procedure Added; override;
- Procedure AddedValue(Source:TChartSeries; ValueIndex:Integer); virtual;
- Procedure AddLinkedSeries(ASeries:TChartSeries);
- Procedure AddSampleValues(NumValues:Integer; OnlyMandatory:Boolean=False); dynamic;
- Procedure AddValues(Source:TChartSeries); virtual;
- procedure CalcFirstLastPage(var First,Last:Integer);
- Procedure CalcFirstLastVisibleIndex; virtual;
- Procedure CalcZOrder; virtual;
- procedure CalcDepthPositions; virtual;
- Function CheckMouse(x,y:Integer):Boolean;
- Procedure ClearLists; virtual;
- class Procedure CreateSubGallery(AddSubChart:TChartSubGalleryProc); virtual;
- procedure DefineProperties(Filer: TFiler); override;
- Procedure DeletedValue(Source:TChartSeries; ValueIndex:Integer); virtual;
- procedure DoAfterDrawValues; virtual;
- procedure DoBeforeDrawValues; virtual;
- procedure DrawAllValues; virtual;
- Procedure DrawLegendShape(ValueIndex:Integer; Const Rect:TRect); virtual;
- Procedure DrawMark(ValueIndex:Integer; Const St:String; APosition:TSeriesMarkPosition); virtual;
- procedure DrawMarks;
- procedure DrawValue(ValueIndex:Integer); virtual;
- Function FirstInZOrder:Boolean;
- Procedure GetChildren(Proc:TGetChildProc; Root:TComponent); override;
- Function GetMarkText(ValueIndex:Integer):String;
- Function GetSeriesColor:TColor;
- Function GetValueColor(ValueIndex:Integer):TColor; virtual;
- Function GetxValue(ValueIndex:Integer):Double; virtual; { conflicts with c++ wingdi.h }
- Function GetyValue(ValueIndex:Integer):Double; virtual; { conflicts with c++ wingdi.h }
- Function InternalColor(ValueIndex:Integer):TColor;
- Procedure Loaded; override;
- Function MandatoryAxis:TChartAxis; // 6.02
- procedure Notification( AComponent: TComponent;
- Operation: TOperation); override;
- Procedure NotifyNewValue(Sender:TChartSeries; ValueIndex:Integer); virtual;
- Procedure NotifyValue(ValueEvent:TValueEvent; ValueIndex:Integer); virtual;
- Function MoreSameZOrder:Boolean; virtual;
- Procedure PrepareForGallery(IsEnabled:Boolean); dynamic;
- Procedure PrepareLegendCanvas( ValueIndex:Integer; Var BackColor:TColor;
- Var BrushStyle:TBrushStyle); virtual;
- class Function RandomValue(const Range:Integer):Integer;
- procedure ReadData(Stream: TStream);
- Procedure Removed; override;
- Procedure RemoveLinkedSeries(ASeries:TChartSeries);
- Procedure SetChartValueList( AValueList:TChartValueList;
- Value:TChartValueList);
- Procedure SetColorEachPoint(Value:Boolean); virtual;
- Procedure SetHorizontal;
- procedure SetMarkText(ValueIndex:Integer; const Value:String); // 7.02
- Procedure SetParentChart(Const Value:TCustomAxisPanel); override;
- Procedure SetSeriesColor(AColor:TColor); virtual;
- class Procedure SetSubGallery(ASeries:TChartSeries; Index:Integer); virtual;
- Procedure SetXValues(Value:TChartValueList);
- Procedure SetYValues(Value:TChartValueList);
- Function ValueListOfAxis(Axis:TChartAxis):TChartValueList; virtual;
- procedure WriteData(Stream: TStream); dynamic;
- public
- CalcVisiblePoints : Boolean;
- DrawBetweenPoints : Boolean;
- AllowSinglePoint : Boolean;
- HasZValues : Boolean;
- StartZ : Integer;
- MiddleZ : Integer;
- EndZ : Integer;
- MandatoryValueList : TChartValueList;
- NotMandatoryValueList : TChartValueList;
- YMandatory : Boolean;
- Constructor Create(AOwner: TComponent); override;
- Destructor Destroy; override;
- Function Add(Const AValue:Double; Const ALabel:String='';
- AColor:TColor=clTeeColor):Integer; virtual;
- Function AddArray(Const Values:Array of TChartValue):Integer; overload;
- Function AddNull(Const Value:Double):Integer; overload;
- Function AddNull(Const ALabel:String=''):Integer; overload; virtual;
- Function AddNullXY(Const X,Y:Double; Const ALabel:String=''):Integer; virtual;
- Function AddX(Const AXValue:Double; Const ALabel:String='';
- AColor:TColor=clTeeColor):Integer;
- Function AddXY(Const AXValue,AYValue:Double; Const ALabel:String='';
- AColor:TColor=clTeeColor):Integer; virtual;
- Function AddY(Const AYValue:Double; Const ALabel:String='';
- AColor:TColor=clTeeColor):Integer;
- procedure Assign(Source:TPersistent); override;
- procedure AssignFormat(Source:TChartSeries);
- Function AssociatedToAxis(Axis:TChartAxis):Boolean; virtual;
- Procedure BeginUpdate;
- Procedure CheckOrder; dynamic;
- Procedure Clear; virtual;
- Function Count:Integer; {$IFOPT C-}{$IFDEF D9}inline;{$ENDIF}{$ENDIF}
- Function CountLegendItems:Integer; virtual;
- Procedure Delete(ValueIndex:Integer); overload; virtual;
- Procedure Delete(Start,Quantity:Integer; RemoveGap:Boolean=False); overload; virtual;
- Procedure EndUpdate;
- Procedure FillSampleValues(NumValues:Integer=0); dynamic;
- Function FirstDisplayedIndex:Integer;
- Function IsNull(ValueIndex:Integer):Boolean;
- Function IsValidSourceOf(Value:TChartSeries):Boolean; dynamic;
- Function IsValidSeriesSource(Value:TChartSeries):Boolean; dynamic;
- Function LegendToValueIndex(LegendIndex:Integer):Integer; virtual;
- Function LegendItemColor(LegendIndex:Integer):TColor; virtual;
- Function LegendString(LegendIndex:Integer; LegendTextStyle:TLegendTextStyle):String; virtual;
- property LinkedSeries:TCustomSeriesList read FLinkedSeries;
- Function MaxXValue:Double; virtual;
- Function MaxYValue:Double; virtual;
- Function MaxZValue:Double; virtual;
- Function MinXValue:Double; virtual;
- Function MinYValue:Double; virtual;
- Function MinZValue:Double; virtual;
- Function NumSampleValues:Integer; dynamic;
- Function RandomBounds(NumValues:Integer):TSeriesRandomBounds;
- Procedure RemoveDataSource(Value:TComponent);
- Procedure SetNull(ValueIndex:Integer; Null:Boolean=True); // 6.0
- Procedure SortByLabels(Order:TChartListOrder=loAscending); // 6.0
- Function VisibleCount:Integer; { <-- Number of VISIBLE points (Last-First+1) }
- property ValuesList:TChartValueLists read FValuesList;
- property XValue[Index:Integer]:Double read GetxValue write SetXValue;
- property YValue[Index:Integer]:Double read GetyValue write SetYValue;
- property ZOrder:Integer read GetZOrder write SetZOrder default TeeAutoZOrder;
- Function MaxMarkWidth:Integer;
- Function CalcXPos(ValueIndex:Integer):Integer; virtual;
- Function CalcXPosValue(Const Value:Double):Integer; {$IFDEF D9}inline;{$ENDIF}
- Function CalcXSizeValue(Const Value:Double):Integer; {$IFDEF D9}inline;{$ENDIF}
- Function CalcYPos(ValueIndex:Integer):Integer; virtual;
- Function CalcYPosValue(Const Value:Double):Integer; {$IFDEF D9}inline;{$ENDIF}
- Function CalcYSizeValue(Const Value:Double):Integer; {$IFDEF D9}inline;{$ENDIF}
- Function CalcPosValue(Const Value:Double):Integer;
- Function XScreenToValue(ScreenPos:Integer):Double; {$IFDEF D9}inline;{$ENDIF}
- Function YScreenToValue(ScreenPos:Integer):Double; {$IFDEF D9}inline;{$ENDIF}
- Function XValueToText(Const AValue:Double):String;
- Function YValueToText(Const AValue:Double):String;
- Procedure ColorRange( AValueList:TChartValueList;
- Const FromValue,ToValue:Double;
- AColor:TColor);
- Procedure CheckDataSource;
- { Public Properties }
- property Labels:TLabelsList read FLabels;
- property XLabel[Index:Integer]:String read GetXLabel write SetXLabel; // deprecated (obsolete)
- property ValueMarkText[Index:Integer]:String read GetMarkText write SetMarkText;
- property ValueColor[Index:Integer]:TColor read GetValueColor write SetValueColor;
- property XValues:TChartValueList read FX write SetXValues;
- property YValues:TChartValueList read FY write SetYValues;
- Function GetYValueList(AListName:String):TChartValueList; virtual;
- property GetVertAxis:TChartAxis read FGetVertAxis;
- property GetHorizAxis:TChartAxis read FGetHorizAxis;
- Function MarkPercent(ValueIndex:Integer; AddTotal:Boolean=False):String;
- Function Clicked(x,y:Integer):Integer; overload; virtual;
- Function Clicked(P:TPoint):Integer; overload;
- Procedure RefreshSeries;
- property FirstValueIndex:Integer read FFirstVisibleIndex;
- property LastValueIndex:Integer read FLastVisibleIndex;
- Function GetOriginValue(ValueIndex:Integer):Double; virtual;
- Function GetMarkValue(ValueIndex:Integer):Double; virtual;
- Procedure AssignValues(Source:TChartSeries);
- Function DrawValuesForward:Boolean; virtual;
- Function DrawSeriesForward(ValueIndex:Integer):Boolean; virtual;
- procedure SwapValueIndex(a,b:Integer); dynamic;
- property RecalcOptions: TSeriesRecalcOptions read FRecalcOptions
- write FRecalcOptions
- default [ rOnDelete,
- rOnModify,
- rOnInsert,
- rOnClear];
- Function GetCursorValueIndex:Integer;
- Procedure GetCursorValues(Var XValue,YValue:Double);
- Procedure DrawLegend(ValueIndex:Integer; Const Rect:TRect); virtual;
- Function UseAxis:Boolean; virtual;
- procedure SetFunction(AFunction:TTeeFunction); virtual;
- property SeriesColor:TColor read GetSeriesColor write SetSeriesColor stored IsColorStored; // deprecated
- { other }
- property DataSources:TDataSourcesList read FDataSources;
- property FunctionType:TTeeFunction read FTeeFunction write SetFunction;
- Procedure CheckOtherSeries(Source:TChartSeries);
- Procedure ReplaceList(OldList,NewList:TChartValueList);
- property CustomHorizAxis:TChartAxis read FCustomHorizAxis write SetCustomHorizAxis;
- property CustomVertAxis:TChartAxis read FCustomVertAxis write SetCustomVertAxis;
- { to be published }
- property Active;
- property Color:TColor read GetSeriesColor write SetSeriesColor stored IsColorStored; // replaces SeriesColor
- property ColorEachPoint:Boolean read FColorEachPoint write SetColorEachPoint default False;
- property ColorSource:String read FColorSource write SetColorSource;
- property Cursor:TCursor read FCursor write FCursor default crDefault;
- property Depth:Integer read FDepth write SetDepth default TeeAutoDepth;
- property HorizAxis:THorizAxis read FHorizAxis write SetHorizAxis default aBottomAxis;
- property Marks:TSeriesMarks read FMarks write SetMarks;
- property ParentChart;
- { datasource below parentchart }
- property DataSource:TComponent read GetDataSource write SetDataSource;
- property PercentFormat:String read FPercentFormat write SetPercentFormat stored IsPercentFormatStored;
- property ShowInLegend;
- property Title;
- property ValueFormat:String read FValueFormat write SetValueFormat stored IsValueFormatStored;
- property VertAxis:TVertAxis read FVertAxis write SetVertAxis default aLeftAxis;
- property XLabelsSource:String read FLabelsSource write SetLabelsSource;
- { events }
- property AfterDrawValues:TNotifyEvent read FAfterDrawValues
- write FAfterDrawValues;
- property BeforeDrawValues:TNotifyEvent read FBeforeDrawValues
- write FBeforeDrawValues;
- property OnAfterAdd:TSeriesOnAfterAdd read FOnAfterAdd write FOnAfterAdd;
- property OnBeforeAdd:TSeriesOnBeforeAdd read FOnBeforeAdd write FOnBeforeAdd;
- property OnClearValues:TSeriesOnClear read FOnClearValues
- write FOnClearValues;
- property OnClick:TSeriesClick read FOnClick write FOnClick;
- property OnDblClick:TSeriesClick read FOnDblClick write FOnDblClick;
- property OnGetMarkText:TSeriesOnGetMarkText read FOnGetMarkText
- write FOnGetMarkText;
- property OnMouseEnter:TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
- property OnMouseLeave:TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
- end;
- ChartException=class(Exception);
- TTeeSeriesSource=class(TComponent)
- private
- FActive : Boolean;
- FSeries : TChartSeries;
- procedure SetSeries(const Value: TChartSeries);
- protected
- Procedure Loaded; override;
- procedure Notification( AComponent: TComponent;
- Operation: TOperation); override;
- procedure SetActive(const Value: Boolean); virtual;
- public
- Constructor Create(AOwner: TComponent); override;
- Destructor Destroy; override;
- class Function Available(AChart:TCustomAxisPanel):Boolean; virtual;
- class Function Description:String; virtual; { bcos BCB, do not make abstract }
- class Function Editor:TComponentClass; virtual; { bcos BCB, do not make abstract }
- class Function HasNew:Boolean; virtual;
- class Function HasSeries(ASeries:TChartSeries):Boolean; virtual;
- Procedure Close; virtual;
- Procedure Load; virtual; // abstract;
- Procedure Open; virtual;
- Procedure Refresh;
- property Active:Boolean read FActive write SetActive default False;
- property Series:TChartSeries read FSeries write SetSeries;
- end;
- TTeeSeriesSourceClass=class of TTeeSeriesSource;
- Var TeeAxisClickGap : Integer=3; { minimum pixels distance to trigger axis click }
- TeeDefaultCapacity : Integer=1000; { default TList.Capacity to speed-up Lists }
- Function TeeSources: TList; { List of registered Series Source components }
- Function SeriesTitleOrName(ASeries:TCustomChartSeries):String;
- Procedure FillSeriesItems(AItems:TStrings; AList:TCustomSeriesList; UseTitles:Boolean=True);
- Procedure ShowMessageUser(Const S:String);
- { Returns if a Series has "X" values }
- Function HasNoMandatoryValues(ASeries:TChartSeries):Boolean;
- { Returns True if ASeries has text labels }
- Function HasLabels(ASeries:TChartSeries):Boolean;
- { Returns True if ASeries has colors }
- Function HasColors(ASeries:TChartSeries):Boolean;
- { Returns set indicating Series contents (colors, labels, etc) }
- Function SeriesGuessContents(ASeries:TChartSeries):TeeFormatFlag;
- // Draws the associated series bitmap icon at the specified LeftTop location
- procedure TeeDrawBitmapEditor(Canvas: TCanvas; Element:TCustomChartElement; Left,Top:Integer);
- implementation
- Uses {$IFDEF CLX}
- QPrinters,
- {$ELSE}
- Printers,
- {$ENDIF}
- {$IFDEF D6}
- {$IFNDEF CLX}
- Types,
- {$ENDIF}
- {$ENDIF}
- {$IFDEF TEEARRAY}
- {$IFOPT R+}
- {$IFDEF D6}
- RtlConsts,
- {$ELSE}
- Consts,
- {$ENDIF}
- {$ENDIF}
- {$ENDIF}
- {$IFNDEF D5}
- TypInfo,
- {$ENDIF}
- Math,
- TeeHtml, TeeConst;
- { Returns a "good" value, bigger than "OldStep", as 2..5..10..etc }
- Function TeeNextStep(Const OldStep:Double):Double;
- Begin
- if OldStep >= 10 then result := 10*TeeNextStep(0.1*OldStep)
- else
- if OldStep < 1 then result := 0.1*TeeNextStep(OldStep*10)
- else
- if OldStep < 2 then result:=2 else
- if OldStep < 5 then result:=5 else result:=10
- end;
- { Determine what a Series point is made of }
- Function SeriesGuessContents(ASeries:TChartSeries):TeeFormatFlag;
- begin
- if HasNoMandatoryValues(ASeries) then result:=[tfNoMandatory]
- else result:=[];
- if HasColors(ASeries) then result:=result+[tfColor];
- if HasLabels(ASeries) then result:=result+[tfLabel];
- if ASeries.Marks.Positions.ExistCustom then result:=result+[tfMarkPosition];
- end;
- { TChartAxisTitle }
- Procedure TChartAxisTitle.Assign(Source:TPersistent);
- Begin
- if Source is TChartAxisTitle then
- With TChartAxisTitle(Source) do
- Begin
- Self.FAngle :=FAngle;
- Self.FCaption:=FCaption;
- end;
- inherited;
- end;
- Function TChartAxisTitle.IsAngleStored:Boolean;
- begin
- result:=FAngle<>IDefaultAngle;
- end;
- type TTeePanelAccess=class {$IFDEF CLR}sealed{$ENDIF} (TCustomTeePanel);
- Procedure TChartAxisTitle.SetAngle(const Value:Integer);
- Begin
- TTeePanelAccess(ParentChart).SetIntegerProperty(FAngle,Value mod 360); { 5.01 }
- end;
- Procedure TChartAxisTitle.SetCaption(Const Value:String);
- Begin
- TTeePanelAccess(ParentChart).SetStringProperty(FCaption,Value);
- end;
- { TChartAxisPen }
- Constructor TChartAxisPen.Create(OnChangeEvent:TNotifyEvent);
- Begin
- inherited;
- Width:=2;
- end;
- {$IFNDEF CLR}
- type
- TOwnedCollectionAccess=class(TOwnedCollection);
- {$ENDIF}
- { TChartAxis }
- Constructor TChartAxis.Create(Collection:TCollection);
- {$IFDEF CLR}
- var tmp : TCustomAxisPanel;
- {$ENDIF}
- Begin
- {$IFDEF CLR}
- tmp:=TCustomAxisPanel(Collection.Owner);
- if tmp.Axes.Count>=6 then inherited Create(Collection)
- else inherited Create(nil);
- FParentChart:=tmp;
- {$ELSE}
- FParentChart:=TCustomAxisPanel(TOwnedCollectionAccess(Collection).GetOwner);
- if FParentChart.Axes.Count>=TeeInitialCustomAxis then
- inherited Create(Collection)
- else
- inherited Create(nil);
- {$ENDIF}
- SetCalcPosValue;
- ISeriesList:=TCustomSeriesList.Create;
- FItems:=TAxisItems.Create(Self);
- FLogarithmicBase:=10;
- FAutomatic:=True;
- FAutomaticMaximum:=True;
- FAutomaticMinimum:=True;
- FLabelsSeparation:=10; { % }
- FAxisValuesFormat:=TeeMsg_DefValueFormat;
- FLabelsAlign:=alDefault;
- FLabelStyle:=talAuto;
- FLabelsOnAxis:=True;
- FTickOnLabelsOnly:=True;
- FAxisTitle:=TChartAxisTitle.Create(ParentChart);
- FAxisTitle.IDefaultAngle:=0;
- FTicks:=TDarkGrayPen.Create(ParentChart.CanvasChanged);
- FTickLength:=4;
- FMinorTicks:=TDarkGrayPen.Create(ParentChart.CanvasChanged);
- FMinorTickLength :=2;
- FMinorTickCount :=3;
- FTicksInner:=TDarkGrayPen.Create(ParentChart.CanvasChanged);
- FGrid:=TAxisGridPen.Create(ParentChart.CanvasChanged);
- FMinorGrid:=TChartHiddenPen.Create(ParentChart.CanvasChanged);
- FAxis:=TChartAxisPen.Create(ParentChart.CanvasChanged);
- FVisible :=True;
- FRoundFirstLabel :=True;
- FExactDateTime :=True;
- FEndPosition :=100;
- FParentChart.FAxes.Add(Self);
- end;
- Destructor TChartAxis.Destroy;
- Procedure ResetSeriesAxes;
- var t : Integer;
- begin
- With FParentChart do
- for t:=0 to SeriesCount-1 do
- With TChartSeries(Series[t]) do
- begin
- if CustomHorizAxis=Self then
- begin
- CustomHorizAxis:=nil;
- HorizAxis:=aBottomAxis;
- end;
- if CustomVertAxis=Self then
- begin
- CustomVertAxis:=nil;
- VertAxis:=aLeftAxis;
- end;
- end;
- end;
- begin
- FMinorTicks.Free;
- FTicks.Free;
- FTicksInner.Free;
- FGrid.Free;
- FMinorGrid.Free;
- FAxis.Free;
- FAxisTitle.Free;
- FItems.Free;
- ResetSeriesAxes;
- ISeriesList.Free;
- FParentChart.FAxes.Remove(Self);
- Tick:=nil;
- inherited;
- end;
- Procedure TChartAxis.IncDecDateTime( Increment:Boolean;
- Var Value:Double;
- Const AnIncrement:Double;
- tmpWhichDateTime:TDateTimeStep);
- begin
- TeeDateTimeIncrement( FExactDateTime and IAxisDateTime and
- (tmpWhichDateTime>=dtHalfMonth),
- Increment,
- Value,
- AnIncrement,
- tmpWhichDateTime );
- end;
- { An axis is "DateTime" if at least one Active Series with
- datetime values is associated to it }
- Function TChartAxis.IsDateTime:Boolean;
- Var tmpSeries : Integer;
- tmpList : TChartValueList;
- Begin
- With ParentChart do
- for tmpSeries:=0 to SeriesCount-1 do
- With Series[tmpSeries] do
- if Active then
- begin
- tmpList:=ValueListOfAxis(Self);
- if Assigned(tmpList) then
- begin
- result:=tmpList.DateTime;
- exit;
- end;
- end;
- result:=False;
- end;
- Procedure TChartAxis.SetTicks(Value:TDarkGrayPen);
- Begin
- FTicks.Assign(Value);
- end;
- Procedure TChartAxis.SetMinorTicks(Value:TDarkGrayPen);
- Begin
- FMinorTicks.Assign(Value);
- end;
- Procedure TChartAxis.SetTicksInner(Value:TDarkGrayPen);
- Begin
- FTicksInner.Assign(Value);
- end;
- Procedure TChartAxis.SetGrid(Value:TAxisGridPen);
- Begin
- FGrid.Assign(Value);
- end;
- Procedure TChartAxis.SetMinorGrid(Value:TChartHiddenPen);
- Begin
- FMinorGrid.Assign(Value);
- end;
- Procedure TChartAxis.SetGridCentered(Value:Boolean);
- Begin
- Grid.Centered:=Value;
- end;
- Procedure TChartAxis.SetAxis(Value:TChartAxisPen);
- Begin
- FAxis.Assign(Value);
- end;
- Function TChartAxis.IsPosStored:Boolean;
- begin
- result:=FPositionPercent<>0;
- end;
- Function TChartAxis.IsStartStored:Boolean;
- begin
- result:=FStartPosition<>0;
- end;
- Function TChartAxis.IsEndStored:Boolean;
- begin
- result:=FEndPosition<>100;
- end;
- Function TChartAxis.IsCustom:Boolean;
- begin
- result:=ParentChart.Axes.IndexOf(Self)>=TeeInitialCustomAxis;
- end;
- procedure TChartAxis.SetHorizontal(const Value: Boolean);
- begin
- ParentChart.SetBooleanProperty(FHorizontal,Value);
- SetCalcPosValue;
- end;
- procedure TChartAxis.SetOtherSide(const Value: Boolean);
- begin
- ParentChart.SetBooleanProperty(FOtherSide,Value);
- end;
- Function TChartAxis.CalcPosPoint(Value:Integer):Double;
- Function InternalCalcPos(Const A,B:Double):Double;
- begin
- if (Horizontal and FInverted) or
- ((not Horizontal) and (not FInverted)) then result:=A
- else result:=B
- end;
- var tmp : Double;
- Begin
- if FLogarithmic then
- Begin
- if Value=IStartPos then result:=InternalCalcPos(IMaximum,IMinimum)
- else
- if Value=IEndPos then result:=InternalCalcPos(IMinimum,IMaximum)
- else
- begin
- tmp:=IRangeLog;
- if (tmp=0) or (IAxisSize=0) then result:=IMinimum // 5.03
- else
- begin
- if FInverted then tmp:=((IEndPos-Value)*tmp/IAxisSize)
- else tmp:=((Value-IStartPos)*tmp/IAxisSize);
- if Horizontal then result:=Exp(ILogMin+tmp)
- else result:=Exp(ILogMax-tmp);
- end;
- end;
- end
- else
- if IAxisSize>0 then
- begin
- if FInverted then tmp:=IEndPos-Value
- else tmp:=Value-IStartPos;
- tmp:=tmp*IRange/IAxisSize;
- if Horizontal then result:=IMinimum+tmp
- else result:=IMaximum-tmp;
- end
- else result:=0;
- end;
- Procedure TChartAxis.SetDateTimeFormat(Const Value:String);
- Begin
- ParentChart.SetStringProperty(FDateTimeFormat,Value);
- end;
- procedure TChartAxis.SetAxisTitle(Value:TChartAxisTitle);
- begin
- FAxisTitle.Assign(Value);
- end;
- procedure TChartAxis.SetStartPosition(Const Value:Double);
- begin
- ParentChart.SetDoubleProperty(FStartPosition,Value);
- end;
- procedure TChartAxis.SetEndPosition(Const Value:Double);
- begin
- ParentChart.SetDoubleProperty(FEndPosition,Value);
- end;
- procedure TChartAxis.SetPositionPercent(Const Value:Double);
- begin
- ParentChart.SetDoubleProperty(FPositionPercent,Value);
- end;
- procedure TChartAxis.SetRoundFirstLabel(Value:Boolean);
- begin
- ParentChart.SetBooleanProperty(FRoundFirstLabel,Value);
- end;
- Procedure TChartAxis.SetLabelsMultiLine(Value:Boolean);
- begin
- ParentChart.SetBooleanProperty(FLabelsMultiLine,Value);
- end;
- Procedure TChartAxis.SetLabelsExponent(Value:Boolean);
- begin
- ParentChart.SetBooleanProperty(FLabelsExponent,Value);
- end;
- procedure TChartAxis.SetZPosition(const Value: Double);
- begin
- ParentChart.SetDoubleProperty(FZPosition,Value);
- if FZPosition=0 then FZPosition:=0.01; // VCL bug double=0 streaming
- end;
- procedure TChartAxis.SetTickOnLabelsOnly(Value:Boolean);
- begin
- ParentChart.SetBooleanProperty(FTickOnLabelsOnly,Value);
- end;
- function TChartAxis.CalcDateTimeIncrement(MaxNumLabels:Integer):Double;
- var TempNumLabels : Integer;
- begin
- result:=Math.Max(FDesiredIncrement,DateTimeStep[Low(DateTimeStep)]);
- if (result>0) and (MaxNumLabels>0) then
- begin
- if (IRange/Result)>1000000 then Result:=IRange/1000000;
- Repeat
- TempNumLabels:=Round(IRange/result);
- if TempNumLabels>MaxNumLabels then
- if result<DateTimeStep[dtOneYear] then
- begin
- if result<DateTimeStep[dtOneSecond] then
- result:=TeeNextStep(result) // less than one second
- else
- result:=NextDateTimeStep(result) // regular datetime steps
- end
- else
- result:=2.0*result; // years
- Until (TempNumLabels<=MaxNumLabels){ or (result=DateTimeStep[dtOneYear])};
- end;
- result:=Math.Max(result,DateTimeStep[Low(DateTimeStep)]);
- end;
- {$IFNDEF D6}
- function IsInfinite(const AValue: Double): Boolean;
- begin
- Result := ((PInt64(@AValue)^ and $7FF0000000000000) = $7FF0000000000000) and
- ((PInt64(@AValue)^ and $000FFFFFFFFFFFFF) = $0000000000000000);
- end;
- {$ENDIF}
- Function TChartAxis.RoundLogPower(const Value:Double):Double;
- begin
- result:=Power(LogarithmicBase,Round(LogN(LogarithmicBase,Value))); // 7.0
- end;
- Function TChartAxis.CalcLabelsIncrement(MaxNumLabels:Integer):Double;
- procedure InternalCalcLabelsIncrement;
- Function AnySeriesHasLessThan(Num:Integer):Boolean;
- var t : Integer;
- begin
- result:=False;
- for t:=0 to ParentChart.SeriesCount-1 do
- with ParentChart[t] do
- if Active then
- if (YMandatory and Self.Horizontal) or
- ((not YMandatory) and (not Self.Horizontal)) then
- if AssociatedToAxis(Self) then
- begin
- result:=Count<=Num;
- if result then break;
- end;
- end;
- var TempNumLabels : Integer;
- tmp : Double;
- tmpInf : Boolean;
- begin
- TempNumLabels:=MaxNumLabels+1;
- if FDesiredIncrement<=0 then
- begin
- if IRange=0 then result:=1
- else
- begin
- result:=Abs(IRange)/Succ(MaxNumLabels);
- if Logarithmic then
- result:=RoundLogPower(result); // 7.0
- if (IRange>=1) and AnySeriesHasLessThan(MaxNumLabels) then // MS : 7.04
- result:=Math.Max(1,result);
- end;
- end
- else result:=FDesiredIncrement;
- tmpInf:=False;
- if LabelsSeparation>0 then
- Repeat
- tmp:=IRange/result;
- if Abs(tmp)<MaxLongint then
- begin
- TempNumLabels:=Round(tmp);
- if TempNumLabels>MaxNumLabels then
- if Logarithmic then
- result:=result*LogarithmicBase
- else
- result:=TeeNextStep(result);
- end
- else
- if Logarithmic then
- result:=result*LogarithmicBase
- else
- result:=TeeNextStep(result);
- tmpInf:=IsInfinite(result);
- Until (TempNumLabels<=MaxNumLabels) or (result>IRange) or tmpInf;
- if tmpInf then result:=IRange
- else result:=Math.Max(result,MinAxisIncrement);
- end;
- Begin
- if MaxNumLabels>0 then
- Begin
- if IAxisDateTime then result:=CalcDateTimeIncrement(MaxNumLabels)
- else InternalCalcLabelsIncrement;
- end
- else
- if IAxisDateTime then result:=DateTimeStep[Low(DateTimeStep)]
- else result:=MinAxisIncrement;
- end;
- Function TChartAxis.LabelWidth(Const Value:Double):Integer;
- begin
- result:=InternalLabelSize(Value,True);
- end;
- Function TChartAxis.LabelHeight(Const Value:Double):Integer;
- begin
- result:=InternalLabelSize(Value,False);
- end;
- Function TChartAxis.InternalLabelSize(Const Value:Double; IsWidth:Boolean):Integer;
- var tmp : Integer;
- tmpMulti : Boolean;
- Begin
- result:=ParentChart.MultiLineTextWidth(LabelValue(Value),tmp);
- if IsWidth then
- tmpMulti:=(FLabelsAngle=90) or (FLabelsAngle=270)
- else
- tmpMulti:=(FLabelsAngle=0) or (FLabelsAngle=180);
- if tmpMulti then result:=ParentChart.Canvas.FontHeight*tmp;
- end;
- Function TChartAxis.IsMaxStored:Boolean;
- Begin { dont store max property if automatic }
- result:=(not FAutomatic) and (not FAutomaticMaximum);
- end;
- Function TChartAxis.IsMinStored:Boolean;
- Begin{ dont store min property if automatic }
- result:=(not FAutomatic) and (not FAutomaticMinimum);
- end;
- Function TChartAxis.CalcXYIncrement(MaxLabelSize:Integer):Double;
- var tmp : Integer;
- begin
- if MaxLabelSize>0 then
- begin
- if FLabelsSeparation>0 then
- Inc(MaxLabelSize,Round(0.01*FLabelsSeparation*MaxLabelSize));
- tmp:=Round((1.0*IAxisSize)/MaxLabelSize)
- end
- else tmp:=1;
- result:=CalcLabelsIncrement(tmp)
- end;
- Function TChartAxis.CalcIncrement:Double;
- begin
- result:=CalcXYIncrement(Math.Max(InternalLabelSize(IMinimum,Horizontal),
- InternalLabelSize(IMaximum,Horizontal)));
- if LabelsAlternate then
- if Logarithmic then
- result:=result/LogarithmicBase
- else
- result:=result*0.5;
- end;
- Procedure TChartAxis.AdjustMaxMinRect(Const Rect:TRect);
- Var tmpMin : Double;
- tmpMax : Double;
- Procedure RecalcAdjustedMinMax(Pos1,Pos2:Integer);
- Var OldStart : Integer;
- OldEnd : Integer;
- Begin
- OldStart :=IStartPos;
- OldEnd :=IEndPos;
- Inc(IStartPos,Pos1);
- Dec(IEndPos,Pos2);
- IAxisSize:=IEndPos-IStartPos;
- tmpMin:=CalcPosPoint(OldStart);
- tmpMax:=CalcPosPoint(OldEnd);
- end;
- Begin
- With ParentChart do
- begin
- with Rect do
- if Horizontal then ReCalcAdjustedMinMax(Left,Right)
- else ReCalcAdjustedMinMax(Top,Bottom);
- InternalCalcPositions;
- IMaximum:=tmpMax;
- IMinimum:=tmpMin;
- end;
- if IMinimum>IMaximum then SwapDouble(IMinimum,IMaximum);
- InternalCalcRange;
- end;
- Procedure TChartAxis.CalcMinMax(Var AMin,AMax:Double);
- Begin
- if FAutomatic or FAutomaticMaximum then
- AMax:=ParentChart.InternalMinMax(Self,False,Horizontal);
- if FAutomatic or FAutomaticMinimum then
- AMin:=ParentChart.InternalMinMax(Self,True,Horizontal);
- end;
- Procedure TChartAxis.InternalCalcRange;
- begin
- IRange:=IMaximum-IMinimum;
- IRangeZero:=IRange=0;
- if IRangeZero then IAxisSizeRange:=0
- else IAxisSizeRange:=IAxisSize/IRange;
- if FLogarithmic then
- begin
- if IMinimum<=0 then ILogMin:=0 else ILogMin:=ln(IMinimum);
- if IMaximum<=0 then ILogMax:=0 else ILogMax:=ln(IMaximum);
- IRangeLog:=ILogMax-ILogMin;
- if IRangeLog=0 then IAxisLogSizeRange:=0
- else IAxisLogSizeRange:=IAxisSize/IRangeLog;
- end;
- IZPos:=CalcZPos;
- end;
- Procedure TChartAxis.AdjustMaxMin;
- Begin
- CalcMinMax(FMinimumValue,FMaximumValue);
- IMaximum:=FMaximumValue;
- IMinimum:=FMinimumValue;
- InternalCalcRange;
- end;
- procedure TChartAxis.Assign(Source: TPersistent);
- Begin
- if Source is TChartAxis then
- With TChartAxis(Source) do
- Begin
- Self.FAxis.Assign(FAxis);
- Self.FItems.CopyFrom(FItems);
- Self.FLabelsAlign :=FLabelsAlign;
- Self.FLabelsAlternate :=FLabelsAlternate;
- Self.FLabelsAngle :=FLabelsAngle;
- Self.FLabelsExponent :=FLabelsExponent;
- Self.FLabelsMultiLine :=FLabelsMultiLine;
- Self.FLabelsSeparation :=FLabelsSeparation;
- Self.FLabelsSize :=FLabelsSize;
- Self.FLabelStyle :=FLabelStyle;
- Self.FLabelsOnAxis :=FLabelsOnAxis;
- Self.Ticks :=FTicks;
- Self.TicksInner :=FTicksInner;
- Self.FTitleSize :=FTitleSize;
- Self.Grid :=FGrid;
- Self.MinorTicks :=FMinorTicks;
- Self.MinorGrid :=FMinorGrid;
- Self.FTickLength :=FTickLength;
- Self.FMinorTickLength :=FMinorTickLength;
- Self.FMinorTickCount :=FMinorTickCount;
- Self.FTickInnerLength :=FTickInnerLength;
- Self.FAxisValuesFormat :=FAxisValuesFormat;
- Self.FDesiredIncrement :=FDesiredIncrement;
- Self.FMaximumValue :=FMaximumValue;
- Self.FMaximumOffset :=FMaximumOffset;
- Self.FMinimumValue :=FMinimumValue;
- Self.FMinimumOffset :=FMinimumOffset;
- Self.FAutomatic :=FAutomatic;
- Self.FAutomaticMaximum :=FAutomaticMaximum;
- Self.FAutomaticMinimum :=FAutomaticMinimum;
- Self.Title :=FAxisTitle;
- Self.FDateTimeFormat :=FDateTimeFormat;
- Self.GridCentered :=GridCentered;
- Self.FLogarithmic :=FLogarithmic;
- Self.FLogarithmicBase :=FLogarithmicBase;
- Self.FInverted :=FInverted;
- Self.FExactDateTime :=FExactDateTime;
- Self.FRoundFirstLabel :=FRoundFirstLabel;
- Self.FTickOnLabelsOnly :=FTickOnLabelsOnly;
- Self.IDepthAxis :=IDepthAxis;
- Self.FStartPosition :=FStartPosition;
- Self.FEndPosition :=FEndPosition;
- Self.FPositionPercent :=FPositionPercent;
- Self.FPosUnits :=FPosUnits;
- Self.FVisible :=FVisible;
- Self.FHorizontal :=FHorizontal;
- Self.FOtherSide :=FOtherSide;
- end
- else inherited;
- end;
- Function TChartAxis.LabelValue(Const Value:Double):String;
- var tmp : String;
- Begin
- if IAxisDateTime then
- begin
- if Value>=0 then
- Begin
- if FDateTimeFormat='' then tmp:=DateTimeDefaultFormat(IRange)
- else tmp:=FDateTimeFormat;
- DateTimeToString(result,tmp,Value);
- end
- else result:='';
- end
- else result:=FormatFloat(FAxisValuesFormat,Value);
- if Assigned(ParentChart.FOnGetAxisLabel) then
- ParentChart.FOnGetAxisLabel(TChartAxis(Self),nil,-1,Result);
- if FLabelsMultiLine then
- result:=ReplaceChar(result,' ',TeeLineSeparator);
- end;
- Function TChartAxis.InternalCalcLabelStyle:TAxisLabelStyle;
- var t : Integer;
- begin
- result:=talNone;
- for t:=0 to ParentChart.SeriesCount-1 do
- With ParentChart.Series[t] do
- if Active and AssociatedToAxis(Self) then
- begin
- result:=talValue;
- if not HasZValues then // 7.0 (ie: MapSeries should not use text)
- if (Horizontal and YMandatory) or
- ((not Horizontal) and (not YMandatory)) then
- if (FLabels.Count>0) and (FLabels.First<>nil) then
- begin
- result:=talText;
- break;
- end;
- end;
- end;
- Function TChartAxis.CalcLabelStyle:TAxisLabelStyle;
- Begin
- if FLabelStyle=talAuto then result:=InternalCalcLabelStyle
- else result:=FLabelStyle;
- End;
- Function TChartAxis.MaxLabelsWidth:Integer;
- Function MaxLabelsValueWidth:Integer;
- var tmp : Double;
- tmpA : Double;
- tmpB : Double;
- OldGetAxisLabel : TAxisOnGetLabel;
- tmpNum : Integer;
- begin
- if (IsDateTime and FExactDateTime) or RoundFirstLabel then
- begin
- tmp:=CalcIncrement;
- tmpA:=tmp*Int(IMinimum/tmp);
- tmpB:=tmp*Int(IMaximum/tmp);
- end
- else
- begin
- tmpA:=IMinimum;
- tmpB:=IMaximum;
- end;
- With ParentChart do
- begin
- OldGetAxisLabel:=FOnGetAxisLabel;
- FOnGetAxisLabel:=nil;
- With Canvas do
- result:=TextWidth(' ')+
- Math.Max(MultiLineTextWidth(LabelValue(tmpA),tmpNum),
- MultiLineTextWidth(LabelValue(tmpB),tmpNum));
- FOnGetAxisLabel:=OldGetAxisLabel;
- end;
- end;
- var t : Integer;
- tmp : Integer;
- begin
- if Items.Count=0 then
- Case CalcLabelStyle of
- talValue : result:=MaxLabelsValueWidth;
- talMark : result:=ParentChart.MaxMarkWidth;
- talText : result:=ParentChart.MaxTextWidth;
- else
- {talNone : } result:=0;
- end
- else
- begin
- result:=0;
- for t:=0 to Items.Count-1 do
- begin
- ParentChart.Canvas.AssignFont(Items[t].Font);
- result:=Max(result,ParentChart.MultiLineTextWidth(Items[t].Text,tmp));
- end;
- end;
- end;
- Function TChartAxis.GetLabels:Boolean;
- begin
- result:=FItems.Format.Visible;
- end;
- Function TChartAxis.GetLabelsFont:TTeeFont;
- begin
- result:=FItems.Format.Font;
- end;
- Procedure TChartAxis.SetLabels(Value:Boolean);
- Begin
- FItems.Format.Visible:=Value;
- end;
- Procedure TChartAxis.SetLabelsFont(Value:TTeeFont);
- begin
- FItems.Format.Font:=Value;
- end;
- Function TChartAxis.DepthAxisAlign:Integer;
- begin
- if OtherSide then result:=TA_LEFT
- else result:=TA_RIGHT;
- end;
- Function TChartAxis.DepthAxisPos:Integer;
- begin
- if OtherSide then
- result:=ParentChart.ChartRect.Bottom-CalcZPos // 7.04
- else
- result:=ParentChart.ChartRect.Top+CalcZPos // 7.04 TV52010193
- end;
- Procedure TChartAxis.SetAutomatic(Value:Boolean);
- Begin
- ParentChart.SetBooleanProperty(FAutomatic,Value);
- if not (csLoading in ParentChart.ComponentState) then
- begin
- FAutomaticMinimum:=Value;
- FAutomaticMaximum:=Value;
- end;
- end;
- Procedure TChartAxis.SetAutoMinMax(Var Variable:Boolean; Var2,Value:Boolean);
- Begin
- ParentChart.SetBooleanProperty(Variable,Value);
- if Value then
- begin { if both are automatic, then Automatic should be True too }
- if Var2 then FAutomatic:=True;
- end
- else FAutomatic:=False;
- end;
- Procedure TChartAxis.SetAutomaticMinimum(Value:Boolean);
- Begin
- SetAutoMinMax(FAutomaticMinimum,FAutomaticMaximum,Value);
- end;
- Procedure TChartAxis.SetAutomaticMaximum(Value:Boolean);
- Begin
- SetAutoMinMax(FAutomaticMaximum,FAutomaticMinimum,Value);
- end;
- Function TChartAxis.IsAxisValuesFormatStored:Boolean;
- begin
- result:=FAxisValuesFormat<>TeeMsg_DefValueFormat;
- end;
- Procedure TChartAxis.SetValuesFormat(Const Value:String);
- Begin
- ParentChart.SetStringProperty(FAxisValuesFormat,Value);
- end;
- Procedure TChartAxis.SetInverted(Value:Boolean);
- Begin
- ParentChart.SetBooleanProperty(FInverted,Value);
- end;
- Procedure TChartAxis.InternalSetInverted(Value:Boolean);
- Begin
- FInverted:=Value;
- end;
- Procedure TChartAxis.SetLogarithmicBase(const Value:Double);
- begin
- if (Value=1) or (Value<=0) then
- raise AxisException.Create(TeeMsg_AxisLogBase);
- ParentChart.SetDoubleProperty(FLogarithmicBase,Value);
- end;
- Procedure TChartAxis.SetLogarithmic(Value:Boolean);
- Begin
- if Value and IsDateTime then
- Raise AxisException.Create(TeeMsg_AxisLogDateTime);
- if Value then
- begin
- AdjustMaxMin;
- if ((IMinimum<0) or (IMaximum<0)) then
- Raise AxisException.Create(TeeMsg_AxisLogNotPositive);
- end;
- ParentChart.SetBooleanProperty(FLogarithmic,Value);
- SetCalcPosValue;
- end;
- Procedure TChartAxis.SetCalcPosValue;
- begin
- if IDepthAxis then
- begin
- CalcXPosValue:=InternalCalcDepthPosValue;
- CalcYPosValue:=InternalCalcDepthPosValue;
- end
- else
- if Logarithmic then
- begin
- CalcXPosValue:=LogXPosValue;
- CalcYPosValue:=LogYPosValue;
- end
- else
- begin
- if ParentChart.Axes.IFastCalc then
- begin
- CalcXPosValue:=XPosValue;
- CalcYPosValue:=YPosValue;
- end
- else
- begin
- CalcXPosValue:=XPosValueCheck;
- CalcYPosValue:=YPosValueCheck;
- end;
- end;
- if Horizontal then CalcPosValue:=CalcXPosValue
- else CalcPosValue:=CalcYPosValue;
- end;
- Procedure TChartAxis.SetLabelsAlign(Value:TAxisLabelAlign);
- Begin
- if FLabelsAlign<>Value then
- begin
- FLabelsAlign:=Value;
- ParentChart.Invalidate;
- end;
- end;
- Procedure TChartAxis.SetLabelsAlternate(Value:Boolean);
- Begin
- ParentChart.SetBooleanProperty(FLabelsAlternate,Value);
- end;
- Procedure TChartAxis.SetLabelsAngle(const Value:Integer);
- Begin
- ParentChart.SetIntegerProperty(FLabelsAngle,Value mod 360);
- end;
- Procedure TChartAxis.SetLabelsSeparation(Value:Integer);
- Begin
- if Value<0 then Raise AxisException.Create(TeeMsg_AxisLabelSep);
- ParentChart.SetIntegerProperty(FLabelsSeparation,Value);
- end;
- Procedure TChartAxis.SetLabelsSize(Value:Integer);
- Begin
- ParentChart.SetIntegerProperty(FLabelsSize,Value);
- end;
- Procedure TChartAxis.SetTitleSize(Value:Integer);
- Begin
- ParentChart.SetIntegerProperty(FTitleSize,Value);
- end;
- Procedure TChartAxis.SetLabelsOnAxis(Value:Boolean);
- Begin
- ParentChart.SetBooleanProperty(FLabelsOnAxis,Value);
- end;
- Procedure TChartAxis.SetExactDateTime(Value:Boolean);
- begin
- ParentChart.SetBooleanProperty(FExactDateTime,Value);
- end;
- Procedure TChartAxis.SetLabelStyle(Value:TAxisLabelStyle);
- begin
- if FLabelStyle<>Value then
- begin
- FLabelStyle:=Value;
- ParentChart.Invalidate;
- end;
- end;
- Procedure TChartAxis.SetVisible(Value:Boolean);
- Begin
- ParentChart.SetBooleanProperty(FVisible,Value);
- end;
- Procedure TChartAxis.SetDesiredIncrement(Const Value:Double);
- Begin
- {$IFNDEF CLR}
- if Value<0 then Raise AxisException.Create(TeeMsg_AxisIncrementNeg);
- {$ENDIF}
- if IsDateTime then DateTimeToStr(Value);
- ParentChart.SetDoubleProperty(FDesiredIncrement,Value);
- end;
- Procedure TChartAxis.SetMinimum(Const Value:Double);
- Begin
- if (not (csReading in ParentChart.ComponentState)) and
- (Value>FMaximumValue) then
- Raise AxisException.Create(TeeMsg_AxisMinMax);
- InternalSetMinimum(Value);
- end;
- Procedure TChartAxis.InternalSetMinimum(Const Value:Double);
- Begin
- ParentChart.SetDoubleProperty(FMinimumValue,Value);
- end;
- Procedure TChartAxis.SetMaximum(Const Value:Double);
- Begin
- if (not (csReading in ParentChart.ComponentState)) and
- (Value<FMinimumValue) then
- Raise AxisException.Create(TeeMsg_AxisMaxMin);
- InternalSetMaximum(Value);
- end;
- Procedure TChartAxis.SetMinMax(AMin,AMax:Double);
- Begin
- FAutomatic:=False;
- FAutomaticMinimum:=False;
- FAutomaticMaximum:=False;
- if AMin>AMax then SwapDouble(AMin,AMax);
- InternalSetMinimum(AMin);
- InternalSetMaximum(AMax);
- if (FMaximumValue-FMinimumValue)<MinAxisRange then
- InternalSetMaximum(FMinimumValue+MinAxisRange);
- ParentChart.CustomAxes.ResetScales(Self);
- end;
- Procedure TChartAxis.InternalSetMaximum(Const Value:Double);
- Begin
- ParentChart.SetDoubleProperty(FMaximumValue,Value);
- end;
- Procedure TChartAxis.SetTickLength(Value:Integer);
- Begin
- ParentChart.SetIntegerProperty(FTickLength,Value);
- end;
- Procedure TChartAxis.SetMinorTickLength(Value:Integer);
- Begin
- ParentChart.SetIntegerProperty(FMinorTickLength,Value);
- end;
- Procedure TChartAxis.SetMinorTickCount(Value:Integer);
- Begin
- ParentChart.SetIntegerProperty(FMinorTickCount,Value);
- End;
- Procedure TChartAxis.SetTickInnerLength(Value:Integer);
- Begin
- ParentChart.SetIntegerProperty(FTickInnerLength,Value);
- end;
- Procedure TChartAxis.DrawTitle(x,y:Integer);
- var Old : Boolean;
- begin
- With ParentChart,Canvas do
- begin
- AssignFont(FAxisTitle.Font);
- BackMode:=cbmTransparent;
- if IsDepthAxis then
- begin
- TextAlign:=DepthAxisAlign;
- TextOut3D(x,y,Width3D div 2,FAxisTitle.FCaption);
- end
- else
- begin
- Old:=FLabelsExponent;
- FLabelsExponent:=False; // 5.02
- DrawAxisLabel(x,y,FAxisTitle.FAngle,FAxisTitle.FCaption);
- FLabelsExponent:=Old;
- end;
- end;
- end;
- // pending: cache into variable (for speed)
- Function TChartAxis.CalcZPos:Integer;
- begin
- if IDepthAxis then result:=ParentChart.ChartHeight
- else result:=ParentChart.Width3D;
- result:=Round(result*ZPosition*0.01); // 6.0
- end;
- procedure TChartAxis.DrawAxisLabel(x,y,Angle:Integer; Const St:String; Format:TTeeCustomShape=nil);
- Const Aligns:Array[Boolean,Boolean] of Integer=(
- (TA_RIGHT +TA_TOP, TA_LEFT +TA_TOP ), { vertical }
- (TA_CENTER+TA_TOP, TA_CENTER+TA_BOTTOM ) ); { horizontal }
- Var tmpSt2 : String;
- tmpZ : Integer;
- Procedure DrawExponentLabel;
- var tmpW : Integer;
- tmpH : Integer;
- i : Integer;
- tmp : String;
- tmpSub : String;
- Old : Integer;
- begin
- i:=Pos('E',Uppercase(tmpSt2));
- With ParentChart.Canvas do
- if i=0 then TextOut3D(x,y,tmpZ,tmpSt2)
- else
- begin
- tmp:=Copy(tmpSt2,1,i-1);
- tmpSub:=Copy(tmpSt2,i+1,Length(tmpSt2)-1);
- tmpH:=FontHeight-1;
- Old:=Font.Size;
- if TextAlign=TA_LEFT then
- begin
- TextOut3D(x,y,tmpZ,tmp);
- tmpW:=TextWidth(tmp)+1;
- Font.Size:=Font.Size-(Font.Size div 4);
- TextOut3D(x+tmpW,y-(tmpH div 2)+2,tmpZ,tmpSub);
- end
- else
- begin
- Font.Size:=Font.Size-(Font.Size div 4);
- TextOut3D(x,y-(tmpH div 2)+2,tmpZ,tmpSub);
- tmpW:=TextWidth(tmpSub)+1;
- Font.Size:=Old;
- TextOut3D(x-tmpW,y,tmpZ,tmp);
- end;
- Font.Size:=Old;
- end;
- end;
- { Returns 1 + how many times "TeeLineSeparator #13" is found
- inside string St parameter }
- Function TeeNumTextLines(St:String):Integer;
- var i : Integer;
- begin
- result:=0;
- i:={$IFDEF CLR}Pos{$ELSE}AnsiPos{$ENDIF}(TeeLineSeparator,St);
- while i>0 do
- begin
- Inc(result);
- Delete(St,1,i);
- i:={$IFDEF CLR}Pos{$ELSE}AnsiPos{$ENDIF}(TeeLineSeparator,St);
- end;
- if St<>'' then Inc(result);
- end;
- var Delta : Integer;
- t : Integer;
- n : Integer;
- i : Integer;
- tmp : Double;
- tmpSt : String;
- tmpH : Integer;
- tmpD : Integer;
- tmpAlign : TCanvasTextAlign;
- tmpAlign2: TCanvasTextAlign;
- tmpW : Integer;
- tmpNum : Integer;
- tmpSize : Integer;
- tmpDraw : Boolean;
- begin
- tmpH:=ParentChart.Canvas.FontHeight div 2;
- Case Angle of
- 0,360: begin
- if Horizontal or (FLabelsAlign=alDefault) then
- tmpAlign:=Aligns[Horizontal,OtherSide]
- else
- if OtherSide then
- begin
- tmpAlign:=TA_RIGHT;
- Inc(X,SizeLabels);
- end
- else
- begin
- tmpAlign:=TA_LEFT;
- Dec(X,SizeLabels);
- end;
- if not Horizontal then Dec(Y,tmpH);
- end;
- 90: begin
- if Horizontal then
- begin
- tmpAlign:=Aligns[False,OtherSide];
- Dec(X,tmpH);
- end
- else tmpAlign:=Aligns[True,not OtherSide];
- end;
- 180: begin
- tmpAlign:=Aligns[Horizontal,not OtherSide];
- if not Horizontal then Inc(Y,tmpH);
- end;
- 270: begin
- if Horizontal then
- begin
- tmpAlign:=Aligns[False,not OtherSide];
- Inc(X,tmpH);
- end
- else tmpAlign:=Aligns[True,OtherSide];
- end;
- 45: begin // 5.03
- tmpAlign:=TA_LEFT;
- if Horizontal then
- begin
- if OtherSide then
- begin
- i:=Round(ParentChart.Canvas.TextWidth('Wj'));
- Dec(x,i);
- Dec(y,i);
- end
- else
- begin
- tmp:=Sin(Angle*TeePiStep);
- i:=Round(ParentChart.Canvas.TextWidth(St)*tmp);
- Dec(x,i);
- Inc(y,i);
- end;
- end;
- end;
- else
- begin
- tmpAlign:=TA_LEFT; { non-supported angles }
- end;
- end;
- tmpZ:=IZPos; // 6.0
- n:=TeeNumTextLines(St);
- Delta:=ParentChart.Canvas.FontHeight;
- if (Angle=180) or (Angle=270) then Delta:=-Delta;
- tmpD:=Round(Delta*n);
- if Horizontal then
- begin
- if Angle=0 then
- if OtherSide then y:=y-tmpD else y:=y-Delta
- else
- if Angle=180 then
- if OtherSide then y:=y-Delta else y:=y-tmpD
- else
- if (Angle=90) or (Angle=270) then
- x:=x-Round(0.5*Delta*(n+1));
- end
- else
- if (Angle=0) or (Angle=180) then
- y:=y-Round(0.5*Delta*(n+1))
- else
- if OtherSide then
- begin
- if Angle=90 then x:=x-Delta
- else if Angle=270 then x:=x-tmpD
- end
- else
- if Angle=90 then x:=x-tmpD
- else if Angle=270 then x:=x-Delta;
- // 6.0
- if not Assigned(Format) then Format:=FItems.Format;
- with Format do
- if not Transparent then
- begin
- with ShapeBounds do
- begin
- tmpSize:=Self.ParentChart.Canvas.TextWidth('W') shr 1;
- Left:=x;
- Top:=y+Delta;
- tmpW:=Self.ParentChart.MultiLineTextWidth(St,tmpNum);
- tmpH:=ParentChart.Canvas.FontHeight*tmpNum;
- tmpAlign2:=tmpAlign;
- if tmpAlign2>=TA_BOTTOM then
- begin
- Dec(Top,tmpH);
- Dec(tmpAlign2,TA_BOTTOM);
- end;
- Bottom:=Top+tmpH;
- Right:=Left+tmpW;
- if tmpAlign2=TA_RIGHT then
- begin
- Right:=Left;
- Left:=Right-tmpW;
- end
- else
- if tmpAlign2=TA_CENTER then
- begin
- tmpW:=(Right-Left) div 2;
- Dec(Right,tmpW);
- Dec(Left,tmpW);
- end;
- Dec(Left,tmpSize);
- Inc(Right,tmpSize);
- end;
- if tmpZ<>0 then ShapeBounds:=ParentChart.Canvas.CalcRect3D(ShapeBounds,tmpZ);
- DrawRectRotated(ShapeBounds,FLabelsAngle,tmpZ);
- with ParentChart.Canvas do
- begin
- // trick
- Brush.Style:=bsSolid;
- Brush.Style:=bsClear;
- {$IFDEF CLX}
- BackMode:=cbmTransparent;
- {$ENDIF}
- end;
- end;
- ParentChart.Canvas.TextAlign:=tmpAlign;
- tmpSt:=St;
- tmpDraw:=True;
- if Assigned(FOnDrawLabel) then // 7.0
- begin
- FOnDrawLabel(Self,X,Y,tmpZ,tmpSt,tmpDraw);
- if tmpDraw then
- n:=TeeNumTextLines(tmpSt);
- end;
- if tmpDraw then // 7.0
- for t:=1 to n do
- begin
- i:={$IFDEF CLR}Pos{$ELSE}AnsiPos{$ENDIF}(TeeLineSeparator,tmpSt);
- if i>0 then tmpSt2:=Copy(tmpSt,1,i-1) else tmpSt2:=tmpSt;
- if Angle=0 then
- begin
- y:=y+Delta;
- if FLabelsExponent then DrawExponentLabel
- else ParentChart.Canvas.TextOut3D(X,Y,tmpZ,tmpSt2);
- end
- else
- begin
- if Angle=180 then y:=y+Delta
- else
- if (Angle=90) or (Angle=270) then x:=x+Delta;
- ParentChart.Canvas.RotateLabel3D(X,Y,tmpZ,tmpSt2,Angle);
- end;
- Delete(tmpSt,1,i);
- end;
- ParentChart.Canvas.TextAlign:=TA_LEFT;
- end;
- Procedure TChartAxis.Scroll(Const Offset:Double; CheckLimits:Boolean=False);
- Begin
- if (not CheckLimits) or
- ( ((Offset>0) and (FMaximumValue<ParentChart.InternalMinMax(Self,False,Horizontal))) or
- ((Offset<0) and (FMinimumValue>ParentChart.InternalMinMax(Self,True,Horizontal)))
- ) then
- begin
- FAutomatic:=False;
- FAutomaticMaximum:=False;
- FMaximumValue:=FMaximumValue+Offset;
- FAutomaticMinimum:=False;
- FMinimumValue:=FMinimumValue+Offset;
- ParentChart.Invalidate;
- end;
- end;
- Function TChartAxis.InternalCalcDepthPosValue(Const Value:TChartValue):Integer;
- begin
- if IRangeZero then result:=ICenterPos
- else
- if FInverted then result:=Round(IAxisSizeRange*(IMaximum-Value))
- else result:=Round(IAxisSizeRange*(Value-IMinimum));
- end;
- Function TChartAxis.LogXPosValue(Const Value:TChartValue):Integer;
- begin
- if IRangeLog=0 then result:=ICenterPos
- else
- begin
- if Value<=0 then
- if FInverted then result:=IEndPos
- else result:=IStartPos
- else
- begin
- if FInverted then result:=Round((ILogMax-ln(Value))*IAxisLogSizeRange)
- else result:=Round((ln(Value)-ILogMin)*IAxisLogSizeRange);
- result:=IStartPos+result;
- end;
- end;
- end;
- Function TChartAxis.LogYPosValue(Const Value:TChartValue):Integer;
- begin
- if IRangeLog=0 then result:=ICenterPos
- else
- begin
- if Value<=0 then
- if not FInverted then result:=IEndPos
- else result:=IStartPos
- else
- begin
- if FInverted then result:=Round((ILogMax-ln(Value))*IAxisLogSizeRange)
- else result:=Round((ln(Value)-ILogMin)*IAxisLogSizeRange);
- result:=IEndPos-result;
- end;
- end;
- end;
- // The following routines perform axis calculations WITH overflow checking
- // to avoid Windows GDI limits on pixel coordinates.
- // See below for faster routines.
- //
- // To switch between slow and fast, use Chart1.Axes.FastCalc property.
- var TeeMaxPixelPos:Integer=0;
- Function TChartAxis.XPosValueCheck(Const Value:TChartValue):Integer;
- var tmp : Double;
- begin
- if IRangeZero then result:=ICenterPos
- else
- begin
- tmp:=(Value-IMinimum)*IAxisSizeRange;
- if FInverted then tmp:=IEndPos-tmp
- else tmp:=IStartPos+tmp;
- if tmp> TeeMaxPixelPos then result:=TeeMaxPixelPos
- else
- if tmp<-TeeMaxPixelPos then result:=-TeeMaxPixelPos
- else
- result:=Round(tmp);
- end;
- end;
- Function TChartAxis.YPosValueCheck(Const Value:TChartValue):Integer;
- var tmp : Double;
- begin
- if IRangeZero then result:=ICenterPos
- else
- begin
- tmp:=(Value-IMinimum)*IAxisSizeRange;
- if FInverted then tmp:=IStartPos+tmp
- else tmp:=IEndPos-tmp;
- if tmp> TeeMaxPixelPos then result:= TeeMaxPixelPos
- else
- if tmp<-TeeMaxPixelPos then result:=-TeeMaxPixelPos
- else
- result:=Round(tmp);
- end;
- end;
- // The following routines perform axis calculations WITHOUT overflow checking.
- // These are 5 to 10% faster than the above ones.
- // See above for slower (with checking) routines.
- //
- // To switch between slow and fast, use Chart1.Axes.FastCalc property.
- Function TChartAxis.XPosValue(Const Value:TChartValue):Integer;
- begin
- if IRangeZero then result:=ICenterPos
- else
- begin
- {$IFNDEF TEENOASM}
- asm
- fld Value
- fsub qword ptr [eax+IMinimum]
- {$IFDEF TEEVALUESINGLE}
- fmul dword ptr [eax+IAxisSizeRange]
- sub esp, 4
- fistp dword ptr [esp]
- pop [result]
- {$ELSE}
- fmul qword ptr [eax+IAxisSizeRange]
- sub esp, 8
- fistp qword ptr [esp]
- pop [result]
- pop ecx
- {$ENDIF}
- end;
- if Inverted then result:=IEndPos -result
- else Inc(result,IStartPos);
- {$ELSE}
- if FInverted then
- result:=IEndPos -Round( (Value-IMinimum)*IAxisSizeRange )
- else
- result:=IStartPos+Round( (Value-IMinimum)*IAxisSizeRange );
- {$ENDIF}
- end;
- end;
- Function TChartAxis.YPosValue(Const Value:TChartValue):Integer;
- begin
- if IRangeZero then result:=ICenterPos
- else
- begin
- {$IFNDEF TEENOASM}
- asm
- fld Value
- fsub qword ptr [eax+IMinimum]
- {$IFDEF TEEVALUESINGLE}
- fmul dword ptr [eax+IAxisSizeRange]
- sub esp, 4
- fistp dword ptr [esp]
- pop [result]
- {$ELSE}
- fmul qword ptr [eax+IAxisSizeRange]
- sub esp, 8
- fistp qword ptr [esp]
- pop [result]
- pop ecx
- {$ENDIF}
- end;
- if Inverted then Inc(result,IStartPos)
- else result:=IEndPos -result;
- {$ELSE}
- if FInverted then
- result:=IStartPos+Round( (Value-IMinimum)*IAxisSizeRange )
- else
- result:=IEndPos -Round( (Value-IMinimum)*IAxisSizeRange )
- {$ENDIF}
- end;
- end;
- Function TChartAxis.CalcSizeValue(Const Value:Double):Integer;
- begin
- result:=0;
- if Value>0 then
- if FLogarithmic then
- Begin
- if IRangeLog<>0 then result:=Round(ln(Value)*IAxisLogSizeRange);
- end
- else
- if IRange<>0 then result:=Round(Value*IAxisSizeRange);
- end;
- Function TChartAxis.AxisRect:TRect;
- Var tmpPos1 : Integer;
- Pos1 : Integer;
- tmpPos2 : Integer;
- Pos2 : Integer;
- begin
- if IStartPos>IEndPos then
- begin
- tmpPos1:=IEndPos;
- tmpPos2:=IStartPos;
- end
- else
- begin
- tmpPos1:=IStartPos;
- tmpPos2:=IEndPos;
- end;
- if PosAxis>FPosLabels then
- begin
- Pos1:=FPosLabels;
- Pos2:=PosAxis+TeeAxisClickGap;
- end
- else
- begin
- Pos1:=PosAxis-TeeAxisClickGap;
- Pos2:=FPosLabels;
- end;
- if Horizontal then result:=TeeRect(tmpPos1,Pos1,tmpPos2,Pos2)
- else result:=TeeRect(Pos1,tmpPos1,Pos2,tmpPos2);
- end;
- Function TChartAxis.Clicked(x,y:Integer):Boolean;
- var tmpR : TRect;
- tmpZ : Integer;
- Begin
- result:=ParentChart.IsAxisVisible(Self);
- if result then
- begin
- if ParentChart.View3D then
- begin
- if OtherSide then tmpZ:=ParentChart.Width3D else tmpZ:=0;
- tmpR:=ParentChart.Canvas.CalcRect3D(AxisRect,tmpZ);
- end
- else tmpR:=AxisRect;
- result:=PointInRect(tmpR,x,y);
- // pending: DepthAxis and click hit detection with 3D rotation.
- end;
- end;
- Procedure TChartAxis.CustomDrawMinMaxStartEnd( APosLabels,
- APosTitle,
- APosAxis:Integer;
- GridVisible:Boolean;
- Const AMinimum,AMaximum,
- AIncrement:Double;
- AStartPos,AEndPos:Integer);
- Procedure SetInternals;
- begin
- IMaximum :=FMaximumValue;
- IMinimum :=FMinimumValue;
- InternalCalcRange;
- end;
- var OldMin : Double;
- OldMax : Double;
- OldIncrement : Double;
- OldAutomatic : Boolean;
- begin
- OldMin :=FMinimumValue;
- OldMax :=FMaximumValue;
- OldIncrement:=FDesiredIncrement;
- OldAutomatic:=FAutomatic;
- try
- FAutomatic :=False;
- FMinimumValue :=AMinimum;
- FMaximumValue :=AMaximum;
- FDesiredIncrement:=AIncrement;
- SetInternals;
- CustomDrawStartEnd(APosLabels,APosTitle,APosAxis,GridVisible,AStartPos,AEndPos);
- finally
- FMinimumValue :=OldMin;
- FMaximumValue :=OldMax;
- FDesiredIncrement:=OldIncrement;
- FAutomatic :=OldAutomatic;
- SetInternals;
- end;
- end;
- Procedure TChartAxis.CustomDrawMinMax( APosLabels,
- APosTitle,
- APosAxis:Integer;
- GridVisible:Boolean;
- Const AMinimum,AMaximum,
- AIncrement:Double);
- begin
- CustomDrawMinMaxStartEnd(APosLabels,APosTitle,APosAxis,GridVisible,
- AMinimum,AMaximum,AIncrement,IStartPos,IEndPos);
- end;
- Procedure TChartAxis.CustomDraw( APosLabels,APosTitle,APosAxis:Integer;
- GridVisible:Boolean);
- begin
- InternalCalcPositions;
- CustomDrawStartEnd(APosLabels,APosTitle,APosAxis,GridVisible,IStartPos,IEndPos);
- End;
- Procedure TChartAxis.CustomDrawStartEnd( APosLabels,APosTitle,APosAxis:Integer;
- GridVisible:Boolean; AStartPos,AEndPos:Integer);
- var OldGridVisible : Boolean;
- OldChange : TNotifyEvent;
- Begin
- FPosLabels:=APosLabels;
- FPosTitle :=APosTitle;
- FPosAxis :=APosAxis;
- IStartPos :=AStartPos;
- IEndPos :=AEndPos;
- RecalcSizeCenter;
- OldGridVisible:=FGrid.Visible;
- OldChange:=FGrid.OnChange;
- FGrid.OnChange:=nil;
- FGrid.Visible:=GridVisible;
- Draw(False);
- FGrid.Visible:=OldGridVisible;
- FGrid.OnChange:=OldChange;
- end;
- Procedure TChartAxis.RecalcSizeCenter;
- begin
- IAxisSize:=IEndPos-IStartPos;
- ICenterPos:=(IStartPos+IEndPos) div 2;
- InternalCalcRange;
- end;
- Procedure TChartAxis.InternalCalcPositions;
- Procedure DoCalculation(AStartPos:Integer; ASize:Integer);
- begin
- IStartPos:=AStartPos+Round(0.01*ASize*FStartPosition);
- IEndPos:=AStartPos+Round(0.01*ASize*FEndPosition);
- end;
- begin
- With ParentChart do
- if IsDepthAxis then DoCalculation(0,Width3D) else
- if Horizontal then DoCalculation(ChartRect.Left,ChartWidth)
- else DoCalculation(ChartRect.Top,ChartHeight);
- RecalcSizeCenter;
- end;
- Function TChartAxis.ApplyPosition(APos:Integer; Const R:TRect):Integer;
- Var tmpSize : Integer;
- begin
- result:=APos;
- if FPositionPercent<>0 then
- With R do
- begin
- if FPosUnits=muPercent then
- begin
- if Horizontal then tmpSize:=Bottom-Top else tmpSize:=Right-Left;
- tmpSize:=Round(0.01*FPositionPercent*tmpSize);
- end
- else tmpSize:=Round(FPositionPercent); // pixels
- if OtherSide then tmpSize:=-tmpSize;
- if Horizontal then tmpSize:=-tmpSize;
- result:=APos+tmpSize;
- end;
- end;
- Function TChartAxis.GetRectangleEdge(Const R:TRect):Integer;
- begin
- With R do
- if OtherSide then
- if Horizontal then result:=Top else result:=Right
- else
- if Horizontal then result:=Bottom else result:=Left;
- end;
- Procedure TChartAxis.DrawGridLine(tmp:Integer);
- var tmpZ : Integer;
- begin
- if (tmp>IStartPos) and (tmp<IEndPos) then
- With ParentChart,Canvas,ChartRect do
- begin
- if IsDepthAxis then
- begin
- VertLine3D(Left,Top,Bottom,tmp);
- HorizLine3D(Left,Right,Bottom,tmp);
- end
- else
- begin
- if View3D then
- begin
- if AxisBehind then
- begin
- if not IHideBackGrid then { 6.0 }
- if Horizontal then VertLine3D(tmp,Top,Bottom,Width3D)
- else HorizLine3D(Left,Right,tmp,Width3D);
- if not IHideSideGrid then
- begin
- tmpZ:=Round(Width3D*Grid.ZPosition*0.01); // 6.0
- if (tmpZ<>Width3D) then
- if Horizontal then ZLine3D(tmp,PosAxis,tmpZ,Width3D)
- else ZLine3D(PosAxis,tmp,tmpZ,Width3D);
- end;
- end
- else
- if Horizontal then VertLine3D(tmp,Top,Bottom,0) // in-front grid
- else HorizLine3D(Left,Right,tmp,0); // in-front grid
- end
- else
- if Horizontal then DoVertLine(tmp,Top+1,Bottom) { 5.02 (+1) }
- else DoHorizLine(Left+1,Right,tmp); { 5.02 (+1) }
- end;
- end;
- end;
- Procedure TChartAxis.DrawGrids(NumTicks:Integer);
- var t : Integer;
- begin
- if Assigned(OnDrawGrids) then
- OnDrawGrids(Self);
- if FGrid.Visible then
- begin
- with ParentChart.Canvas do
- begin
- BackMode:=cbmTransparent;
- if FGrid.Color=clTeeColor then
- AssignVisiblePenColor(FGrid,clGray)
- else
- AssignVisiblePen(FGrid);
- end;
- if Grid.Centered then
- for t:=1 to NumTicks-1 do
- DrawGridLine(Round(0.5*(Tick[t]+Tick[t-1])))
- else
- for t:=0 to NumTicks-1 do
- DrawGridLine(Tick[t]);
- end;
- end;
- type
- TTeeMinorTickProc=Procedure(AMinorTickPos:Integer);
- Procedure TChartAxis.Draw(CalcPosAxis:Boolean);
- Var tmpValue : Double;
- tmpNumTicks : Integer;
- Procedure DrawTicksGrid;
- Var tmpWallSize : Integer;
- Procedure InternalDrawTick(tmp,Delta,tmpTickLength:Integer);
- Begin
- with ParentChart,Canvas do
- Begin
- if IsDepthAxis then
- if OtherSide then
- HorizLine3D(PosAxis+Delta,PosAxis+Delta+tmpTickLength,DepthAxisPos,tmp)
- else
- HorizLine3D(PosAxis-Delta,PosAxis-Delta-tmpTickLength,DepthAxisPos,tmp)
- else
- if OtherSide then
- Begin
- if Horizontal then
- VertLine3D(tmp,PosAxis-Delta,PosAxis-Delta-tmpTickLength,IZPos)
- else
- begin
- Inc(Delta,tmpWallSize);
- HorizLine3D(PosAxis+Delta,PosAxis+Delta+tmpTickLength,tmp,IZPos)
- end;
- end
- else
- begin
- Inc(Delta,tmpWallSize);
- if Horizontal then
- if View3D then
- VertLine3D(tmp,PosAxis+Delta,PosAxis+Delta+tmpTickLength,IZPos)
- else
- DoVertLine(tmp,PosAxis+Delta,PosAxis+Delta+tmpTickLength)
- else
- if View3D then
- HorizLine3D(PosAxis-Delta,PosAxis-Delta-tmpTickLength,tmp,IZPos)
- else
- DoHorizLine(PosAxis-Delta,PosAxis-Delta-tmpTickLength,tmp);
- end;
- end;
- end;
- Procedure DrawAxisLine;
- var tmp : Integer;
- begin
- With ParentChart,Canvas do
- if IsDepthAxis then
- begin
- if OtherSide then
- tmp:=ChartRect.Bottom+CalcWallSize(BottomAxis)-IZPos
- else
- tmp:=ChartRect.Top-IZPos;
- MoveTo3D(PosAxis,tmp,IStartPos);
- LineTo3D(PosAxis,tmp,IEndPos);
- end
- else
- begin
- if Horizontal then
- if OtherSide then
- // Top axis
- HorizLine3D(IStartPos,IEndPos,PosAxis,IZPos)
- else
- // Bottom axis
- HorizLine3D(IStartPos-CalcWallSize(LeftAxis),
- IEndPos+CalcWallSize(RightAxis),
- PosAxis+tmpWallSize,IZPos)
- else
- begin
- if OtherSide then tmp:=tmpWallSize
- else tmp:=-tmpWallSize;
- VertLine3D(PosAxis+tmp,IStartPos,IEndPos+CalcWallSize(BottomAxis),IZPos);
- end;
- end;
- end;
- Procedure ProcessMinorTicks(IsGrid:Boolean);
- Procedure AProc(APos:Integer);
- begin
- if (APos>IStartPos) and (APos<IEndPos) then
- if IsGrid then DrawGridLine(APos)
- else InternalDrawTick(APos,1,FMinorTickLength);
- end;
- var tmpInvCount : Double;
- tmpTicks : TChartValues;
- procedure DrawLogMinorTicks(tmpValue:Double);
- var tmpDelta : Double;
- tt : Integer;
- tmpLength : Integer;
- begin
- tmpLength:=Length(tmpTicks);
- for tt:=0 to tmpLength-1 do
- if tmpTicks[tt]=tmpValue then exit;
- SetLength(tmpTicks,tmpLength+1);
- tmpTicks[tmpLength]:=tmpValue;
- tmpDelta:=((tmpValue*FLogarithmicBase)-tmpValue)*tmpInvCount;
- for tt:=1 to FMinorTickCount do
- begin
- tmpValue:=tmpValue+tmpDelta;
- if (tmpValue<=IMaximum) and (tmpValue>=IMinimum) then
- AProc(CalcPosValue(tmpValue));
- end;
- end;
- var t : Integer;
- tt : Integer;
- tmpDelta : Double;
- tmpValue : Double;
- begin
- tmpInvCount:=1.0/Succ(FMinorTickCount);
- if tmpNumTicks>1 then
- if not FLogarithmic then
- begin
- tmpDelta:=1.0*(Tick[1]-Tick[0])*tmpInvCount;
- for t:=1 to FMinorTickCount do
- begin
- AProc(Tick[0]-Round(t*tmpDelta));
- AProc(Tick[tmpNumTicks-1]+Round(t*tmpDelta));
- end;
- end;
- if FLogarithmic then
- begin
- tmpTicks:=nil;
- try
- if tmpNumTicks>0 then // 7.0 fix first tick
- begin
- tmpValue:=CalcPosPoint(Tick[tmpNumTicks-1])/LogarithmicBase;
- DrawLogMinorTicks(tmpValue);
- for t:=1 to tmpNumTicks do
- begin
- tmpValue:=CalcPosPoint(Tick[t-1]);
- DrawLogMinorTicks(tmpValue);
- end;
- DrawLogMinorTicks(tmpValue*LogarithmicBase);
- end;
- finally
- tmpTicks:=nil;
- end;
- end
- else
- for t:=1 to tmpNumTicks-1 do
- begin
- tmpDelta:=1.0*(Tick[t]-Tick[t-1])*tmpInvCount;
- for tt:=1 to FMinorTickCount do AProc(Tick[t]-Round(tt*tmpDelta));
- end;
- end;
- Procedure ProcessTicks(APen:TChartPen; AOffset,ALength:Integer);
- var t : Integer;
- begin
- if APen.Visible then
- begin
- ParentChart.Canvas.AssignVisiblePen(APen);
- for t:=0 to tmpNumTicks-1 do
- InternalDrawTick(Tick[t],AOffset,ALength);
- end;
- end;
- Procedure ProcessMinor(APen:TChartPen; IsGrid:Boolean);
- begin
- if (tmpNumTicks>0) and APen.Visible then
- begin
- With ParentChart.Canvas do
- begin
- BackMode:=cbmTransparent; { 5.01 }
- Brush.Style:=bsClear;
- AssignVisiblePen(APen);
- end;
- ProcessMinorTicks(IsGrid);
- end;
- end;
- begin
- With ParentChart.Canvas do
- begin
- Brush.Style:=bsClear;
- BackMode:=cbmTransparent;
- end;
- tmpWallSize:=ParentChart.CalcWallSize(Self);
- if FAxis.Visible then
- begin
- ParentChart.Canvas.AssignVisiblePen(FAxis);
- DrawAxisLine;
- end;
- ProcessTicks(FTicks,1,FTickLength);
- DrawGrids(tmpNumTicks);
- ProcessTicks(FTicksInner,-1,-FTickInnerLength);
- ProcessMinor(FMinorTicks,False);
- ProcessMinor(FMinorGrid,True);
- ParentChart.Canvas.BackMode:=cbmOpaque;
- end;
- Procedure AddTick(Const APos:Integer);
- begin
- SetLength(Tick,Length(Tick)+1);
- Tick[tmpNumTicks]:=APos;
- Inc(tmpNumTicks);
- end;
- var tmpAlternate : Boolean;
- Procedure DrawThisLabel(LabelPos:Integer; Const tmpSt:String; Format:TTeeCustomShape=nil);
- var tmpZ : Integer;
- tmpPos : Integer;
- begin
- if TickOnLabelsOnly then
- AddTick(LabelPos);
- With ParentChart,Canvas do
- begin
- if Assigned(Format) then AssignFont(Format.Font)
- else AssignFont(Items.Format.Font);
- // trick
- Brush.Style:=bsSolid;
- Brush.Style:=bsClear;
- {$IFDEF CLX}
- BackMode:=cbmTransparent;
- {$ENDIF}
- if IsDepthAxis then
- begin
- TextAlign:=DepthAxisAlign;
- if (View3DOptions.Rotation=360) or View3DOptions.Orthogonal then
- tmpZ:=LabelPos+(FontHeight div 2)
- else
- tmpZ:=LabelPos;
- if OtherSide then tmpPos:=PosLabels
- else tmpPos:=PosLabels-2-(TextWidth('W') div 2);
- TextOut3D(tmpPos,DepthAxisPos,tmpZ,tmpSt);
- end
- else
- begin
- if LabelsAlternate then
- begin
- if tmpAlternate then
- tmpPos:=PosLabels