Page 1 of 1

Export a chart with multiple pages

Posted: Fri Sep 20, 2013 1:14 pm
by 16461717
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;

Re: Export a chart with multiple pages

Posted: Tue Sep 24, 2013 8:24 am
by narcis
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.

Re: Export a chart with multiple pages

Posted: Tue Sep 24, 2013 2:45 pm
by 16461717
Hello,

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

Regards,
Rikki