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 is no easy way to add an offset to a series in SciChart. It would be cool if we could provide a property, e.g. DataSeries.VerticalOffset, which would allow easy offsetting, but there are potential performance problems with this, as we would have to maintain two copies of the data and perform offsetting every time the DataSeries is read (often in the case of SciChart rendering).

Instead, if you wanted to offset a series you could achieve it with a few lines of code.

Say you declared a DataSeries and you kept a copy of the original Y data like so:

 double[] originalXData = {0.0, 1.0, 2.0, 3.0, 4.0};
 double[] originalYData = {1.0, 2.0, 3.0, 4.0, 5.0};
 var xyDataSeries = new XyDataSeries<double,double>();
 xyDataSeries.Append(originalXData, originalYData);

To offset all you would have to do is re-append the data with scaled Y-values like so:

 // To Offset
 double offset = 5.0;
 using (xyDataSeries.SuspendUpdates())
 xyDataSeries.Append(originalXData, originalYData.Select(y => y + offset));

Clear() / Append() should be a fast operation if you are calling it with less than millions of points.

(0 vote(s))
Not helpful

Comments (0)


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


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