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!

0
0

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,

  • You must to post comments
0
0

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

  • Martin Long
    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 to post comments
0
0

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

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.