Runtime creating chart with PDF export in a simple unit

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
johndw
Newbie
Newbie
Posts: 4
Joined: Fri Sep 28, 2012 12:00 am

Runtime creating chart with PDF export in a simple unit

Post by johndw » Fri Apr 21, 2023 10:18 am

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

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

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

Post by Yeray » Mon Apr 24, 2023 3:54 pm

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;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply