Page 1 of 1

Pan chart with scrollbars

Posted: Thu Jul 26, 2012 10:36 am
by 10055200
Hi,

I have a chart with some data on it. So here it is what I would like to have.

I am using chart mouse zoom events. When I zoom I would like to show bottom and right scrollbars to show custumer that he is seeing only zoomed part of chart but he can (with scrollbars) move around whole chart area. Similar like zooming functionality in different software (Word, Excel etc.. where you can scroll through zoomed page). So when zooming I would like to show scrollbars which are used to move (offset) zoomed part in ranges of unzoomed chart. How can I do this?

So far I made custom zoom history list. When I zoom I calculate position of new axes maximum/minimum values and store it to list. With this I can call ZoomRect with some Rect. So when I change eg. bootom scrollbar I just add dx (new val - prev val) to current zoom coordinates (left and right). I first call UndoZoom and afterwards I call ZoomRect with Rect + dx. This method actually works but the problem is that between calls UndoZoom and ZoomRect I need to call Chart.Repaint which results in screen flickering (which is kind a logical). So this method is actuall bad/useless approach.

I tried with some ScrollBy(dx, dy) but it moves chart and then suddenly resets position back to default. So this does not work.

What do you suggest? How can I do this manual scroll of zoomed area?

Thanks for your help.
Aljosa


p.s. I attached screenshots. First picture is unzoomed normal screen. Second picture is zoomed screen with scrollbars I would like to use. So when I change scrollbars this should move zoomed area in desired way.

Re: Pan chart with scrollbars

Posted: Fri Jul 27, 2012 9:13 am
by yeray
Hi Aljosa,

If the UndoZoom an ZoomRect functions don't work exactly as you wish, I'd suggest you to directly use the axes SetMinMax function to control the zoom and scroll.
If you find problems with it, please don't hesitate to let us know, arranging a simple example project we can run as-is to reproduce the situation.

Re: Pan chart with scrollbars

Posted: Mon Jul 30, 2012 9:12 am
by 10055200
Works perfectly! Thank you for the idea!

Br,
Aljosa