TExportDrawing → TExportChart → [...] → TExportChartPie
TExportChartPie is the pie 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 |
---|---|---|
Style | TExportChartPieStyle | Style of the pie:
|
Form | TCustomExportChartForm | Form of the chart (ecf2D, ecf3D). |
Please see TExportChart for inherited properties. |
This code generates a simple pie chart:
procedure TForm1.BtnTestClick(Sender: TObject); var xExport: TOExport; I, L: Integer; xTime: Double; begin xExport := TOExport.Create; try with xExport.AddWorkSheet('Pie chart') do begin AddRow.AddCellString('Pie Chart').SetFontSize(20); with AddRow do begin AddCellString('Products'); AddCellString('Sales [€]'); AddCellString(''); AddCellString(''); with AddCellString('').AddChart(TExportChartPie, 0, 0, 500, 300) do with TExportChartPie(Drawing) do begin Title := 'Sales in January in €'; Fill.Color := clWhite; Border.Color := clBlue; Shadow.FillStyle := edfColor; Form := ecf3D; Legend := eclRight; XTicsRange.SetRange(0, Rows.Count, 1, 4); with AddData(1, Rows.Count, 1, 4) do begin Border.FillStyle := edfNone; ShowLabels := True; end; end; end; with AddRow do begin AddCellString('Bubble gums'); AddCellNumber(15); end; with AddRow do begin AddCellString('Doughnuts'); AddCellNumber(30); end; with AddRow do begin AddCellString('Soups'); AddCellNumber(10); end; with AddRow do begin AddCellString('Drinks'); AddCellNumber(50); end; end; xExport.SaveToFileWithDialog; finally xExport.Free; end; end;