TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
-
W3771M
- Newbie
- Posts: 1
- Joined: Wed Jan 02, 2013 12:00 am
Post
by W3771M » Thu Jan 03, 2013 6:51 pm
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
-
Yeray
- Site Admin
- Posts: 9612
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Fri Jan 04, 2013 8:19 am
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.