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

📄 series.pas

📁 BCB第三方组件
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    property ColorEachPoint;
    property ColorSource;
    property Cursor;
    property Depth;
    property Gradient;
    property HorizAxis;
    property Marks;
    property ParentChart;
    property DataSource;  // After ParentChart
    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 AreaBrush;
    property AreaChartBrush;
    property AreaColor;
    property AreaLinesPen;
    property ClickableLine;
    property Dark3D;
    property DrawArea;
    property InvertedStairs;
    property LinePen;
    property MultiArea:TMultiArea read GetMultiArea write SetMultiArea default maNone;
    property Pointer;
    property Stairs;
    property StackGroup:Integer read FStackGroup write SetStackGroup default 0;
    property Transparency;
    property TreatNulls;
    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 Angle;
    property Balance;
    property Direction nodefault;
    property MidColor;
    property RadialX;
    property RadialY;
    property Relative:Boolean read FRelative write SetRelative default False;
    property SubGradient;
    property StartColor;
    property Visible default True;
  end;

  TCustomBarSeries=class(TChartSeries)
  private
    FAutoBarSize     : Boolean;
    FAutoMarkPosition: Boolean;
    FBarStyle        : TBarStyle;
    FBarWidthPercent : Integer;
    FBevelSize       : Integer;
    FConePercent     : Integer;
    FDark3D          : Boolean;
    FDarkPen         : Integer;
    FDepthPercent    : Integer;
    FGradient        : TBarSeriesGradient;
    FMultiBar        : TMultiBar;
    FOffsetPercent   : Integer;
    FShadow          : TTeeShadow;
    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(Transp:Integer):TTeeBlend;
    Procedure DrawBevel;
    Function GetBarBrush:TChartBrush;
    Function GetBarPen:TChartPen;
    Function GetBarStyle(ValueIndex:Integer):TBarStyle;
    Procedure PrepareBarPen(ValueIndex:Integer);
    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 SetDarkPen(Value:Integer);
    Procedure SetDepthPercent(Value:Integer);
    Procedure SetGradient(Value:TBarSeriesGradient);
    Procedure SetMultiBar(Value:TMultiBar);
    Procedure SetOrigin(Const Value:Double);
    Procedure SetOtherBars(SetOthers:Boolean);
    procedure SetShadow(Const Value:TTeeShadow);
    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);
    procedure DrawValue(ValueIndex:Integer); override;
    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);
    procedure CalcBarBounds(ValueIndex:Integer); virtual; abstract;
    Function CalcMarkLength(ValueIndex:Integer):Integer;
    Function Clicked(x,y:Integer):Integer; override;
    Procedure DrawBar(BarIndex,StartPos,EndPos:Integer); virtual; abstract;
    Function NumSampleValues:Integer; override;
    Function PointOrigin(ValueIndex:Integer; SumAll:Boolean):Double; virtual;
    Procedure SetPenBrushBar(BarColor:TColor; ValueIndex:Integer=-1);

    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 DarkPen:Integer read FDarkPen write SetDarkPen default 0;
    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 Shadow:TTeeShadow read FShadow write SetShadow;
    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 CalcSelectionPos(ValueIndex:Integer; out X,Y: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;
    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); override;
    Function CalcXPos(ValueIndex:Integer):Integer; override;
    Function CalcYPos(ValueIndex:Integer):Integer; override;
    Procedure DrawBar(BarIndex,StartPos,EndPos:Integer); override;
    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 CalcSelectionPos(ValueIndex:Integer; out X,Y: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;
    Function InternalCalcMarkLength(ValueIndex:Integer):Integer; override;
    Function InternalClicked(ValueIndex:Integer; P:TPoint):Boolean; override;
  public
    Constructor Create(AOwner:TComponent); override;

    procedure CalcBarBounds(ValueIndex:Integer); override;
    Function CalcXPos(ValueIndex:Integer):Integer; override;
    Function CalcYPos(ValueIndex:Integer):Integer; override;
    Procedure DrawBar(BarIndex,StartPos,EndPos:Integer); override;
    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;

  TCircledShadow=class(TTeeShadow) { 5.02 }
  published
    property Color default Tee_CircledShadowColor;
  end;

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

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

    Procedure SetBackupProperties;
    procedure SetCircleBackColor(Value:TColor);
    Procedure SetCircled(Value:Boolean);
    procedure SetCustomXRadius(Value:Integer);
    procedure SetCustomYRadius(Value:Integer);
    procedure SetOtherCustomRadius(IsXRadius:Boolean; Value:Integer);
    Procedure SetShadow(const Value:TCircledShadow);
  protected
    FCircleGradient : TChartGradient;
    IRotDegree      : Double;

    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;

    class procedure AdjustScreenRatio(ACanvas:TCanvas3D;
                                      AXRadius,AYRadius:Integer; var R:TRect);
    Procedure AngleToPos( Const Angle,AXRadius,AYRadius:Double;

⌨️ 快捷键说明

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