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

0
0

Dear all,

I am checking in chart demo sample how to use mvvm to bind the chart to a datasource for the series.

I have seen in the constructor of the viewmodel that an instance of ViewportMnager is created as below :

ViewportManager = new DefaultViewportManager();

Then it is used in the folloying methods :

    // Called when the AppendDataCommand is invoked via button click on the view
    private void AppendData()
    {
        var newData = _dataSource.GetRandomWalkSeries(50);

        _dataSeries0.Append(newData.XData, newData.YData);
        ViewportManager.ZoomExtents();
    }

Could you pleas explain what this viewport is doing and what will happen if ZoomExtends() is not called here ?

Version
4
  • You must to post comments
0
0

Documentation for the ViewportManager is here.

ViewportManager – Full Control over Axis VisibleRanges and the Viewport

The ViewportManager API provides fine-grained control over the SciChartSurface viewport, allowing you to configure the result of VisibleRange calculations on a per-axis basis, invalidate the chart from a ViewModel and call methods like ZoomExtents() programmatically from a ViewModel.

As for what ViewportManager.ZoomExtents() does, see here.

“Zooms the chart to the extents of the data, plus any X or Y Grow By fraction set on the X and Y Axes”

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.