SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

0
0

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 ?

Version
4
  • You must to post comments
0
0
    private void ZoomExtentesClicked(object sender, RoutedEventArgs e)
      {
          MySciChartSurface.AnimateZoomExtents(TimeSpan.FromMilliseconds(300));
      }
  
  • sc sc
    I want to do it from a MVVM model command without refering directly the sciChqrtSurface object in my code behind. Possible ?
  • You must to post comments
0
0

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.

  • sc sc
    Hi ANdrew, thanks for your reply. I have try the folloying :if (ViewportManager!=null)         ViewportManager.ZoomExtents();with no help
  • sc sc
    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 ?
  • Andrew
    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 to post comments
Showing 2 results
Your Answer

Please first to submit.