Hi every one,
In order to pan and zoom the graph (from the example https://www.scichart.com/wpf-chart-example-pan-on-mouse-drag/ ), I used MouseWheelZoomModifier for zooming and ZoomPanModifier for panning.
The code is as below:
<s:ZoomPanModifier x:Name="zoomPanModifier" ClipModeX="ClipAtExtents" ExecuteOn="MouseLeftButton" IsEnabled="True" /> </s:ModifierGroup>
However, when I zoom out the graph and pan it horizontally, the graph auto stretch (auto zooming). That is not what I expected, I want disable this feature but I have no idea how to do it.
When the MouseWheel zooms out beyond the VisibleRange of the series, then you use ZoomPanModifier, it clips to extents (by design). This is why you see the jumping.
You have two solutions:
Prevent MouseWheelZoomModifier from zooming outside the range of the data. To do this, you can follow the steps from the scichart documentation on clipping visible range. I would recommend the technique from “Clipping Axis.VisibleRange in Code”
You can write your own ZoomPanModifier to have the behaviour you desire. To do this, follow the steps from our tutorial on Creating a Custom Zoom Pan Modifier. You would need to detect if outside the Axis.DataRange and prevent panning.
These are the only ways to achieve what you want at the moment.
Thanks for your answer. For the solutions I still have some consideration:
P/S: I see that we also have XAxisDragModifier, could it be the pan modifier? At the moment I don’t know how to make it work.
Please login first to submit.