TExportDrawing → TExportChart → [...] → TExportChartBars
TExportChartBars is the bar and column chart class.
Please note that Excel has some problems reading ODS charts (it can read most features, but not all)! ODS charts are correctly displayed in Calc and XLSX charts are correctly displayed in Excel.
Name | Type | Description |
---|---|---|
Grouping | TExportChartGrouping | Grouping of the chart. |
Form | TExportChartBarsForm | Form of the chart:
|
Orientation | TExportChartBarsOrientation | Orientation of the chart:
|
Please see TExportChart for inherited properties. |
This code generates a clustered bar chart:
procedure TForm1.BtnTestClick(Sender: TObject); var xExport: TOExport; I: Integer; begin xExport := TOExport.Create; try with xExport.AddWorkSheet('Bar chart') do begin AddRow.AddCellString('Sales in €').SetFontSize(20); with AddRow do begin AddCellString('Products'); AddCellString('January'); AddCellString('February'); AddCellString('March'); AddCellString(''); AddCellString(''); with AddCellString('').AddChart(TExportChartBars, 0, 0, 500, 300) do with TExportChartBars(Drawing) do begin Title := 'Sales in €'; Fill.Color := clWhite; Border.Color := clBlue; Shadow.FillStyle := edfColor; Grouping := ecClustered;//TRY DIFFERENT SETTINGS Orientation := ecoVertical;//TRY DIFFERENT SETTINGS Form := ecfBox3D;//TRY DIFFERENT SETTINGS Legend := eclRight;//TRY DIFFERENT SETTINGS YAxis.TickSkip := 10;//TRY DIFFERENT SETTINGS XTicsRange.SetRange(0, Rows.Count, 1, 4);//x-axis description for I := 1 to 3 do with AddData(I, Rows.Count, 1, 4) do begin//y-axis data DataTitle.SetRange(I, Rows.Count-1, 1, 1);//legend entry title Border.FillStyle := edfNone; ShowLabels := False; end; end; end; with AddRow do begin AddCellString('Bubble gums'); AddCellNumber(15); AddCellNumber(12); AddCellNumber(8); end; with AddRow do begin AddCellString('Doughnuts'); AddCellNumber(30); AddCellNumber(40); AddCellNumber(25); end; with AddRow do begin AddCellString('Soups'); AddCellNumber(10); AddCellNumber(18); AddCellNumber(12); end; with AddRow do begin AddCellString('Drinks'); AddCellNumber(50); AddCellNumber(47); AddCellNumber(61); end; end; xExport.SaveToFileWithDialog; finally xExport.Free; end; end;