Search code examples
delphiexportdelphi-6teecharttbitmap

How do I export the TChart to the bitmap?


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!


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.