Page 1 of 1

Report Builder Compatibility

Posted: Thu Jan 03, 2013 6:51 pm
by 17564570
After upgrading to the 2012 version of TeeChart the functionality of printing to ReportBuilder is not working anymore.

The source code in Report builder to paint a chart to a report (that does not work) is as follows:

Code: Select all

    
   pmBitmap:
      begin
        lBitmap := TBitmap.Create;

        lBitmap.Height := spHeight;
        lBitmap.Width := spWidth;
 
        FChart.Draw(lBitmap.Canvas, lRect);
 
        lDrawCommand.Picture.Graphic := lBitmap;
 
        lBitmap.Free;
 
      end;
This, however, does.

Code: Select all

lDrawCommand.Picture.Graphic := FChart.TeeCreateBitmap(clWhite,lRect); 
Did you change the FChart.Draw() function from 2011 to 2012 version?
Do I need to specify anything else for the code to work?

Kind regards,
Willem Louw

Re: Report Builder Compatibility

Posted: Fri Jan 04, 2013 8:19 am
by yeray
Hi Willem,

Using the following code, doing basically the same you posted but showing the bitmap in a TImage, works fine for me here out of Report Builder:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var lBitmap: TBitmap;
begin
  Chart1.AddSeries(TBarSeries).FillSampleValues;
  Chart1.Draw;

  lBitmap := TBitmap.Create;
  lBitmap.Height := Chart1.Height;
  lBitmap.Width := Chart1.Width;
  Chart1.Draw(lBitmap.Canvas, Chart1.ChartBounds);
  Image1.Picture.Bitmap:=lBitmap;
  lBitmap.Free;
end;
I've just dropped a TChart and a TImage on the form at design time.