Draw Legend

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
fredff13
Newbie
Newbie
Posts: 5
Joined: Mon Oct 04, 2010 12:00 am

Draw Legend

Post by fredff13 » Mon Oct 11, 2010 3:35 pm

Hi,

After I downloaded update from October 5 for version 2010 I found a bug: the legend drawn after chart drawn event (see below) not fully covers old one. Old legend's first item above newly drawn legend items (I think that all other covered).

procedure TfrmMain.chartAfterDraw(Sender: TObject);
begin
(Sender As TChart).Legend.DrawLegend;
end;

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Draw Legend

Post by Yeray » Wed Oct 13, 2010 10:20 am

Hi fredff13,

I'm not sure to understand what are you exactly trying to do, and neither what is the exact difference in behaviour between versions you see.
Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

fredff13
Newbie
Newbie
Posts: 5
Joined: Mon Oct 04, 2010 12:00 am

Re: Draw Legend

Post by fredff13 » Wed Oct 13, 2010 6:05 pm

Hi, I set Legend.Visible to False to avoid drawing at position which not matching run-time one. It's still a bug as it has not been observed in previous version (legend was drawing on top of each other, so fully covered "visible" legend). See attached screen shots.

Thanks, Fred
DrawLegend.jpg
Drawing Legend with updated version
DrawLegend.jpg (191.29 KiB) Viewed 9023 times

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Draw Legend

Post by Narcís » Fri Oct 15, 2010 8:22 am

Hi fredff13,

As Yeray already asked, it would be very helpful for us to be able to provide an accurate answer if you could provide a simple example project we can run "as-is" to reproduce the problem here.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

fredff13
Newbie
Newbie
Posts: 5
Joined: Mon Oct 04, 2010 12:00 am

Re: Draw Legend

Post by fredff13 » Thu Oct 28, 2010 8:38 pm

I have attached simple project as you requested
Attachments
DrawLegend.zip
Issue with drawing legend after chart was drawn (overlapping)
(9.86 KiB) Downloaded 430 times

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Draw Legend

Post by Narcís » Tue Nov 02, 2010 9:07 am

Hi fredff13,

In which TeeChart version do you think this worked fine? Also, what are you trying to achieve with this? We may be able to provide an alternative solution.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

fredff13
Newbie
Newbie
Posts: 5
Joined: Mon Oct 04, 2010 12:00 am

Re: Draw Legend

Post by fredff13 » Tue Nov 02, 2010 3:10 pm

Hello, I just pointed to that version before the latest update has not such effect. Legend design-time position was the same as was drawn by DrawLegend function.

Thanks, Fred

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Draw Legend

Post by Narcís » Wed Nov 03, 2010 3:49 pm

Hi Fred,

Thanks for the information. I found that v2010.00.00407 worked as you expected while this behaviour changed in v2010.01.11004. I have added the issue to the defect list (TV52015261) to be investigated.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Draw Legend

Post by Narcís » Thu Dec 30, 2010 11:02 am

Hi Fred,

I just wanted to inform you that I have fixed this bug for the next TeeChart 2010 VCL maintenance release. If you are a source code customer you can implement the fix at your end doing a little change at Chart.pas. At TCustomChartLegend.DrawLegend method add tmpRect variable of TRect type and change this code:

Code: Select all

      with tmpChart.ChartRect do
        ShapeBounds.Top:=Top+tmp+Round(1.0*FTopLeftPos*(Bottom-Top-tmp)*0.01);
for this:

Code: Select all

      if {$IFNDEF CLR}TCustomChartAccess{$ENDIF}(ParentChart).CustomChartRect then
        tmpRect:=tmpChart.ChartRect
      else
        tmpRect:=tmpChart.ChartBounds;

      with tmpRect do
        ShapeBounds.Top:=Top+tmp+Round(1.0*FTopLeftPos*(Bottom-Top-tmp)*0.01);
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply