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.
- Quan Tran asked 8 years ago
- You must login to post comments
Hi @Andrew,
Thanks for your answer. For the solutions I still have some consideration:
- I don’t want to prevent MouseWheelZoomModifier from zooming outside the range of the data. It’s my expectation.
- When I used function Scroll(), it still automatically zoom in with any ClipMode. And I don’t want to limit then DataRange of it.
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.
- Quan Tran answered 8 years ago
-
It clips even when you call AxisBase.Scroll(pixels, ClipMode.None)?
-
Yes, indeed.
- You must login to post comments
Hi Quan,
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.
Best regards,
Andrew
- Andrew Burnett-Thompson answered 8 years ago
-
Hi Andrew, Thanks for your answer. For the solutions I still have some consideration: 1. I don’t want to prevent MouseWheelZoomModifier from zooming outside the range of the data. It’s my expectation. 2. When I used function Scroll(), it still automatically zoom in with any ClipMode. And I don’t want to limit then DataRange of it. 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.
- You must login to post comments
Please login first to submit.