Knowledgebase: Tips and Tricks
How to Offset a Series
Posted by Andrew BT on 07 May 2014 07:17 PM

Series Offsetting or Scaling

This gets asked a lot, so we created a short KB article on it.

There are two ways to do this with SciChart. The first one is to use the DataSeries API that allows to Insert or Update data points using appropriate methods. The second is to use the Filters API.

What is the Filters API?

This is a rich API that provides a way to create derived data, filters, indicators or perform functions on data easily and simply. There is a number of filters available out-of-the-box:

and others. Also there is a bunch of extension methods for convenient use of built-in filters.

Scale and Offset Filters

To offset a Data Series, use the following code:

using SciChart.Charting.Model.Filters; // Required for extension method .Offset()

var dataSeries = new XyDataSeries<double,double>(); // Original Data
dataSeries.Append(0,1);
dataSeries.Append(2,2);

var offsetDataSeries = dataSeries.Offset(10d); // Offset data.

var lineRenderableSeries = new FastLineRenderableSeries()
{
    DataSeries = offsetDataSeries, // Apply the Offset Data to a Line Series
}

 

To scale (multiply by a scalar) a Data Series, use the following code:

using SciChart.Charting.Model.Filters; // Required for extension method .Scale()

var dataSeries = new XyDataSeries<double,double>(); // Original Data
dataSeries.Append(0,1);
dataSeries.Append(2,2);

var scaledDataSeries = dataSeries.Scale(0.5d); // Scale data.

var lineRenderableSeries = new FastLineRenderableSeries()
{
    DataSeries = scaledDataSeries, // Apply the Scale Data to a Line Series
}

Further Reading

To learn more about the Filters in SciChart, please refer to our documentation:

There is a couple of examples available in the SciChart Examples Suite at 2D Charts -> Filters API:

(0 vote(s))
Helpful
Not helpful

Comments (0)

CONTACT US

Not sure where to start? Contact us, we are happy to help!


CONTACT US

SciChart Ltd, 16 Beaufort Court, Admirals Way, Docklands, London, E14 9XL. Email: Legal Company Number: 07430048, VAT Number: 101957725