Series.ChangeType(ChartType) Method
Changes the chart type used to plot the series.
Namespace: DevExpress.Spreadsheet.Charts
Assembly: DevExpress.Spreadsheet.v24.1.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Parameters
Name | Type | Description |
---|---|---|
chartType | ChartType | A ChartType enumeration specifying the chart type used to plot the series. |
Remarks
The chart type used to plot the series (Series.SeriesType) is the same as the ChartView.ViewType of the Series.View to which a series belongs. When the ChangeType changes the series type, it also creates a new ChartView if the view of the specified type does not exist, or moves the series to an existing view of the same type.
Note
The series with the changed chart type has display priority over other series. If the modified series cannot be displayed in the combination chart with other series, the chart displays a view containing this series only.
Worksheet worksheet = workbook.Worksheets["chartTask5"];
workbook.Worksheets.ActiveWorksheet = worksheet;
// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.LineMarker, worksheet["B2:D8"]);
chart.TopLeftCell = worksheet.Cells["F2"];
chart.BottomRightCell = worksheet.Cells["L15"];
// Change the type of the second series.
chart.Series[1].ChangeType(ChartType.ColumnClustered);
// Use the secondary axis.
chart.Series[1].AxisGroup = AxisGroup.Secondary;
// Specify the position of the legend.
chart.Legend.Position = LegendPosition.Top;
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ChangeType(ChartType) 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.