Page 1 of 1

Draw Legend

Posted: Mon Oct 11, 2010 3:35 pm
by 16557375
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;

Re: Draw Legend

Posted: Wed Oct 13, 2010 10:20 am
by yeray
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.

Re: Draw Legend

Posted: Wed Oct 13, 2010 6:05 pm
by 16557375
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 8970 times

Re: Draw Legend

Posted: Fri Oct 15, 2010 8:22 am
by narcis
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.

Re: Draw Legend

Posted: Thu Oct 28, 2010 8:38 pm
by 16557375
I have attached simple project as you requested

Re: Draw Legend

Posted: Tue Nov 02, 2010 9:07 am
by narcis
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.

Re: Draw Legend

Posted: Tue Nov 02, 2010 3:10 pm
by 16557375
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

Re: Draw Legend

Posted: Wed Nov 03, 2010 3:49 pm
by narcis
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.

Re: Draw Legend

Posted: Thu Dec 30, 2010 11:02 am
by narcis
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);