Dear all,
I have define a button bind to a command in order to reset the zoom to fit the chart viewport.
For that I try to use the follying code :
private void ResetZoomCmd(object arg)
{
//ZoomExtents();
if (ViewportManager!=null)
ViewportManager.ZoomExtents();
}
But it has no effect, I have try also AnimatedZoomExtend command with same result.
What is the way to do ?
- sc sc asked 6 years ago
- You must login to post comments
private void ZoomExtentesClicked(object sender, RoutedEventArgs e) { MySciChartSurface.AnimateZoomExtents(TimeSpan.FromMilliseconds(300)); }
- Anton Zaleev answered 6 years ago
-
I want to do it from a MVVM model command without refering directly the sciChqrtSurface object in my code behind. Possible ?
- You must login to post comments
Any dataseries has the method InvalidateParentSurface(RangeMode.ZoomToFit) which you can use to force a redraw and zoom to fit from the ViewModel.
You can also control the SciChartSurface from a ViewportManager instance hosted in your viewmodel.
- Andrew Burnett-Thompson answered 6 years ago
-
Hi ANdrew, thanks for your reply. I have try the folloying : if (ViewportManager!=null) ViewportManager.ZoomExtents(); with no help
-
Hi Andew, I have tried what you suggest by using the InvalidateParentSurface(RangeMode.ZoomToFit) after updating my data series or using the Viewportmanager.ZoomExtents, both solution have no effect after updating my series. the only way which works is to call the ZoomExtend directly from chartsurface instance. Any idea about reason ?
-
Have a look at this example: https://www.scichart.com/example/wpf-chart-example-dashboard-style-charts. We actually use ViewportManager.ZoomExtents in DashboardStyleChartsViewModel.cs to zoom to fit after data change.
- You must login to post comments
Please login first to submit.