Zoom cancel

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
jval
Posts: 40
Joined: Mon May 04, 2015 1:46 pm

Zoom cancel

Post by jval » Mon Jun 22, 2015 2:04 pm

Hello.
It's a simple question but.. how can I cancel zooming?
I did Zoom(...) and after some user actions I want to return to original view.
Or I select region on graph and after some action want to return to original view..
I've found RevertAxisRanges and PopFromZoomStack but I'm not sure that it is right way.
Thank you.

ArctionJari

Re: Zoom cancel

Post by ArctionJari » Tue Jun 23, 2015 6:40 am

Range reverting might be the best choice for you. Just set ViewXY.ZoomPanOptions.RightToLeftZoomAction to RevertAxisRange and update axis' RangeRevertMinimum and RangeRevertMaximun properties after each range change so that chart knows where to revert next when right-to-left zooming is performed.

jval
Posts: 40
Joined: Mon May 04, 2015 1:46 pm

Re: Zoom cancel

Post by jval » Tue Jun 23, 2015 9:04 am

ArctionJari wrote:Range reverting might be the best choice for you. Just set ViewXY.ZoomPanOptions.RightToLeftZoomAction to RevertAxisRange and update axis' RangeRevertMinimum and RangeRevertMaximun properties after each range change so that chart knows where to revert next when right-to-left zooming is performed.
Ok, thank you. But if I use Zoom() method and don't want to use RightToLeft... LeftToRight... operations what is the best way to revert zooming?

And additional questionы :)
If I get rectangle coordinates for Zoom(x1, y1, x2, y2) but want to zoom only X or Y direction how can I do it (get xMax coordinate and xMin coordinate for graph or Ymax/Ymin )?

When I selected area for zooming with mouse I want to zoom after some asynchronous actions (getting answer from another application etc.). So I set Cancel to False in OnBeforeZooming() and call Zoom(...) in my other function (which called by another app). It is possible not to remove rectangle (for zooming area) after OnBeforeZooming() and remove it after my call of Zoom() function?

Thank you.

ArctionJari

Re: Zoom cancel

Post by ArctionJari » Fri Jun 26, 2015 8:38 am

How about storing range revert min/max as I wrote and use those values with SetRange method instead of Zoom method? This should work if you don't want to use mouse for zooming. Or actually you can store the values in your own variables for clarity. Which way feels more natural.

Use X or Y axis' Minimum and Maximum values for Zoom method. I.e. if you want to only zoom Y direction, use X Minimum for startX and X Maximum for stopX. Then your values for startY and StopY. This will "squeeze" the view vertically but keeps original X range. Same logic for squeezing horizontally.

Zooming rectangle is automatically hidden so you cannot change its behavior. How about hiding the real zooming rectangle (set fill and line color to transparent) and using an annotation (no fill, no shadow etc. and line style in dashes) as your "custom" zooming rectangle which you can leave visible while background work is being done and hide it when you call Zoom method?

jval
Posts: 40
Joined: Mon May 04, 2015 1:46 pm

Re: Zoom cancel

Post by jval » Fri Jun 26, 2015 2:29 pm

ArctionJari wrote:How about storing range revert min/max as I wrote and use those values with SetRange method instead of Zoom method? This should work if you don't want to use mouse for zooming. Or actually you can store the values in your own variables for clarity. Which way feels more natural.

Use X or Y axis' Minimum and Maximum values for Zoom method. I.e. if you want to only zoom Y direction, use X Minimum for startX and X Maximum for stopX. Then your values for startY and StopY. This will "squeeze" the view vertically but keeps original X range. Same logic for squeezing horizontally.

Zooming rectangle is automatically hidden so you cannot change its behavior. How about hiding the real zooming rectangle (set fill and line color to transparent) and using an annotation (no fill, no shadow etc. and line style in dashes) as your "custom" zooming rectangle which you can leave visible while background work is being done and hide it when you call Zoom method?
Thank you. I did something like your suggestions.

Post Reply