All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

ChartCollection.Add(ChartType, CellRange) Method

Creates a chart of the specified type with data from the specified range and adds the chart to the collection.

Namespace: DevExpress.Spreadsheet.Charts

Assembly: DevExpress.Spreadsheet.v21.1.Core.dll

Declaration

Chart Add(
    ChartType chartType,
    CellRange range
)

Parameters

Name Type Description
chartType ChartType

A ChartType enumeration member specifying the chart type.

range CellRange

A CellRange containing chart data.

Returns

Type Description
Chart

A Chart object that is the chart embedded in a worksheet.

Remarks

The example below demonstrates how to create a 3-D pie chart using the ChartCollection.Add method overload that enables you to specify a CellRange containing chart data.

Dim worksheet As Worksheet = workbook.Worksheets("chartTask1")
workbook.Worksheets.ActiveWorksheet = worksheet

' Create a pie chart and specify its location.
Dim chart As Chart = worksheet.Charts.Add(ChartType.Pie3D, worksheet("B2:C7"))
chart.TopLeftCell = worksheet.Cells("E2")
chart.BottomRightCell = worksheet.Cells("K15")

' Set the chart style.
chart.Style = ChartStyle.ColorGradient
See Also