Back to Devexpress

SeriesCollection.RemoveAt(Int32) Method

officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-seriescollection-dot-removeat-x28-system-dot-int32-x29.md

latest5.1 KB
Original Source

SeriesCollection.RemoveAt(Int32) Method

Removes the element at the specified index of the SeriesCollection instance.

Namespace : DevExpress.Spreadsheet.Charts

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
void RemoveAt(
    int index
)
vb
Sub RemoveAt(
    index As Integer
)

Parameters

NameTypeDescription
indexInt32

A zero-based integer specifying the index of the object to remove. If it’s negative or exceeds the number of elements, an exception is raised.

|

Example

The example below demonstrates how to remove the second series from the chart.

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

// Remove the series.
chart.Series.RemoveAt(1);
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, worksheet("B2:E6"))
chart.TopLeftCell = worksheet.Cells("H2")
chart.BottomRightCell = worksheet.Cells("N14")

' Remove the series.
chart.Series.RemoveAt(1)

The following code snippets (auto-collected from DevExpress Examples) contain references to the RemoveAt(Int32) 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/SeriesActions.cs#L22

csharp
// Remove the series.
chart.Series.RemoveAt(1);

winforms-spreadsheet-chart-api/CS/SpreadsheetChartAPISamples/CodeExamples/SeriesActions.cs#L22

csharp
// Remove the series.
chart.Series.RemoveAt(1);

spreadsheet-document-api-chart-examples/CS/SpreadsheetDocServerChartAPISamples/CodeExamples/SeriesActions.cs#L26

csharp
// Remove the series.
chart.Series.RemoveAt(1);

wpf-spreadsheet-chart-api/VB/SpreadsheetWPFChartAPISamples/CodeExamples/SeriesActions.vb#L26

vb
' Remove the series.
chart.Series.RemoveAt(1)

winforms-spreadsheet-chart-api/VB/SpreadsheetChartAPISamples/CodeExamples/SeriesActions.vb#L25

vb
' Remove the series.
chart.Series.RemoveAt(1)

spreadsheet-document-api-chart-examples/VB/SpreadsheetDocServerChartAPISamples/CodeExamples/SeriesActions.vb#L28

vb
' Remove the series.
            chart.Series.RemoveAt(1)
#End Region ' #RemoveSeries

See Also

SeriesCollection Interface

SeriesCollection Members

DevExpress.Spreadsheet.Charts Namespace