# Working with Sparklines

Spread for ASP.NET allows you to work with sparklines to group, clear, and switch rows and columns. Learn more in documentation.

## Content

You can group, clear, and switch rows and columns with sparklines.
Grouping merges sparklines into a new group and removes them from the old groups. If the selected sparklines belong to different groups with different types, the new group will have the type of the last selected group. The new group will also have the empty cell, style, and axis settings of the last selected group.
Ungrouping selected sparkline groups separates them into different groups that contain only one sparkline. The data and location range of the original sparkline are used in the new groups. The settings of the original group are also used in the new groups.
You can clear a sparkline in code with the [ClearSparklines](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.SheetView.ClearSparklines.html) method in the [SheetView](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.SheetView.html) class.
You can switch the range of data used in the sparkline from row to column or column to row. Use the [SwitchRowColumn](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.ExcelSparklineGroup.SwitchRowColumn.html) method in the [ExcelSparklineGroup](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.ExcelSparklineGroup.html) class in code. The range of data should have the same number of rows and columns. Use the [AddSquareSparkline](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.SheetView.AddSquareSparkline.html) method in the [SheetView](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.SheetView.html) class to add a sparkline that can be switched.

## Using Code

1. Use the [GroupSparkline](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.SheetView.GroupSparkline.html) method to group sparkline cells.
2. Use the [UngroupSparkline](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.SheetView.UngroupSparkline.html) method to ungroup sparkline cells.

## Example

This example shows how to use the [GroupSparkline](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.SheetView.GroupSparkline.html) method or the [UngroupSparkline](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.SheetView.UngroupSparkline.html) method.

```csharp
fpSpread1.Sheets[0].GroupSparkline(new FarPoint.Web.Spread.Model.CellRange[] { new FarPoint.Web.Spread.Model.CellRange(5, 0, 3, 1) });
// fpSpread1.Sheets[0].UnGroupSparkline(new FarPoint.Web.Spread.Model.CellRange[] { new FarPoint.Web.Spread.Model.CellRange(5, 0, 3, 1) }); 
```

```vbnet
FpSpread1.Sheets(0).GroupSparkline(New FarPoint.Web.Spread.Model.CellRange() {New FarPoint.Web.Spread.Model.CellRange(5, 0, 3, 1)})
'FpSpread1.Sheets(0).UnGroupSparkline(New FarPoint.Web.Spread.Model.CellRange() {New FarPoint.Web.Spread.Model.CellRange(5, 0, 3, 1)}) 
```

## Using the Spread Designer

1. Select the sparkline cells.
2. Select **Group** or **Ungroup** in the **Group** section of the toolbar to group or ungroup sparklines.
3. Select **Clear** if you wish to remove any sparklines.
4. Use the **Edit Data** option to edit the data or switch the range of data used in the sparkline.
5. Select **Apply and Exit** from the **File** menu to save your changes and close the designer.

## See Also

[ExcelSparklineGroup Class](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.ExcelSparklineGroup.html)
[ExcelSparklineSetting Class](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.ExcelSparklineSetting.html)