Back to Devexpress

ChartObject.Series Property

officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-chartobject-08532a20.md

latest3.1 KB
Original Source

ChartObject.Series Property

Provides access to the collection of Series objects.

Namespace : DevExpress.Spreadsheet.Charts

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
SeriesCollection Series { get; }
vb
ReadOnly Property Series As SeriesCollection

Property Value

TypeDescription
SeriesCollection

A SeriesCollection object that is the collection of all data series.

|

Remarks

The Series property provides access to a collection of all data series of the chart. You can add or delete an individual series (an instance of the Series class) and use indexer notation to access it.

The series are created automatically when the ChartObject.SelectData method is used to provide data for a chart. However, you can add series manually, to specify data in a complex cell range or to use literal data.

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.ColumnClustered);
chart.TopLeftCell = worksheet.Cells["H2"];
chart.BottomRightCell = worksheet.Cells["N14"];

// 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"]);
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.ColumnClustered)
chart.TopLeftCell = worksheet.Cells("H2")
chart.BottomRightCell = worksheet.Cells("N14")

' 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

ChartObject Interface

ChartObject Members

DevExpress.Spreadsheet.Charts Namespace