Page 1 of 1

Runtime creating chart with PDF export in a simple unit

Posted: Fri Apr 21, 2023 10:18 am
by 16563572
Hi,

I am using RadStudio Alexandria and would lile to runtime create a chart and export it to a PDF file. Is it possible to be done without using a form with a TChart component on by simply creating a TChart instance together with TSeries instances?

Many thanks in advance!

Kind Regards
John

Re: Runtime creating chart with PDF export in a simple unit

Posted: Mon Apr 24, 2023 3:54 pm
by yeray
Hello John,

This seems to work fine for me here:

Code: Select all

uses Chart, Series, TeePDFCanvas;

procedure TForm1.Button1Click(Sender: TObject);
var Chart1: TChart;
begin
  Chart1:=TChart.Create(Self);
  Chart1.View3D:=False;
  Chart1.AddSeries(TLineSeries);
  Chart1[0].FillSampleValues;

  TeeSaveToPDFFile(Chart1, 'test.pdf');
end;