?? teengine.pas
字號(hào):
{********************************************}
{ TeeChart Pro Charting Library }
{ For Borland Delphi, C++ Builder & Kylix }
{ Copyright (c) 1995-2004 by David Berneda }
{ All Rights Reserved }
{********************************************}
unit TeEngine;
{$I TeeDefs.inc}
interface
uses {$IFNDEF LINUX}
Windows,
{$ENDIF}
SysUtils, Classes, Messages,
{$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);
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;
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 {$IFDEF CLR}sealed{$ENDIF} (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;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -