⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 series.pas

📁 第三方控件:PaintGrid.pas 网格型仪表控件源文件 Mymeter.pas 圆型仪表控件源文件 Project1是这两个控件的使用范例。 该
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    property ClickableLine;
    property Dark3D;
    property DrawArea;
    property InvertedStairs;
    property LinePen;
    property MultiArea:TMultiArea read GetMultiArea write SetMultiArea default maNone;
    property Pointer;
    property Stairs;
    property Transparency; { 5.02 }
    property UseYOrigin:Boolean read FUseOrigin write SetUseOrigin default False;
    property XValues;
    property YOrigin:Double read FOrigin write SetOrigin;
    property YValues;
   { events }
    property OnClickPointer;
  end;

  THorizAreaSeries=class(TAreaSeries)
  protected
    Procedure DrawMark( ValueIndex:Integer; Const St:String;
                        APosition:TSeriesMarkPosition); override;
  public
    Constructor Create(AOwner: TComponent); override;
    Function NumSampleValues:Integer; override;
  end;

  TMultiBar=(mbNone,mbSide,mbStacked,mbStacked100,mbSideAll,mbSelfStack);

  TCustomBarSeries=class;

  TBarStyle=( bsRectangle, bsPyramid, bsInvPyramid,
              bsCilinder, bsEllipse, bsArrow, bsRectGradient, bsCone, bsBevel,
              bsSlantCube, bsDiamond, bsInvArrow, bsInvCone);  // 7.04

  TGetBarStyleEvent=Procedure( Sender:TCustomBarSeries; ValueIndex:Integer;
                               Var TheBarStyle:TBarStyle) of object;

  TBarSeriesGradient=class(TCustomTeeGradient)
  private
    FRelative: Boolean;
    procedure SetRelative(const Value: Boolean);
  published
    property Balance;
    property Direction nodefault;
    property MidColor;
    property Relative:Boolean read FRelative write SetRelative default False;
    property StartColor;
    property Visible default True; { 5.02 }
  end;

  TCustomBarSeries=class(TChartSeries)
  private
    FAutoBarSize     : Boolean;
    FAutoMarkPosition: Boolean;
    FBarStyle        : TBarStyle;
    FBarWidthPercent : Integer;
    FBevelSize       : Integer;
    FConePercent     : Integer;
    FDark3D          : Boolean;
    FDepthPercent    : Integer; // 7.0
    FGradient        : TBarSeriesGradient;
    FMultiBar        : TMultiBar;
    FOffsetPercent   : Integer;
    FSideMargins     : Boolean;
    FStackGroup      : Integer;
    FTickLines       : TChartHiddenPen;
    FTransparency    : TTeeTransparency;
    FUseOrigin       : Boolean;
    FOrigin          : Double;
    { events }
    FOnGetBarStyle   : TGetBarStyleEvent;

    { internal }
    FBarBounds     : TRect;
    INumBars       : Integer;
    IMaxBarPoints  : Integer;
    IOrderPos      : Integer;
    IPreviousCount : Integer;

    Procedure CalcGradientColor(ValueIndex:Integer);
    Function CreateBlend:TTeeBlend;
    Procedure DrawBevel;
    Function GetBarBrush:TChartBrush;
    Function GetBarPen:TChartPen;
    Function GetBarStyle(ValueIndex:Integer):TBarStyle;
    Procedure SetAutoBarSize(Value:Boolean);
    Procedure SetAutoMarkPosition(Value:Boolean);
    Procedure SetBarWidthPercent(Value:Integer);
    Procedure SetOffsetPercent(Value:Integer);
    Procedure SetBarStyle(Value:TBarStyle);
    procedure SetBevelSize(const Value: Integer);
    procedure SetConePercent(const Value: Integer);
    Procedure SetDark3d(Value:Boolean);
    Procedure SetDepthPercent(Value:Integer);
    Procedure SetGradient(Value:TBarSeriesGradient);
    Procedure SetMultiBar(Value:TMultiBar);
    Procedure SetOrigin(Const Value:Double);
    Procedure SetOtherBars(SetOthers:Boolean);
    Procedure SetSideMargins(Value:Boolean);
    Procedure SetStackGroup(Value:Integer);
    procedure SetTickLines(const Value: TChartHiddenPen);
    procedure SetTransparency(const Value: TTeeTransparency);
    Procedure SetUseOrigin(Value:Boolean);

    Procedure BarGradient(ValueIndex:Integer; R:TRect);
    Procedure InternalApplyBarMargin(Var MarginA,MarginB:Integer);
    Function InternalGetOriginPos(ValueIndex:Integer; DefaultOrigin:Integer):Integer;
    Function MaxMandatoryValue(Const Value:Double):Double;
    Function MinMandatoryValue(Const Value:Double):Double;
  protected
    IBarSize         : Integer; { 5.01 }
    FCustomBarSize   : Integer;

    Procedure AddSampleValues(NumValues:Integer; Sequential:Boolean=False); override; // 6.02
    procedure CalcDepthPositions; override;
    Procedure CalcFirstLastVisibleIndex; override;
    Procedure CalcZOrder; override;
    class procedure CreateSubGallery(AddSubChart:TChartSubGalleryProc); override;
    Procedure DoBeforeDrawChart; override;
    Procedure DrawLegendShape(ValueIndex:Integer; Const Rect:TRect); override;
    Procedure DrawTickLine(TickPos:Integer; AStyle:TBarStyle); dynamic;
    Procedure DrawTickLines(StartPos,EndPos:Integer; AStyle:TBarStyle);
    class Function GetEditorClass:String; override;
    Function InternalCalcMarkLength(ValueIndex:Integer):Integer; virtual; // abstract;
    Function InternalClicked(ValueIndex:Integer; P:TPoint):Boolean; virtual; // abstract;
    Procedure PrepareForGallery(IsEnabled:Boolean); override;
    Procedure PrepareLegendCanvas( ValueIndex:Integer; Var BackColor:TColor;
                                   Var BrushStyle:TBrushStyle); override;
    Procedure SetCustomBarSize(Value:Integer); { 5.01 BCB cannot compile if private }
    Procedure SetParentChart(Const Value:TCustomAxisPanel); override;
    class Procedure SetSubGallery(ASeries:TChartSeries; Index:Integer); override;
    class Function SubGalleryStack:Boolean; virtual;
  public
    NormalBarColor : TColor;

    Constructor Create(AOwner:TComponent); override;
    Destructor Destroy; override;

    Function AddBar(Const AValue:Double; Const ALabel:String; AColor:TColor):Integer;
    Function ApplyBarOffset(Position:Integer):Integer;
    Procedure Assign(Source:TPersistent); override;
    Function BarMargin:Integer; {virtual; 4.02 }
    Procedure BarRectangle(BarColor:TColor; ALeft,ATop,ARight,ABottom:Integer);
    Function CalcMarkLength(ValueIndex:Integer):Integer;
    Function Clicked(x,y:Integer):Integer; override;
    Function NumSampleValues:Integer; override;
    Function PointOrigin(ValueIndex:Integer; SumAll:Boolean):Double; virtual;
    Procedure SetPenBrushBar(BarColor:TColor);

    property BarBounds:TRect read FBarBounds;
    property ConePercent:Integer read FConePercent write SetConePercent
                                default 0;
    property Transparency:TTeeTransparency read FTransparency write SetTransparency default 0;
  published
    property Active;
    property BarBrush:TChartBrush read GetBarBrush write SetBrush;
    property BarPen:TChartPen read GetBarPen write SetPen;
    property BevelSize:Integer read FBevelSize write SetBevelSize default 1;
    property ColorEachPoint;
    property ColorSource;
    property Cursor;
    property Depth;
    property HorizAxis;
    property Marks;
    property ParentChart;
    property DataSource;
    property PercentFormat;
    property SeriesColor;
    property ShowInLegend;
    property Title;
    property ValueFormat;
    property VertAxis;
    property XLabelsSource;

    { events }
    property AfterDrawValues;
    property BeforeDrawValues;
    property OnAfterAdd;
    property OnBeforeAdd;
    property OnClearValues;
    property OnClick;
    property OnDblClick;
    property OnGetMarkText;
    property OnMouseEnter;
    property OnMouseLeave;

    property AutoBarSize:Boolean read FAutoBarSize write SetAutoBarSize default False;
    property AutoMarkPosition:Boolean read FAutoMarkPosition write SetAutoMarkPosition default True;
    property BarStyle:TBarStyle read FBarStyle write SetBarStyle
                                default bsRectangle;
    property BarWidthPercent:Integer read FBarWidthPercent
                                     write SetBarWidthPercent default 70;
    property Dark3D:Boolean read FDark3D write SetDark3D default True;
    property DepthPercent:Integer read FDepthPercent write SetDepthPercent default 100;
    property Gradient:TBarSeriesGradient read FGradient write SetGradient;
    property MultiBar:TMultiBar read FMultiBar write SetMultiBar default mbSide;
    property OffsetPercent:Integer read FOffsetPercent
                                   write SetOffsetPercent default 0;
    property SideMargins:Boolean read FSideMargins write SetSideMargins default True;
    property StackGroup:Integer read FStackGroup write SetStackGroup default 0;
    property TickLines:TChartHiddenPen read FTickLines write SetTickLines;
    property UseYOrigin:Boolean read FUseOrigin write SetUseOrigin default True;
    property YOrigin:Double read FOrigin write SetOrigin;

    { inherited published }
    property XValues;
    property YValues;
    { events }
    property OnGetBarStyle:TGetBarStyleEvent read FOnGetBarStyle write
                                             FOnGetBarStyle;
  end;

  TBarSeries=class(TCustomBarSeries)
  protected
    Procedure CalcHorizMargins(Var LeftMargin,RightMargin:Integer); override;
    Procedure CalcVerticalMargins(Var TopMargin,BottomMargin:Integer); override;
    Procedure DrawTickLine(TickPos:Integer; AStyle:TBarStyle); override;
    Procedure DrawMark( ValueIndex:Integer; Const St:String;
                        APosition:TSeriesMarkPosition); override;
    procedure DrawValue(ValueIndex:Integer); override;
    Function InternalCalcMarkLength(ValueIndex:Integer):Integer; override;
    Function InternalClicked(ValueIndex:Integer; P:TPoint):Boolean; override;
    Function MoreSameZOrder:Boolean; override;
  public
    Constructor Create(AOwner:TComponent); override;

    procedure CalcBarBounds(ValueIndex:Integer); // 7.02
    Function CalcXPos(ValueIndex:Integer):Integer; override;
    Function CalcYPos(ValueIndex:Integer):Integer; override;
    Procedure DrawBar(BarIndex,StartPos,EndPos:Integer); virtual;
    Function DrawSeriesForward(ValueIndex:Integer):Boolean; override;
    Function GetOriginPos(ValueIndex:Integer):Integer;
    Function MaxXValue:Double; override;
    Function MinXValue:Double; override;
    Function MaxYValue:Double; override;
    Function MinYValue:Double; override;

    property BarWidth:Integer read IBarSize;
  published
    property CustomBarWidth:Integer read FCustomBarSize
                                    write SetCustomBarSize default 0;
  end;

  THorizBarSeries=class(TCustomBarSeries)
  protected
    Procedure CalcHorizMargins(Var LeftMargin,RightMargin:Integer); override;
    Procedure CalcVerticalMargins(Var TopMargin,BottomMargin:Integer); override;
    Procedure DrawTickLine(TickPos:Integer; AStyle:TBarStyle); override;
    Procedure DrawMark( ValueIndex:Integer; Const St:String;
                        APosition:TSeriesMarkPosition); override;
    procedure DrawValue(ValueIndex:Integer); override;
    Function InternalCalcMarkLength(ValueIndex:Integer):Integer; override;
    Function InternalClicked(ValueIndex:Integer; P:TPoint):Boolean; override;
  public
    Constructor Create(AOwner:TComponent); override;

    Function CalcXPos(ValueIndex:Integer):Integer; override;
    Function CalcYPos(ValueIndex:Integer):Integer; override;
    Procedure DrawBar(BarIndex,StartPos,EndPos:Integer); virtual;
    Function DrawSeriesForward(ValueIndex:Integer):Boolean; override;
    Function GetOriginPos(ValueIndex:Integer):Integer;
    Function MaxXValue:Double; override;
    Function MinXValue:Double; override;
    Function MaxYValue:Double; override;
    Function MinYValue:Double; override;

    property BarHeight:Integer read IBarSize;
  published
    property CustomBarHeight:Integer read FCustomBarSize
                                     write SetCustomBarSize default 0;
  end;

  TCircledSeries=class(TChartSeries)
  private
    FCircleBackColor : TColor;
    FCircled         : Boolean;
    FCustomXRadius   : Integer;
    FCustomYRadius   : Integer;
    FRotationAngle   : Integer;
    FXRadius         : Integer;
    FYRadius         : Integer;

    { internal }
    IBack3D         : TView3DOptions;
    FCircleWidth    : Integer;
    FCircleHeight   : Integer;
    FCircleXCenter  : Integer;
    FCircleYCenter  : Integer;
    FCircleRect     : TRect;
    IRotDegree      : Double;

    Procedure SetBackupProperties;
    procedure SetCircleBackColor(Value:TColor);
    Procedure SetCircled(Value:Boolean);
    procedure SetCustomXRadius(Value:Integer);
    procedure SetCustomYRadius(Value:Integer);
    procedure SetOtherCustomRadius(IsXRadius:Boolean; Value:Integer);
  protected
    FCircleGradient  : TChartGradient;
    
    Procedure AdjustCircleRect;
    Function CalcCircleBackColor:TColor;
    Procedure CalcRadius;
    Procedure CheckOtherSeriesMarks; dynamic; // 6.02, 5.03
    Procedure DoBeforeDrawValues; override;
    Procedure DrawCircleGradient; virtual;
    Function HasBackColor:Boolean;
    Procedure InitCustom3DOptions; dynamic;
    Procedure PrepareLegendCanvas( ValueIndex:Integer; Var BackColor:TColor;
                                   Var BrushStyle:TBrushStyle); override;
    Procedure SetActive(Value:Boolean); override;
    procedure SetCircleGradient(const Value: TChartGradient);
    Procedure SetParentChart(Const Value:TCustomAxisPanel); override;
    Procedure SetParentProperties(EnableParentProps:Boolean); dynamic;
    Procedure SetRotationAngle(const Value:Integer);

    property CircleGradient:TChartGradient read FCircleGradient write SetCircleGradient;
  public
    Constructor Create(AOwner: TComponent); override;
    Destructor Destroy; override;

    Procedure AngleToPos( Const Angle,AXRadius,AYRadius:Double;
                          Var X,Y:Integer);
    Procedure Assign(Source:TPersistent); override;
    Function AssociatedToAxis(Axis:TChartAxis):Boolean; override;
    Function PointToAngle(x,y:Integer):Double;
    Function PointToRadius(x,y: Integer): Double;  // 7.02
    Procedure Rotate(const Angle:Integer);
    Function UseAxis:Boolean; override;

    { read only properties }
    property CircleBackColor:TColor read FCircleBackColor
                                    write SetCircleBackColor default clTeeColor;
    property CircleHeight:Integer read FCircleHeight;
    property CircleRect:TRect read FCircleRect;
    property CircleWidth:Integer read FCircleWidth;
    property CircleXCenter:Integer read FCircleXCenter;
    property CircleYCenter:Integer read FCircleYCenter;
    property RotationAngle:Integer read FRotationAngle write SetRotationAngle
                                   default 0;
    property XRadius:Integer read FXRadius;
    property YRadius:Integer read FYRadius;
  published
    property ColorSource;
    property Cursor;
    property Marks;
    property ParentChart;
    property DataSource;
    property PercentFormat;
    property SeriesColor;
    property ShowInLegend;
    property Title;
    property ValueFormat;
    property XLabelsSource;

    { events }
    property AfterDrawValues;
    property BeforeDrawValues;
    property OnAfterAdd;
    property OnBeforeAdd;
    property OnClearValues;
    property OnClick;
    property OnDblClick;
    property OnGetMarkText;
    property OnMouseEnter;
    property OnMouseLeave;

    property Circled:Boolean read FCircled write SetCircled default False;
    property CustomXRadius:Integer read FCustomXRadius write SetCustomXRadius default 0;
    property CustomYRadius:Integer read FCustomYRadius write SetCustomYRadius default 0;
  end;

  TPieAngle=Packed Record
    StartAngle : Double;
    MidAngle   : Double;
    EndAngle   : Double;
  end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -