Restore / Save zoom levels

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

krafty wrote at 2013-03-27 07:33:

Morning all,

I have a requirement to save certain zoom levels on a graph which the user can undo...

Can we save the current zoom level for all the axes and then restore it (explicitly set them)?

Thanks.

mohitvashistha wrote at 2013-04-29 17:42:

Me too trying to achieve the same. Did you had any luck??

objo wrote at 2013-04-29 18:11:

Try to subscribe to the AxisChanged event on the axes (note this event is also raised when panning/resetting the axes), save the ActualMaximum and ActualMinimum properties. Call the Zoom(x0,x1) method to restore the view. It is possible zooming with the mouse wheel or zooming several axes may be difficult to revert (multiple events), maybe you can use a stopwatch to 'group' these events?

mohitvashistha wrote at 2013-04-29 20:17:

I have extended the control to store the zoom state on a stack and on all maniuplators started event I have pushed the zoom state. When I want to move to previous state I just pop a state and call the Zoom(axis,x0,x1) to set the previous state for the axis.

All my charts have two axis, for multiple axis one can store the axis and its current max and min.