Question

I'm using TeeChart Pro v7.06 of Steema Software and Delphi 6. In my project there are TChart (whose BottomAxis.Automatic = False) and TChartScrollBar (to scroll). In TChart there are several series that don't fit in the width of TChart, so I use TChartScrollBar.

I need to export the chart to TBitmap. And I don't know how to do it because all TChart's methods that I know export only a visible part of TChart!

Are there any ways to export the whole TChart, not only the visible part?

Thanks!

Was it helpful?

Solution

If your chart has many pages, you can simply use the tchart.createteebitmap function, scrolling through all pages.

For example (pseudo-code)

For i:= 0 To chart.numpages-1 do
  Chart.pagenum := i;
  Chart.createteebitmap(bitmap);
End;

This will export all of the charts pages to separate bitmaps. If you only require 1 bitmap then you will need to manually export the charts canvas to a Metafile and then send it to the printer.

OTHER TIPS

If you are using the paging feature, you could disable it temporally to print the whole series and reset it again after printing. For example, having a TChart, a TChartScrollBar and a TButton on a form:

uses Series, TeeEdit;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;

  Chart1.AddSeries(TFastLineSeries).FillSampleValues(100);

  Chart1.Pages.MaxPointsPerPage:=10;

  ChartScrollBar1.Chart:=Chart1;
  ChartScrollBar1.Enabled:=true;
end;

procedure TForm1.Button1Click(Sender: TObject);
var tmpCount, tmpPage: Integer;
begin
  tmpCount:=Chart1.Pages.MaxPointsPerPage;
  tmpPage:=Chart1.Pages.Current;

  Chart1.Pages.MaxPointsPerPage:=Chart1[0].Count;

  with TChartPreviewer.Create(Self) do
  begin
    Chart:=Chart1;
    Execute;
  end;

  Chart1.Pages.MaxPointsPerPage:=tmpCount;
  Chart1.Pages.Current:=tmpPage;
end;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top