Recent

Author Topic: FortesReport TAChart  (Read 4647 times)

anis2505

  • Full Member
  • ***
  • Posts: 201
FortesReport TAChart
« on: May 21, 2014, 09:48:37 am »
Hi,

I'm trying to show a chart on a fortesreport report.
I'v put a RLPanel and I put a TAChart in it.

But
When I preview the report the TAChart is Black. nothing in it only a black rectangle instead of it.

Please Help.

I tried it on Linux and Windows7 with Laz 1.2.2
Dear Confucius you said {A picture is worth a thousand words}
I say {a good example is worth a thousand words}

wp

  • Hero Member
  • *****
  • Posts: 11855
Re: FortesReport TAChart
« Reply #1 on: May 21, 2014, 01:15:07 pm »
Unfortunately, I don't know fortesreport. So let's go step by step:

When you have your chart on a standard panel, outside the report, or in a standard form, is the chart showing fine? If yes, the issue is not your chart drawing code.

Next, you should look at the sample demo in (lazarus)\components\tachart\demo\lazreport. This is a demo for the integration of TAChart into lazreport. The main idea is that you repaint the chart on a bitmap which you show in an image component of the report. This is pretty universal and should work also with fortesreport.


fredbrastux

  • New Member
  • *
  • Posts: 12
Re: FortesReport TAChart
« Reply #2 on: May 21, 2014, 03:08:27 pm »
You must insert a TRLimage component in report. Before print or preview it, you can put the TAChart with this code :
var
  bmp: TBitmap;
  trelimp : tform_imp;
begin

 trelimp:=tform_imp.create(self);

 bmp := TBitmap.Create;
    try
      bmp.Width := Round(trelimp.im1.Width);
      bmp.Height := Round(trelimp.im1.Height);
      Chart1.PaintOnCanvas(
        bmp.Canvas, Rect(0, 0, bmp.Width, bmp.Height));
      trelimp.im1.Picture.Bitmap.Assign(bmp);
    finally
      bmp.Free;
    end;
 
// im1 is the name of my TRLimage in report

// r1 is the name of my report

             trelimp.r1.Prepare;

            {$IFDEF UNIX}
            trelimp.r1.PreviewModal;
            {$ENDIF}

            {$IFDEF WINDOWS}
            trelimp.r1.Preview(nil);
            {$ENDIF}


            trelimp.Release;
end; 

fredbrastux

  • New Member
  • *
  • Posts: 12
Re: FortesReport TAChart
« Reply #3 on: May 21, 2014, 03:26:40 pm »
I'm posting some images about TAChar into FortesReport.

 

TinyPortal © 2005-2018