SciChart WPF 2D Charts > MVVM API > MVVM DataSeries / RenderableSeries API
MVVM DataSeries / RenderableSeries API

SciChart features a rich, true MVVM API for manipulating DataSeries and RenderableSeries. This eclipses many other charts which only allow manipulation of series in the view or in code.

Anything you can achieve in code or XAML you can achieve in MVVM. Adding series, removing series, adding/updating data, changing series properties, changing point-markers, even applying styles can all be achieved with our MVVM API.

The SeriesBinding MarkupExtension

It all starts with the SeriesBinding MarkupExtension. This transforms a collection of IRenderableSeriesViewModel derived types into RenderableSeries for display on the chart.

XAML

The SeriesBinding MarkupExtension
Copy Code
<!-- Declare a SciChartSurface with SeriesBinding -->
<!-- Where xmlns:s="http://schemas.abtsoftware.co.uk/scichart -->
<s:SciChartSurface RenderableSeries="{s:SeriesBinding RenderableSeriesViewModels}">

   <!-- XAxis, YAxis omitted for brevity -->
  
</s:SciChartSurface>

ViewModel

ViewModel
Copy Code
private ObservableCollection<IRenderableSeriesViewModel> _renderSeriesViewModels;
public ObservableCollection<IRenderableSeriesViewModel> RenderableSeriesViewModels
{
   get { return _renderSeriesViewModels; }
   set
   {
      _renderSeriesViewModels = value;
         OnPropertyChanged("RenderableSeriesViewModels");
   }
}

Multi-Axis Charts

In SciChart, it is required that each Axis in a corresponding Axis Collection has a unique identifier. This is a string that can be provided via the IAxisViewModel.Id property. By default, all axes have a default Axis ID

For single-axis charts there is no need to set Axis Id. As soon as there is a secondary Axis, you need to start assigning IDs to all Axes in the corresponding Axis Collection.

In such multiple-axis scenarios, Renderable Series can be associated with a certain Axis. This is useful when multiple chart types are combined, or when some Renderable Series require individual scales. XAxisId and YAxisId properties of a Renderable Series are used to attach this Renderable Series to a specific X or Y Axis.

NOTE: By default, Renderable Series are associated with X and Y Axes that have the default axis ID. As soon as you set IAxisViewModel.Id on an Axis explicitly you must consider whether you need your Renderable Series to be associated with this Axis. If so, you need to update the XAxisId or YAxisId properties on all the Renderable Series in question.

IRenderableSeriesViewModel Derived Types

SciChart includes a number of IRenderableSeriesViewModel derived types. These include:

Adding, modifying or removing an instance of one of these ViewModels to a collection bound via SeriesBinding to the SciChartSurface will cause the series to be shown/modified.hidden on the SciChartSurface.