Back to Devexpress

Series.Trendlines Property

officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-series-de581e12.md

latest6.0 KB
Original Source

Series.Trendlines Property

Provides access to a collection of trendlines for the series.

Namespace : DevExpress.Spreadsheet.Charts

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
TrendlineCollection Trendlines { get; }
vb
ReadOnly Property Trendlines As TrendlineCollection

Property Value

TypeDescription
TrendlineCollection

A TrendlineCollection object that is the collection of all the Trendline objects for the series.

|

Remarks

The following code uses the TrendlineCollection.Add method to display a trendline of the ChartTrendlineType.Polynomial type. The result is opened in Microsoft Excel.

View Example

csharp
Worksheet worksheet = workbook.Worksheets["chartTask3"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.ColumnStacked);
chart.SelectData(worksheet["C2:F3"], ChartDataDirection.Row);
chart.TopLeftCell = worksheet.Cells["H2"];
chart.BottomRightCell = worksheet.Cells["N14"];

// Show data labels.
chart.Views[0].DataLabels.ShowValue = true;

// Display a polynomial trendline.
chart.Series[0].Trendlines.Add(ChartTrendlineType.Polynomial);
vb
Dim worksheet As Worksheet = workbook.Worksheets("chartTask3")
workbook.Worksheets.ActiveWorksheet = worksheet

' Create a chart and specify its location.
Dim chart As Chart = worksheet.Charts.Add(ChartType.ColumnStacked)
chart.SelectData(worksheet("C2:F3"), ChartDataDirection.Row)
chart.TopLeftCell = worksheet.Cells("H2")
chart.BottomRightCell = worksheet.Cells("N14")

' Show data labels.
chart.Views(0).DataLabels.ShowValue = True

' Display a polynomial trendline.
chart.Series(0).Trendlines.Add(ChartTrendlineType.Polynomial)

The following code snippets (auto-collected from DevExpress Examples) contain references to the Trendlines property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

spreadsheet-document-api-chart-examples/CS/SpreadsheetDocServerChartAPISamples/CodeExamples/TrendlineActions.cs#L60

csharp
// Customize the trendline.
Trendline tline = chart.Series[0].Trendlines[0];
tline.DisplayEquation = true;

wpf-spreadsheet-chart-api/CS/SpreadsheetWPFChartAPISamples/CodeExamples/TrendlineActions.cs#L60

csharp
// Customize the trendline.
Trendline tline = chart.Series[0].Trendlines[0];
tline.DisplayEquation = true;

winforms-spreadsheet-chart-api/CS/SpreadsheetChartAPISamples/CodeExamples/TrendlineActions.cs#L60

csharp
// Customize the trendline.
Trendline tline = chart.Series[0].Trendlines[0];
tline.DisplayEquation = true;

spreadsheet-document-api-chart-examples/VB/SpreadsheetDocServerChartAPISamples/CodeExamples/TrendlineActions.vb#L61

vb
' Customize the trendline.
Dim tline As Trendline = chart.Series(0).Trendlines(0)
tline.DisplayEquation = True

wpf-spreadsheet-chart-api/VB/SpreadsheetWPFChartAPISamples/CodeExamples/TrendlineActions.vb#L56

vb
' Customize the trendline.
Dim tline As Trendline = chart.Series(0).Trendlines(0)
tline.DisplayEquation = True

winforms-spreadsheet-chart-api/VB/SpreadsheetChartAPISamples/CodeExamples/TrendlineActions.vb#L55

vb
'Customize the trendline.
Dim tline As Trendline = chart.Series(0).Trendlines(0)
tline.DisplayEquation = True

See Also

Series Interface

Series Members

DevExpress.Spreadsheet.Charts Namespace