Pan chart with scrollbars
Posted: Thu Jul 26, 2012 10:36 am
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.
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.