SparklineGroup class

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.

The SparklineGroup type exposes the following members:

Properties

PropertyDescription
preset_styleGets and sets the preset style type of the sparkline group.
sparkline_collectionGets the collection of Sparkline object.
sparklinesGets the collection of Sparkline object.
typeIndicates the sparkline type of the sparkline group.
plot_empty_cells_typeIndicates how to plot empty cells.
display_hiddenIndicates whether to show data in hidden rows and columns.
show_high_pointIndicates whether to highlight the highest points of data in the sparkline group.
high_point_colorGets and sets the color of the highest points of data in the sparkline group.
show_low_pointIndicates whether to highlight the lowest points of data in the sparkline group.
low_point_colorGets and sets the color of the lowest points of data in the sparkline group.
show_negative_pointsIndicates whether to highlight the negative values on the sparkline group with a different color or marker.
negative_points_colorGets and sets the color of the negative values on the sparkline group.
show_first_pointIndicates whether to highlight the first point of data in the sparkline group.
first_point_colorGets and sets the color of the first point of data in the sparkline group.
show_last_pointIndicates whether to highlight the last point of data in the sparkline group.
last_point_colorGets and sets the color of the last point of data in the sparkline group.
show_markersIndicates whether to highlight each point in each line sparkline in the sparkline group.
markers_colorGets and sets the color of points in each line sparkline in the sparkline group.
series_colorGets and sets the color of the sparklines in the sparkline group.
plot_right_to_leftIndicates whether the plot data is right to left.
line_weightGets and sets the line weight in each line sparkline in the sparkline group, in the unit of points.
horizontal_axis_colorGets and sets the color of the horizontal axis in the sparkline group.
show_horizontal_axisIndicates whether to show the sparkline horizontal axis.
The horizontal axis appears if the sparkline has data that crosses the zero axis.
horizontal_axis_date_rangeRepresents the range that contains the date values for the sparkline data.
vertical_axis_max_value_typeRepresents the vertical axis maximum value type.
vertical_axis_max_valueGets and sets the custom maximum value for the vertical axis.
vertical_axis_min_value_typeRepresents the vertical axis minimum value type.
vertical_axis_min_valueGets and sets the custom minimum value for the vertical axis.

Methods

MethodDescription
reset_rangesResets 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.

Example

from aspose.cells import CellArea, SaveFormat, Workbook
from aspose.cells.charts import SparklineType
from aspose.pydrawing import Color

book = Workbook()
sheet = book.worksheets[0]
sheet.cells.get("A1").put_value(5)
sheet.cells.get("B1").put_value(2)
sheet.cells.get("C1").put_value(1)
sheet.cells.get("D1").put_value(3)
#  Define the CellArea
ca = CellArea()
ca.start_column = 4
ca.end_column = 4
ca.start_row = 0
ca.end_row = 0
idx = sheet.sparkline_groups.add(SparklineType.LINE, "A1:D1", False, ca)
group = sheet.sparkline_groups[idx]
group.sparklines.add(sheet.name + "!A1:D1", 0, 4)
#  Create CellsColor
clr = book.create_cells_color()
clr.color = Color.orange
group.series_color = clr
#  set the high points are colored green and the low points are colored red
group.show_high_point = True
group.show_low_point = True
group.high_point_color.color = Color.green
group.low_point_color.color = Color.red
#  set line weight
group.line_weight = 1.0
book.save("output.xlsx", SaveFormat.XLSX)

See Also