Back to Devexpress

SeriesCollection.Add(CellRange, CellRange, CellRange) Method

officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-seriescollection-dot-add-x28-devexpress-dot-spreadsheet-dot-cellrange-devexpress-dot-spreadsheet-dot-cellrange-devexpress-dot-spreadsheet-dot-cellrange-x29.md

latest6.3 KB
Original Source

SeriesCollection.Add(CellRange, CellRange, CellRange) Method

Appends a new series with the specified name to the collection and provides data for series arguments and series values.

Namespace : DevExpress.Spreadsheet.Charts

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
Series Add(
    CellRange seriesName,
    CellRange arguments,
    CellRange values
)
vb
Function Add(
    seriesName As CellRange,
    arguments As CellRange,
    values As CellRange
) As Series

Parameters

NameTypeDescription
seriesNameCellRange

A string that is the name of the series.

| | arguments | CellRange |

A CellRange of cells containing data to plot as series arguments.

| | values | CellRange |

A CellRange of cells containing data to plot as series values.

|

Returns

TypeDescription
Series

A Series object that is the newly created series.

|

Remarks

The Add method adds a series with the same Series.SeriesType as the ChartView.ViewType of the chart view to which a series collection belongs. If the ChartObject.Series property is used to obtain a series collection and the chart is composed of several views, the type of the chart view with the highest index is used.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Add(CellRange, CellRange, CellRange) method.

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.

wpf-spreadsheet-chart-api/CS/SpreadsheetWPFChartAPISamples/CodeExamples/CreationAndDataActions.cs#L77

csharp
// Add chart series using worksheet ranges as the data sources.
chart.Series.Add(worksheet["D2"], worksheet["B3:B6"], worksheet["D3:D6"]);
chart.Series.Add(worksheet["F2"], worksheet["B3:B6"], worksheet["F3:F6"]);

winforms-spreadsheet-chart-api/CS/SpreadsheetChartAPISamples/CodeExamples/CreationAndDataActions.cs#L77

csharp
// Add chart series using worksheet ranges as the data sources.
chart.Series.Add(worksheet["D2"], worksheet["B3:B6"], worksheet["D3:D6"]);
chart.Series.Add(worksheet["F2"], worksheet["B3:B6"], worksheet["F3:F6"]);

spreadsheet-document-api-chart-examples/CS/SpreadsheetDocServerChartAPISamples/CodeExamples/CreationAndDataActions.cs#L86

csharp
// Add chart series using worksheet ranges as the data sources.
chart.Series.Add(worksheet["D2"], worksheet["B3:B6"], worksheet["D3:D6"]);
chart.Series.Add(worksheet["F2"], worksheet["B3:B6"], worksheet["F3:F6"]);

wpf-spreadsheet-chart-api/VB/SpreadsheetWPFChartAPISamples/CodeExamples/CreationAndDataActions.vb#L80

vb
' Add chart series using worksheet ranges as the data sources.
chart.Series.Add(worksheet("D2"), worksheet("B3:B6"), worksheet("D3:D6"))
chart.Series.Add(worksheet("F2"), worksheet("B3:B6"), worksheet("F3:F6"))

winforms-spreadsheet-chart-api/VB/SpreadsheetChartAPISamples/CodeExamples/CreationAndDataActions.vb#L79

vb
' Add chart series using worksheet ranges as the data sources.
chart.Series.Add(worksheet("D2"), worksheet("B3:B6"), worksheet("D3:D6"))
chart.Series.Add(worksheet("F2"), worksheet("B3:B6"), worksheet("F3:F6"))

spreadsheet-document-api-chart-examples/VB/SpreadsheetDocServerChartAPISamples/CodeExamples/CreationAndDataActions.vb#L80

vb
' Add chart series using worksheet ranges as the data sources.
chart.Series.Add(worksheet("D2"), worksheet("B3:B6"), worksheet("D3:D6"))
chart.Series.Add(worksheet("F2"), worksheet("B3:B6"), worksheet("F3:F6"))

See Also

SeriesCollection Interface

SeriesCollection Members

DevExpress.Spreadsheet.Charts Namespace