Hi,
I would like to be able to mimic the MouseWheelZoomModifier behavior programatically.
I have a slider control that I would like to zoom into the map. The same as the mouse wheel delta changes. I have a chart that has multiple Yaxis bound to the YAxes property of the SciChartSurface.
The mousewheezoommodifier works correctly, I just don’t know how to access the same functionality.
Thanks,
- Martin Long asked 10 years ago
- You must login to post comments
Hi there,
There are a number of ways to zoom the chart:
SciChartSurface.ZoomExtents() – programmatic zoom to extents
SciChartSurface.AnimateZoomExtents(TimeSpan duration) – programmatic animated zoom to extents
SciChartSurface.ZoomExtentsX/Y() – programmatic zoom to extents in the X/Y direction only
SciChartSurface.AnimateZoomExtentsX/Y(TimeSpan duration) – programmatic animated zoom to extents in the X/Y direction only
SciChartSurface.ZoomExtentsX/Y() – programmatic zoom to extents in the X/Y direction only
AxisBase.ZoomBy(double minFraction, double maxFraction) – programmatic zoom in/out on an axis
AxisBase.ZoomBy(double minFraction, double maxFraction, TimeSpan duration) – programmatic animated zoom in/out on an axis
AxisBase.ScrollBy(double pixelsToScroll, ClipMode clipping, TimeSpan duration) – programmatic animated scroll by amount of pixels
AxisBase.VisibleRange = … – set a VisibleRange to a specified amount
AxisBase.AnimatedVisibleRange = … – animate a VisibleRange to a specified amount over 500ms
These are just a few. For full details please see the documentation for AxisBase.
UPDATE 2014:
Please, refer to this article in our Knowledgebase: How to create zoom slider.
Best regards,
Andrew
- Andrew Burnett-Thompson answered 10 years ago
-
Thanks for the quick reply. What method does the MouseWheelZoomModifier use to zoom because this is the behavior I am after. I had tried a few of the methods above but was never able to duplicate the MouseWheelZoomModifier. Thanks
- You must login to post comments
Hi,
The MouseWheelZoomModifier uses these methods internally to perform zoom:
AxisBase.ZoomBy(double minFraction, double maxFraction) – programmatic zoom in/out on an axis
AxisBase.ZoomBy(double minFraction, double maxFraction, TimeSpan duration) – programmatic animated zoom in/out on an axis
Each fraction is calculated based on the mouse cursor position.
Alternatively, you could consider calling MouseWheelZoomModifier.OnModifierMouseWheel(..) with the mouse point set to chart’s ActualWidth/2, ActualHeight/2 and Delta set correspondingly to an offset of the Slider.
Also, we’ve had a few similar requests earlier, so we consider adding inbuilt way to do this in further versions.
Hope this helps!
Best regards,
Yuriy
- Yuriy Zadereckiy answered 10 years ago
- You must login to post comments
Please login first to submit.