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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

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.