Export a chart with multiple pages
Posted: 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
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;