Legend windowshades when scrlbar and legendscrlbar connected

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
MVBobj
Newbie
Newbie
Posts: 34
Joined: Fri Jul 17, 2015 12:00 am
Contact:

Legend windowshades when scrlbar and legendscrlbar connected

Post by MVBobj » Fri Aug 28, 2015 6:21 pm

Hi,

I have a scrollbar at the bottom of my chart and a legend scrollbar on the chart legend. I have them connected with the code:
ChartTool1.Position := ScrollBar1.Position; in the ScrollBarChange event
and
ScrollBar1.Position := ChartTool1.Position; in the ChartToolScrolled event.

If there are more entries on the legend than there are items per page, the legend starts to shrink in height (windowshades) as the bottom scrollbar nears it's maximum until finally the total items on the legend equals the number of items per page.

At this point, dragging the legend scrollbar produces strange results - if I click-hold the legend scrollbar and move the mouse up, the legend increases in height with the bottom of the legend moving down along with the legend scrollbar while the mouse moves further away from the scrollbar until I am moving the legend scrollbar with the mouse inches away from the scrollbar instead of the mouse tracking the center as it should be doing.

Is there a way to synchronize these two scrollbars without this error?

Thanks.

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

Re: Legend windowshades when scrlbar and legendscrlbar connected

Post by Yeray » Mon Aug 31, 2015 8:26 am

Hello,

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

MVBobj
Newbie
Newbie
Posts: 34
Joined: Fri Jul 17, 2015 12:00 am
Contact:

Re: Legend windowshades when scrlbar and legendscrlbar connected

Post by MVBobj » Mon Aug 31, 2015 1:55 pm

Hi,

I enclose a simple example project to demonstrate this error.

Scroll the chart bottom scrollbar all the way to the right - observe what happens to the legend height after the legend scrollbar reaches it's bottom.

With the chart bottom scrollbar all the way to the right, click-hold the legend scrollbar and move the mouse up. This does not look right.

Is there a way to synchronize these two scrollbars without this error?

Is there any way to freeze the legend height to a specific height regardless of whether there are enough items in the legend to fill it?

Thanks.
.
Attachments
TeeChartLegend.zip
(3.29 KiB) Downloaded 595 times

MVBobj
Newbie
Newbie
Posts: 34
Joined: Fri Jul 17, 2015 12:00 am
Contact:

Re: Legend windowshades when scrlbar and legendscrlbar connected

Post by MVBobj » Mon Aug 31, 2015 3:45 pm

Hi,

I figured it out.

In the ScrollBarChange event, I changed:

ChartTool1.Position := ScrollBar1.Position;

to:

if (ScrollBar1.Position) < dbchart[0].count-((dbchart.Legend.LastValue - dbchart.Legend.FirstValue)) then
ChartTool1.Position := ScrollBar1.Position;

The problem was that I wasn't checking this and the legend scrollbar was being incremented after it had reached it's max.

I think this is a bug - but I have a workaround.

Thanks.
.

Post Reply