SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components
Hey super helpful and awesome SciCharts gurus,
I’m trying to create a graph that has usable data in a specific range, say 80-100, and I’m wondering if there is a way to lock the y axis range absolutely? This would override any kind of updating that ZoomPan or other modifiers might try to do.
Yes, there is a way to do this.
Check out the ViewPortManager feature. This is a back-door API into the chart which allows you to intercept VisibleRange changes during the render pass. If you create a custom DefaultViewportManagerBase and put breakpoints in the methods you will see where this is called – basically any time the chart renders.
You can keep a ViewportManager in your ViewModel and bind it to SciChartSurface.ViewportManager, that way when you append data or have a disconnection issue you could set a flag on your custom viewport manager to freeze the VisibleRange for a specific axis.
Also, you may not be aware but many of the modifiers have flags to restrict action to just X or just Y direction, e.g. see here: http://http://www.scichart.com/Abt.Controls.SciChart.SL.ExampleTestPage.html#/Abt.Controls.SciChart.Example;component/Examples/IWantTo/ZoomAndPanAChart/MouseDragToPanXOrY.xaml
I hope this helps!
Sounds to me all you need is to set Axis.AutoRange = AutoRange.Never, in combination with an Axis.VisibleRange.
Our default autorange method tries to range on startup then never does again. In most cases this is fine but ‘AutoRange.Never’ disables it.
Please login first to submit.