TExportDrawing → TExportChart → [...] → TExportChartLines
TExportChartLines is the line 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 | TCustomExportChartForm | Form of the chart (ecf2D, ecf3D). |
Please see TExportChart for inherited properties. |
This code generates a simple line chart:
procedure TForm1.BtnTestClick(Sender: TObject); var xExport: TOExport; I: Integer; begin xExport := TOExport.Create; try with xExport.AddWorkSheet('Line chart') do begin AddRow.AddCellString('Sales in €').SetFontSize(20); with AddRow do begin AddCellString('Products'); AddCellString('Bubble gums'); AddCellString('Doughnuts'); AddCellString('Soups'); AddCellString('Drinks'); AddCellString(''); AddCellString(''); with AddCellString('').AddChart(TExportChartLines, 0, 0, 500, 300) do with TExportChartLines(Drawing) do begin Title := 'Sales in €'; Fill.Color := clWhite; Border.Color := clBlue; Shadow.FillStyle := edfColor; Form := ecf2D;//TRY DIFFERENT SETTINGS Legend := eclLeft;//TRY DIFFERENT SETTINGS YAxis.TickSkip := 10;//TRY DIFFERENT SETTINGS XTicsRange.SetRange(0, Rows.Count, 1, 3);//x-axis description for I := 1 to 4 do with AddData(I, Rows.Count, 1, 3) do begin//y-axis data DataTitle.SetRange(I, Rows.Count-1, 1, 1);//legend entry title ShowLabels := False; Border.Style := TDrawingBorderStyle((I-1) mod (Ord(High(TDrawingBorderStyle))+1)); Border.Size := 5; Markers.Size := 10; end; end; end; with AddRow do begin AddCellString('January'); AddCellNumber(15); AddCellNumber(30); AddCellNumber(10); AddCellNumber(50); end; with AddRow do begin AddCellString('February'); AddCellNumber(12); AddCellNumber(40); AddCellNumber(18); AddCellNumber(47); end; with AddRow do begin AddCellString('March'); AddCellNumber(8); AddCellNumber(25); AddCellNumber(12); AddCellNumber(61); end; end; xExport.SaveToFileWithDialog; finally xExport.Free; end; end;