Page 1 of 1

Source code change to procedure DrawLegendItem in Chart.pas

Posted: Tue Nov 06, 2007 7:07 pm
by 9350547
I found what I believe to be a bug in Chart.pas that affects the drawing of legend items when the legend is positioned at the top or bottom.

Change from:

if Vertical then
tmpSt:=Items[ItemOrder,t]
else
tmpSt:=Items[ItemOrder+(ITotalItems-ILastValue-1),t]; // v8 fix

Change to:

tmpSt:=Items[ItemOrder,t];

Because of the way that Items is populated, the same code should be used, regardless of the value of Vertical. The original code improperly displays the legend items, and can raise an exception when the FirstValue property is set.

Regards,

Bill

Posted: Wed Nov 07, 2007 8:32 am
by narcis
Hi Bill,

Could you please send us a simple example project we can run "as-is" to reproduce the bug here?

You can post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance!

Posted: Wed Nov 07, 2007 2:59 pm
by 9350547
I just uploaded ProjectChartTest.zip.

You will notice that everything works corectly when the legend is at the right, but incorrectly when the legend is at the bottom.

Once you apply my code change, it works correctly both ways.

Regards,

Bill