Zoom out action event?

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
cwodarczyk82
Posts: 43
Joined: Mon Oct 19, 2015 2:50 am

Zoom out action event?

Post by cwodarczyk82 » Thu Dec 03, 2015 10:10 pm

I am currently hooking into and using the Zoomed event which fires during a Zoom to manually adjust certain things like the bar's width on my bar graph.. We mainly are only using the action that occurs on dragging the mouse from left to right across the graph.

However, I just noticed there is an opposing event which happens when you drag the mouse from right to left... I want to hook into this to properly reset everything when the scale goes back to the original value, but I can't determine which thing I would hook into to detect this? Currently, none of the events I am registered for fire (Zoom, SizeChanged)...

We already have in place the functionality to restore a zoom through another mechanism, but the users would like the right to left zoom out to work the same way... is there an event to hook into that would allow us to use that functionality to undo the zoom?

Thanks
--Chris

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Zoom out action event?

Post by ArctionPasi » Fri Dec 04, 2015 3:04 pm

Hi Chris,

So... have you set ViewXY.ZoomPanOptions.RightToLeftZoomAction to something else than the default, FitView?

In FitView case, the Zoomed event is not fired.

But maybe you want to use RightToLeftZoomAction = RevertAxisRanges, which restores axis.RangeRevertMinimum and RangeRevertMaximum values as axis range.

BeforeZooming can be used to limit/set custom scale of the view too. See http://www.arction.com/forum/viewtopic. ... 694&p=2564. That you can utilize for example when setting RightToLeftZoomAction = ZoomOut.

And... you can of course set MouseDown/Up handlers for the chart, and store the mouse screen coordinate on MouseDown. On MouseUp, compare if current mouse coordinate < mouse down coordinate.
LightningChart Support Team, PT

cwodarczyk82
Posts: 43
Joined: Mon Oct 19, 2015 2:50 am

Re: Zoom out action event?

Post by cwodarczyk82 » Fri Dec 04, 2015 8:00 pm

Hi, Pasi:

Thanks for the reply... I have tried the case of the PopStack style where it is kind of a cool idea to pop off the last known scale...

However, I have a hesitation to use it until I am sure I know what is going on in a certain case... if I zoom in a few times, then click on one of our buttons which causes the chart to eventually call FitView(), I noticed when I zoom out again with the right mouse drag event, the Zoom event fires for each time I zoomed in... does the stack keeping track of that get cleared when a FitView() is called? If not, is there a way to clear it? My reason for asking is, I would be worried about eventual stack overflow if the stack wasn't cleared on a FitView call, and we just keep zooming in throughout the program...

The other way I am trying is to just set it to zoom out, and when I see it if the first zoom out, I just reset everything back to default...

I also noticed if I call FitView() inside the Zoom event, it causes a NullReferenceException... am I supposed to avoid calling that inside the Zoom event?

Thanks!
--Chris

ArctionTero
Posts: 42
Joined: Thu Mar 28, 2013 9:20 am

Re: Zoom out action event?

Post by ArctionTero » Tue Dec 08, 2015 2:20 pm

Hi Chris,

There is no method to clear zoom stack. We probably need to add one.

For now you should keep track of zoomed events and call ViewXY.Zoom() method with stopX < startX for it to clear the stack. Sorry for inconvenience.

I tried FitView() in ViewXY.BeforeZooming and ViewXY.Zoomed events and didn't detect any crash. Do you have the latest version of the chart?
LightningChart Support Team, TK

cwodarczyk82
Posts: 43
Joined: Mon Oct 19, 2015 2:50 am

Re: Zoom out action event?

Post by cwodarczyk82 » Tue Dec 08, 2015 3:24 pm

Hi, Tero:

Thank you for the reply...

That is ok about the stack... we are either going to have the right click zoom action be either disabled completely or use ZoomOut and then detect if the zoom event is being called with a zoom out (the ranges passed into the event increase from the last time..) and when that happens, we will just call FitView along with our additional margin paddings we use (we add additional padding to the sides of the graph when we 'fitview', which is why we need to intercept when this happens...). Otherwise, we might even just disable it... but waiting for the decision from higher ups on that ... :D

It would be nice to have the ability to clear the zoom stack... oh well, maybe in the future...

Weird about it not crashing in FitView() for you when calling it from the Zoomed event... not sure what is going on then... for now, I am adding a flag to handle the FitView later, and I check that flag in AfterRendering, and call FitView() there if this pending flag is set... seems to work ok for now...

Thanks!
--Chris

Post Reply