SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

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
    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.