Pre loader

Bind sciChart to Data using MVVM

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

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.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies