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

📄 drawingobjchart2.pas

📁 一个经典的读写Excel的控件
💻 PAS
📖 第 1 页 / 共 5 页
字号:
public
     constructor Create;
     destructor Destroy; override;
published
     property PointIndex: integer read GetPointIndex write SetPointIndex;
     property PieSliceDist: integer read GetPieSliceDist write SetPieSliceDist;
     property DataLablel: TChartDataLabels read GetDataLablel write SetDataLablel;
     property LineFormat: TLineFormat read FLineFormat write FLineFormat;
     property AreaFormat: TAreaFormat read FAreaFormat write FAreaFormat;
     property MarkerFormat: TMarkerFormat read FMarkerFormat write FMarkerFormat;
     end;

type TDataPoints = class(TObjectList)
private
     FOwner: TObject;

     function  GetItems(Index: integer): TDataPoint;
public
     constructor Create(AOwner: TObject);
     function  Add: TDataPoint;
     function  AddFromFile: TDataPoint;
     procedure Delete(Index: integer);

     property Items[Index: integer]: TDataPoint read GetItems; default;
     end;

type
//: TChartSerie is a serie of values in the chart, that referrers to an area
//: of cells in the workbook. There has to be at least one serie in a chart.
    TChartSerie = class(TCollectionItem)
private
     FRecord: TChartRecord;
     FFormulaHandler: TFormulaHandler;
     FiRecAI_Values: integer;
     FiRecAI_Values2: integer;
     FiRecAI_Category: integer;
     FiRecAI_SerieName: integer;
     PRecGeomtery: TChartRecord;
     FDefDatapoint: TDataPoint;
     FDataPoints: TDataPoints;

     function  GetAIFormula(AI: PCRecAI): WideString;
     procedure SetAIFormula(AI: TChartRecord; Value: WideString);
     function  GetCategory: WideString;
     function  GetValues: WideString;
     procedure SetCategory(const Value: WideString);
     procedure SetValues(const Value: WideString);
     function  GetValues2: WideString;
     procedure SetValues2(const Value: WideString);
     function  GetSerieName: WideString;
     procedure SetSerieName(const Value: WideString);
     function  GetGeomtery: TSerieItemGeomtery;
     procedure SetGeomtery(const Value: TSerieItemGeomtery);
     function  GetHasDefDataPoint: boolean;
     procedure SetHasDefDataPoint(const Value: boolean);
protected
     procedure AssignRecords(Rec: TChartRecord);
public
     constructor Create(Collection: TCollection); override;
     destructor Destroy; override;
published
     //: Source cells for the serie. This shall be a vector, i.e the area
     //: given shall be a one dimensional list of rows or columns. The worksheet
     //: name must be included, an the cell references shall be absolute,
     //: otherwise they may change if the chart is moved.
     //: Example, source cells in one column: Sheet1!$D$7:$D$18
     //: Example, source cells in one row: Sheet3!$B$7:$H$7
     property Values: WideString read GetValues write SetValues;
     //: Second set of source values. Values2 are used in bubble charts, to
     //: set the size of the bubbles. See also @link(Values).
     property Values2: WideString read GetValues2 write SetValues2;
     property Category: WideString read GetCategory write SetCategory;
     property SerieName: WideString read GetSerieName write SetSerieName;
     property DataPoints: TDataPoints read FDataPoints write FDataPoints;
     property DefDataPoint: TDataPoint read FDefDatapoint write FDefDatapoint;
     property HasDefDataPoint: boolean read GetHasDefDataPoint write SetHasDefDataPoint;
     property Geomtery: TSerieItemGeomtery read GetGeomtery write SetGeomtery;
     end;

type TChartSeries = class(TCollection)
private
     function GetChartSerie(Index: integer): TChartSerie;
protected
     FOwner: TPersistent;
     FFormulaHandler: TFormulaHandler;

     function  GetOwner: TPersistent; override;
public
     constructor Create(AOwner: TPersistent; FormulaHandler: TFormulaHandler);
     function  Add: TChartSerie;
     function  AddFromFile: TChartSerie;
     procedure Delete(Index: integer);

     property Items[Index: integer]: TChartSerie read GetChartSerie; default;
     end;

type TTickFormat = class(TRecordObject)
private
     function GetLabelColor: TExcelColor;
     function GetLabelPosition: TTickLablePos;
     function GetMajorTick: TTickType;
     function GetMinorTick: TTickType;
     function GetTextRotation: integer;
     procedure SetLabelColor(const Value: TExcelColor);
     procedure SetLabelPosition(const Value: TTickLablePos);
     procedure SetMajorTick(const Value: TTickType);
     procedure SetMinorTick(const Value: TTickType);
     procedure SetTextRotation(const Value: integer);
public
published
     property MajorTick: TTickType read GetMajorTick write SetMajorTick;
     property MinorTick: TTickType read GetMinorTick write SetMinorTick;
     property LabelPosition: TTickLablePos read GetLabelPosition write SetLabelPosition;
     property LabelColor: TExcelColor read GetLabelColor write SetLabelColor;
     property TextRotation: integer read GetTextRotation write SetTextRotation;
     end;

type TCatSerAxisScaling = class(TRecordObject)
private
     function  GetCrossingPoint: integer;
     function  GetLabelsFrequency: integer;
     function  GetOptions: TCatSerAxisScalingOptions;
     function  GetTickMarksFrequency: integer;
     procedure SetCrossingPoint(const Value: integer);
     procedure SetLabelsFrequency(const Value: integer);
     procedure SetOptions(const Value: TCatSerAxisScalingOptions);
     procedure SetTickMarksFrequency(const Value: integer);
published
     property CrossingPoint: integer read GetCrossingPoint write SetCrossingPoint;
     property LabelsFrequency: integer read GetLabelsFrequency write SetLabelsFrequency;
     property TickMarksFrequency: integer read GetTickMarksFrequency write SetTickMarksFrequency;
     property Options: TCatSerAxisScalingOptions read GetOptions write SetOptions;
     end;

type TValueAxisScaling = class(TRecordObject)
private
     procedure CheckFlag(Flag: word; Value: double);
     
     function  GetCategoryAxisCrossing: double;
     function  GetMajorInc: double;
     function  GetMaxValue: double;
     function  GetMinorInc: double;
     function  GetMinValue: double;
     function  GetOptions: TValueAxisScalingOptions;
     procedure SetCategoryAxisCrossing(const Value: double);
     procedure SetMajorInc(const Value: double);
     procedure SetMaxValue(const Value: double);
     procedure SetMinorInc(const Value: double);
     procedure SetMinValue(const Value: double);
     procedure SetOptions(const Value: TValueAxisScalingOptions);
published
     property MinValue: double read GetMinValue write SetMinValue;
     property MaxValue: double read GetMaxValue write SetMaxValue;
     property MajorInc: double read GetMajorInc write SetMajorInc;
     property MinorInc: double read GetMinorInc write SetMinorInc;
     property CategoryAxisCrossing: double read GetCategoryAxisCrossing write SetCategoryAxisCrossing;
     property Options: TValueAxisScalingOptions read GetOptions write SetOptions;
     end;

type TChartAxis = class(TRecordObject)
private
     FTick: TTickFormat;
protected
     procedure Assign(Rec: TChartRecord); override;
public
     constructor Create;
     destructor Destroy; override;
     end;

type TCategoryAxis = class(TChartAxis)
private
     FCatSerAxisScaling: TCatSerAxisScaling;
protected
     procedure Assign(Rec: TChartRecord); override;
public
     constructor Create;
     destructor Destroy; override;
published
     property CatSerAxisScaling: TCatSerAxisScaling read FCatSerAxisScaling write FCatSerAxisScaling;
     end;

type TSerieAxis = class(TChartAxis)
private
     FCatSerAxisScaling: TCatSerAxisScaling;
protected
     procedure Assign(Rec: TChartRecord); override;
public
     constructor Create;
     destructor Destroy; override;
published
     property CatSerAxisScaling: TCatSerAxisScaling read FCatSerAxisScaling write FCatSerAxisScaling;
     end;

type TValueAxis = class(TChartAxis)
private
     FValueAxisScaling: TValueAxisScaling;
protected
     procedure Assign(Rec: TChartRecord); override;
public
     constructor Create;
     destructor Destroy; override;
published
     property ValueAxisScaling: TValueAxisScaling read FValueAxisScaling write FValueAxisScaling;
     end;

type TChart3D = class(TRecordObject)
private
     function  GetDistance: integer;
     function  GetElevation: integer;
     function  GetOptions: TChart3DOptions;
     function  GetRelDepth: integer;
     function  GetRelHeight: integer;
     function  GetRotation: integer;
     function  GetSeriesSpace: integer;
     procedure SetDistance(const Value: integer);
     procedure SetElevation(const Value: integer);
     procedure SetOptions(const Value: TChart3DOptions);
     procedure SetRelDepth(const Value: integer);
     procedure SetRelHeight(const Value: integer);
     procedure SetRotation(const Value: integer);
     procedure SetSeriesSpace(const Value: integer);
public
published
     property Rotation: integer read GetRotation write SetRotation;
     property Elevation: integer read GetElevation write SetElevation;
     property Distance: integer read GetDistance write SetDistance;
     property RelHeight: integer read GetRelHeight write SetRelHeight;
     property RelDepth: integer read GetRelDepth write SetRelDepth;
     property SeriesSpace: integer read GetSeriesSpace write SetSeriesSpace;
     property Options: TChart3DOptions read GetOptions write SetOptions;
     end;

type TChartLegend = class(TRecordObject)
private
     FFrame: TPaintFrame;

     function  GetLegendSpacing: TChartLegendSpacing;
     function  GetLegendType: TChartLegendType;
     function  GetVertical: boolean;
     procedure SetLegendSpacing(const Value: TChartLegendSpacing);
     procedure SetLegendType(const Value: TChartLegendType);
     procedure SetVertical(const Value: boolean);
     function  GetHasFrame: boolean;
     procedure SetHasFrame(const Value: boolean);
protected
     procedure Assign(Rec: TChartRecord); override;
public
     constructor Create;
     destructor Destroy; override;
published
     property LegendType: TChartLegendType read GetLegendType write SetLegendType;
     property LegendSpacing: TChartLegendSpacing read GetLegendSpacing write SetLegendSpacing;
     property Vertical: boolean read GetVertical write SetVertical;
     property Frame: TPaintFrame read FFrame write FFrame;
     property HasFrame: boolean read GetHasFrame write SetHasFrame;
     end;

type TChartStyle = class(TRecordObject)
private
     FChart3D: TChart3D;
     FLegend: TChartLegend;
     FDefDatapoint: TDataPoint;

     function  GetVaryColors: boolean;
     procedure SetVaryColors(const Value: boolean);
     function  GetHasDefDataPoint: boolean;
     procedure SetHasDefDataPoint(const Value: boolean);
protected
     procedure Assign(Rec: TChartRecord); override;
     function ChartType: TXLSChartType; virtual;
public
     constructor Create;
     destructor Destroy; override;
published
     property Chart3D: TChart3D read FChart3D;
     property Legend: TChartLegend read FLegend write FLegend;
     property VaryColors: boolean read GetVaryColors write SetVaryColors;
     property DefDatapoint: TDataPoint read FDefDatapoint;
     property HasDefDataPoint: boolean read GetHasDefDataPoint write SetHasDefDataPoint;
     end;

type TChartStyleArea = class(TChartStyle)
protected
     procedure Assign(Rec: TChartRecord); override;
     function ChartType: TXLSChartType; override;
public
     constructor Create;
     destructor Destroy; override;
     end;

type TChartStyleBarColumn = class(TChartStyle)
private
     function  GetIsBar: boolean;
     procedure SetIsBar(const Value: boolean);
protected
     procedure Assign(Rec: TChartRecord); override;
     function ChartType: TXLSChartType; override;
public
     constructor Create;
     destructor Destroy; override;
published
     property IsBar: boolean read GetIsBar write SetIsBar;
     end;

type TChartStyleSurface = class(TChartStyle)
protected
     procedure Assign(Rec: TChartRecord); override;
public
     constructor Create;
     destructor Destroy; override;
     end;

type TChartStyleScatter = class(TChartStyle)
private
     function  GetBubbleIsArea: boolean;
     function  GetBubblePercent: integer;
     function  GetIsBubble: boolean;
     function  GetNegativeBubble: boolean;
     function  GetShadow: boolean;
     procedure SetBubbleIsArea(const Value: boolean);
     procedure SetBubblePercent(const Value: integer);
     procedure SetIsBubble(const Value: boolean);
     procedure SetNegativeBubble(const Value: boolean);
     procedure SetShadow(const Value: boolean);
protected
     procedure Assign(Rec: TChartRecord); override;
public
     constructor Create;
     destructor Destroy; override;
published
     property BubblePercent: integer read GetBubblePercent write SetBubblePercent;
     property BubbleIsArea: boolean read GetBubbleIsArea write SetBubbleIsArea;
     property IsBubble: boolean read GetIsBubble write SetIsBubble;
     property NegativeBubble: boolean read GetNegativeBubble write SetNegativeBubble;
     property Shadow: boolean read GetShadow write SetShadow;
     end;

type TChartStylePie = class(TChartStyle)
private
     function  GetAngle: integer;
     function  GetDonutHole: integer;
     function  GetLeaderLines: boolean;
     function  GetShadow: boolean;
     procedure SetAngle(const Value: integer);
     procedure SetDonutHole(const Value: integer);
     procedure SetLeaderLines(const Value: boolean);
     procedure SetShadow(const Value: boolean);
protected
     procedure Assign(Rec: TChartRecord); override;
public
     constructor Create;
     destructor Destroy; override;
published
     property Angle: integer read GetAngle write SetAngle;
     property DonutHole: integer read GetDonutHole write SetDonutHole;
     property Shadow: boolean read GetShadow write SetShadow;
     property LeaderLines: boolean read GetLeaderLines write SetLeaderLines;
     end;

// Bar of Pie/Pie of Pie
type TChartStyleBopPop = class(TChartStyle)
protected
     procedure Assign(Rec: TChartRecord); override;
public
     constructor Create;
     destructor Destroy; override;
     end;

type TChartStyleLine = class(TChartStyle)
private
     function  GetCategoryAsPercent: boolean;
     function  GetShadow: boolean;
     function  GetStacked: boolean;
     procedure SetCategoryAsPercent(const Value: boolean);
     procedure SetShadow(const Value: boolean);
     procedure SetStacked(const Value: boolean);
protected
     procedure Assign(Rec: TChartRecord); override;
public
     constructor Create;
     destructor Destroy; override;
     property Stacked: boolean read GetStacked write SetStacked;
     property CategoryAsPercent: boolean read GetCategoryAsPercent write SetCategoryAsPercent;
     property Shadow: boolean read GetShadow write SetShadow;
     end;

type TChartStyleRadar = class(TChartStyle)
private

⌨️ 快捷键说明

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