SparklineGroup

SparklineGroup class

Sparkline is organized into sparkline group. A SparklineGroup contains a variable number of sparkline items. A sparkline group specifies the type, display settings and axis settings for the sparklines.

public class SparklineGroup

Properties

Name Description
DisplayHidden { get; set; } Indicates whether to show data in hidden rows and columns.
FirstPointColor { get; set; } Gets and sets the color of the first point of data in the sparkline group.
HighPointColor { get; set; } Gets and sets the color of the highest points of data in the sparkline group.
HorizontalAxisColor { get; set; } Gets and sets the color of the horizontal axis in the sparkline group.
HorizontalAxisDateRange { get; set; } Represents the range that contains the date values for the sparkline data.
LastPointColor { get; set; } Gets and sets the color of the last point of data in the sparkline group.
LineWeight { get; set; } Gets and sets the line weight in each line sparkline in the sparkline group, in the unit of points.
LowPointColor { get; set; } Gets and sets the color of the lowest points of data in the sparkline group.
MarkersColor { get; set; } Gets and sets the color of points in each line sparkline in the sparkline group.
NegativePointsColor { get; set; } Gets and sets the color of the negative values on the sparkline group.
PlotEmptyCellsType { get; set; } Indicates how to plot empty cells.
PlotRightToLeft { get; set; } Indicates whether the plot data is right to left.
PresetStyle { get; set; } Gets and sets the preset style type of the sparkline group.
SeriesColor { get; set; } Gets and sets the color of the sparklines in the sparkline group.
ShowFirstPoint { get; set; } Indicates whether to highlight the first point of data in the sparkline group.
ShowHighPoint { get; set; } Indicates whether to highlight the highest points of data in the sparkline group.
ShowHorizontalAxis { get; set; } Indicates whether to show the sparkline horizontal axis. The horizontal axis appears if the sparkline has data that crosses the zero axis.
ShowLastPoint { get; set; } Indicates whether to highlight the last point of data in the sparkline group.
ShowLowPoint { get; set; } Indicates whether to highlight the lowest points of data in the sparkline group.
ShowMarkers { get; set; } Indicates whether to highlight each point in each line sparkline in the sparkline group.
ShowNegativePoints { get; set; } Indicates whether to highlight the negative values on the sparkline group with a different color or marker.
SparklineCollection { get; } Gets the SparklineCollection object of the sparkline group.
Type { get; set; } Indicates the sparkline type of the sparkline group.
VerticalAxisMaxValue { get; set; } Gets and sets the custom maximum value for the vertical axis.
VerticalAxisMaxValueType { get; set; } Represents the vertical axis maximum value type.
VerticalAxisMinValue { get; set; } Gets and sets the custom minimum value for the vertical axis.
VerticalAxisMinValueType { get; set; } Represents the vertical axis minimum value type.

Methods

Name Description
ResetRanges(string, bool, CellArea) Resets the data range and location range of the sparkline group. This method will clear original sparkline items in the group and creates new sparkline items for the new ranges.

Examples

[C#]
 Workbook book = new Workbook(); 
 Worksheet sheet = book.Worksheets[0];

 sheet.Cells["A1"].PutValue(5);
 sheet.Cells["B1"].PutValue(2);
 sheet.Cells["C1"].PutValue(1);
 sheet.Cells["D1"].PutValue(3);
 
 // Define the CellArea
 CellArea ca = new CellArea();
 ca.StartColumn = 4;
 ca.EndColumn = 4;
 ca.StartRow = 0;
 ca.EndRow = 0;
 int idx = sheet.SparklineGroupCollection.Add(Aspose.Cells.Charts.SparklineType.Line, "A1:D1", false, ca);
 SparklineGroup group = sheet.SparklineGroupCollection[idx];
 group.SparklineCollection.Add(sheet.Name + "!A1:D1", 0, 4);
 // Create CellsColor
 CellsColor clr = book.CreateCellsColor();
 clr.Color = Color.Orange;
 group.SeriesColor = clr;

 // set the high points are colored green and the low points are colored red
 group.ShowHighPoint = true;
 group.ShowLowPoint = true;
 group.HighPointColor.Color = Color.Green;
 group.LowPointColor.Color = Color.Red;
 // set line weight 
 group.LineWeight = 1.0;
 book.Save("output.xlsx", SaveFormat.Xlsx);

See Also