Export a chart with multiple pages

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Rikki
Newbie
Newbie
Posts: 2
Joined: Thu Feb 23, 2012 12:00 am

Export a chart with multiple pages

Post by Rikki » Fri Sep 20, 2013 1:14 pm

Hello,

I have a bar chart which is split into multiple pages using MaxPointsPerPage. I want to export the chart to a bitmap and need a method for showing all the information whilst maintaining readability. I could change MaxPointsPerPage to zero, but this just squashes all the data onto one chart and it becomes illegible.

I thought I could do something like this; iterate through the pages and create a bitmap for each one. Unfortunately this generates the same page each time, as if the underlying image is not refreshed.

Is there any way of getting a bitmap for each page? Or perhaps there's a better way of generating a bitmap for multi-page charts?

Thanks in advance.

Rikki

Code: Select all

procedure ExportChart(MyChart: TChart; const FolderPath: string);
var
  Bmp: TBitmap;
  CurrentPageNo: Integer;
begin
  CurrentPageNo := 1;

  while CurrentPageNo <= MyChart.Pages.Count do
  begin
    MyChart.Pages.Current := CurrentPageNo;

    Bmp := MyChart.TeeCreateBitmap;
    try
      Bmp.SaveToFile(FolderPath + 'MyChart Page ' + IntToStr(CurrentPageNo) + '.bmp');

    finally
      if Assigned(Bmp) then
        Bmp.Free;
    end;

    Inc(CurrentPageNo);
  end;
end;

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Export a chart with multiple pages

Post by Narcís » Tue Sep 24, 2013 8:24 am

Hi Rikki,

One option would be what Pep suggested here. If this doesn't work fine at your end you could manually do the paging for exporting changing bottom axis scale with the SetMinMax method. You could change the bottom axis scale from minimum to maximum and export all intermediate charts.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Rikki
Newbie
Newbie
Posts: 2
Joined: Thu Feb 23, 2012 12:00 am

Re: Export a chart with multiple pages

Post by Rikki » Tue Sep 24, 2013 2:45 pm

Hello,

Thanks for info. I'll take look and see if it helps.

Regards,
Rikki

Post Reply