Pre loader

Is there a way for the ViewModel to know if the user has Zoomed on the dataplot?

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
0
0

I manually re-calculate my displayed axis ranges when new data points are appended or when a specific portion of the data is selected to view from a ListBox, but I would like to leave the axis ranges as-is if the user has zoomed-in (using the built-in ZoomModifiers). Is there a way for my ViewModel to know this has happened so I can avoid recalculating in that case?

Thanks!

Version
4.0.6.8583
  • You must to post comments
Best Answer
1
0

Hi Matthew,

So you want to have an event / know when a user has zoomed via dragging / panning but NOT if the axis range is changed programmatically, is that right?

Well, one way is to override one of our zoom modifiers and add an event. For instance, see How to detect when zoom Rubberband zoom opertion has occured or Event after zoom in. Does that help?

Most of our modifiers override one or more mouse methods, such as

  • RubberbandXyZoomModifier uses OnModifierMouseUp to complete the zoom
  • ZoomPanModifier uses OnModifierMouseMove and OnModifierMouseUp to complete the zoom
  • ZoomExtentsModifier uses OnModifierDoubleClick to perform the zoom.

Finally, if you do override these methods you can add an event, and use EventToCommand to send the message to a Viewmodel.

Does it help?

Best regards,
Andrew

  • Matthew Becker
    Inthe RubberBandXyModifier, I’ve tried adding an EventTrigger on “MouseUp” to call my ViewModel command function, but it doesn’t seem to trigger at all. Should this be working like this or am I doing something wrong? Thanks!
  • Andrew Burnett-Thompson
    Hi Matthew, that won’t work! You need to subclass RubberBandXyZoomModifier and override OnModifierMouseUp and add your own event or mechanism to call to view model . Best regards, Andrew
  • Matthew Becker
    I’m almost there… I’ve got the custom ZoomModifiers sending an event that the ViewModel handles now. But one more problem. When I double-click for a ZoomExtents, instead it triggers two RubberBand MouseUp events and I never get the ZoomExtents DoubleClick event. Do I need to add something in my custom RubberBand Modifier to prevent this? Thanks!
  • Matthew Becker
    Didn’t have the ZoomModifier event handler in place, but even with it in place, it still receives a RubberBand MouseUp, the ZoomExtents DoubleClick, and then another RubberBand MouseUp…
  • Matthew Becker
    I think the more accurate question is: Is there a way for me to know if the base RubberBandXyZoomModifer.OnModifierMouseUp() actually was successful so I know to send my corresponding event? (Since if the mouse only moves a small amount, the rubberband zoom won’t occur…)
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies