Back to Devexpress

SparklineGroupCollection.Add(CellRange, CellRange, SparklineGroupType) Method

officefileapi-devexpress-dot-spreadsheet-dot-sparklinegroupcollection-dot-add-x28-devexpress-dot-spreadsheet-dot-cellrange-devexpress-dot-spreadsheet-dot-cellrange-devexpress-dot-spreadsheet-dot-sparklinegrouptype-x29.md

latest5.9 KB
Original Source

SparklineGroupCollection.Add(CellRange, CellRange, SparklineGroupType) Method

Creates a sparkline group of the specified type and adds it to the collection.

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
SparklineGroup Add(
    CellRange position,
    CellRange dataRange,
    SparklineGroupType type
)
vb
Function Add(
    position As CellRange,
    dataRange As CellRange,
    type As SparklineGroupType
) As SparklineGroup

Parameters

NameTypeDescription
positionCellRange

A CellRange object that specifies the cell range where the sparkline group should be located.

| | dataRange | CellRange |

A CellRange object that specifies the cell range containing the source data for the group.

| | type | SparklineGroupType |

A SparklineGroupType enumeration member specifying the type of the group to be created.

|

Returns

TypeDescription
SparklineGroup

A SparklineGroup object that is the newly created group of sparklines.

|

Remarks

The example below demonstrates how to create two groups of sparklines using the Add method of the SparklineGroupCollection collection accessible from the Worksheet.SparklineGroups property.

View Example

csharp
Worksheet worksheet = workbook.Worksheets["SparklineExamples"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Create a group of line sparklines.
SparklineGroup quarterlyGroup = worksheet.SparklineGroups.Add(worksheet["G4:G6"], worksheet["C4:F4,C5:F5,C6:F6"], SparklineGroupType.Line);
// Add one more sparkline to the existing group.
quarterlyGroup.Sparklines.Add(6, 6, worksheet["C7:F7"]);

// Display a column sparkline in the total cell.
SparklineGroup totalGroup = worksheet.SparklineGroups.Add(worksheet["G8"], worksheet["C8:F8"], SparklineGroupType.Column);
vb
Dim worksheet As Worksheet = workbook.Worksheets("SparklineExamples")
workbook.Worksheets.ActiveWorksheet = worksheet

' Create a group of line sparklines.
Dim quarterlyGroup As SparklineGroup = worksheet.SparklineGroups.Add(worksheet("G4:G6"), worksheet("C4:F4,C5:F5,C6:F6"), SparklineGroupType.Line)
' Add one more sparkline to the existing group.
quarterlyGroup.Sparklines.Add(6, 6, worksheet("C7:F7"))

' Display a column sparkline in the total cell.
Dim totalGroup As SparklineGroup = worksheet.SparklineGroups.Add(worksheet("G8"), worksheet("C8:F8"), SparklineGroupType.Column)

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Add(CellRange, CellRange, SparklineGroupType) 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.

spreadsheet-document-api-chart-examples/CS/SpreadsheetDocServerChartAPISamples/CodeExamples/SparklineActions.cs#L21

csharp
// Create a group of line sparklines.
SparklineGroup quarterlyGroup = worksheet.SparklineGroups.Add(worksheet["G4:G6"], worksheet["C4:F4,C5:F5,C6:F6"], SparklineGroupType.Line);
// Add one more sparkline to the existing group.

spreadsheet-document-api-chart-examples/VB/SpreadsheetDocServerChartAPISamples/CodeExamples/SparklineActions.vb#L21

vb
' Create a group of line sparklines.
Dim quarterlyGroup As SparklineGroup = worksheet.SparklineGroups.Add(worksheet("G4:G6"), worksheet("C4:F4,C5:F5,C6:F6"), SparklineGroupType.Line)
' Add one more sparkline to the existing group.

See Also

How to: Create Sparklines

SparklineGroupCollection Interface

SparklineGroupCollection Members

DevExpress.Spreadsheet Namespace