All docs
V19.2
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+
.NET Core 3.0+

ChartData.FromRange(CellRange) Method

Converts cell values to chart data for cells in the specified range.

Namespace: DevExpress.Spreadsheet.Charts

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

Declaration

public static ChartData FromRange(
    CellRange value
)
Public Shared Function FromRange(
    value As CellRange
) As ChartData
public static ChartData FromRange(
    CellRange value
)
Public Shared Function FromRange(
    value As CellRange
) As ChartData
public static ChartData FromRange(
    CellRange value
)
Public Shared Function FromRange(
    value As CellRange
) As ChartData

Parameters

Name Type Description
value CellRange

A CellRange object that is the cell range of the worksheet.

Parameters

Name Type Description
value CellRange

A CellRange object that is the cell range of the worksheet.

Parameters

Name Type Description
value CellRange

A CellRange object that is the cell range of the worksheet.

Returns

Type Description
ChartData

A ChartData object.

Returns

Type Description
ChartData

A ChartData object.

Returns

Type Description
ChartData

A ChartData object.

Remarks

The example below demonstrates how to add data series to a chart and change the cell range containing data for a specific series.

The code uses the SeriesCollection.Add method to create a series and add it to the ChartObject.Series collection. To specify series values contained in the worksheet range, create a ChartData object using the ChartData.FromRange method and assign it to the Series.Values property.

The ChartText.SetReference method is used to link the Series.SeriesName to the content of the worksheet cell.

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 series using a worksheet range as the data source.
chart.Series.Add(worksheet("D2"), worksheet("B3:B6"), worksheet("D3:D6"))
chart.Series.Add(worksheet("F2"), worksheet("B3:B6"), worksheet("F3:F6"))

' Change the data range for the series values.
chart.Series(1).Values = ChartData.FromRange(worksheet("E3:E6"))

' Specify the cell that is the source for the series name.
chart.Series(1).SeriesName.SetReference(worksheet("E2"))
See Also