WPF Charting Documentation - SciChart WPF Charts SDK v5.x
Linear Trendline, Polynomial Trendline Filters

Linear Trendline Filter

The Linear Trendline filter calculates a straight line best-fit for your DataSeries. This can then be plotted as a line series on the chart.

To calculate a Linear Trendline use the following code.

Offset Filter
Copy Code
using SciChart.Charting.Model.Filters; // Required for extension method .ToLinearTrendline()

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

var trendlineDataSeries = dataSeries.ToLinearTrendline(); // Compute the trendline.

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

Polynomial Trendline Filter

The Polynomial Trendline filter calculates an N-order polynomial trend for your DataSeries. This can then be plotter as a line series on the chart.

To calculate a 3rd-order Polynomial Trendline use the following code.

Offset Filter
Copy Code
using SciChart.Charting.Model.Filters; // Required for extension method .ToPolynomialTrendline()

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

int order = 3;
var trendlineDataSeries = dataSeries.ToPolynomialTrendline(3); // Compute the trendline.

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

 

 


SCICHART ® is a Registered Trademark in the UK, US and EU. Copyright SciChart Ltd 2011-2018.

Email us to give feedback!