Docs HotXLS

TXLSXChart and TXLSXCharts classes

TXLSXCharts is the embedded-chart collection exposed by TXLSXWorksheet.Charts and TXLSXChart owns the chart placement, axes and series

Declarations

function TXLSXCharts.Add: TXLSXChart; overload;
function TXLSXCharts.Add(AChartType: TXLSXChartType; const ATitle: WideString; AFromRow, AFromCol, AToRow, AToCol: Integer): TXLSXChart; overload;
function TXLSXChart.AddSeries(const AName, ACategories, AValues: WideString): TXLSXChartSeries;
procedure TXLSXChart.ClearSeries;
property TXLSXChart.ChartType: TXLSXChartType;
property TXLSXChart.CategoryAxis, ValueAxis: TXLSXChartAxis;
property TXLSXChart.Series[Index: Integer]: TXLSXChartSeries;

Chart members

Title, CategoryAxisTitle and ValueAxisTitleChart and axis caption text
FromRow, FromCol, ToRow and ToColOne-based worksheet anchor rectangle
CategoryAxis and ValueAxisAxis formatting and scaling objects
ShowDataTable and ShowDataTableKeysData-table display controls
HasUpDownBars, UpDownGapWidth and HasHiLowLinesLine and stock chart display controls
Rotation3DX, Rotation3DY, Elevation3D, Perspective3D and RightAngleAxes3DThree-dimensional chart view controls

Series, trendlines and error bars

function TXLSXChartSeries.AddTrendline(AType: TXLSXChartTrendlineType): TXLSXChartTrendline;
function TXLSXChartSeries.AddErrorBar(ADir: TXLSXChartErrDir): TXLSXChartErrBar;
property TXLSXChartSeries.Trendlines[Index: Integer]: TXLSXChartTrendline;
property TXLSXChartSeries.ErrBarX, ErrBarY: TXLSXChartErrBar;
property TXLSXChartTrendline.TrendlineType: TXLSXChartTrendlineType;
property TXLSXChartTrendline.DispEq, DispRSqr: Boolean;
property TXLSXChartTrendline.Order, Period: Integer;
property TXLSXChartErrBar.ValueType: TXLSXChartErrValType;
property TXLSXChartErrBar.Value, PlusValue, MinusValue: Double;
TrendlineTypeLinear, exponential, logarithmic, polynomial, power or moving-average trendline
DispEq and DispRSqrShows the equation and R-squared value on the chart
Order and PeriodPolynomial order or moving-average period for the corresponding trendline type
ValueTypeFixed, percentage, standard-deviation, standard-error or custom error magnitude
NoEndCapHides the cap at either end of an error bar

Axis and data-label members

LogBase and OrientationLogarithmic scale base and normal or reversed axis ordering
MajorGridlines and MinorGridlinesGridline visibility controls
MinValue, MaxValue, MajorUnit and MinorUnitExplicit scaling bounds and tick spacing where supported
CrossesAt, TickLblPos and DispUnitsAxis crossing position, label placement and display units
ShowValue, ShowCategoryName, ShowSeriesName, ShowLegendKey, ShowPercent and ShowBubbleSizePer-series data-label components
SeparatorText used between multiple displayed data-label components

Exemple

var Chart: TXLSXChart;
begin
  Chart := Sheet.Charts.Add(xlsxChartColumn, 'Monthly sales', 2, 5, 18, 12);
  Chart.AddSeries('Sales', 'Sheet1!$A$2:$A$13', 'Sheet1!$B$2:$B$13');
  Chart.ValueAxisTitle := 'Amount';
  Chart.Series[0].AddTrendline(xlsxTrendLinear).DispRSqr := True;
  Chart.Series[0].ShowValue := True;
end;

Voir aussi