ChartSeries
- class ChartSeries
A chart data series.
Chart.seriesandChart.get_seriesreturn aChartSeriesCollection. Indexing or iterating that collection returnsChartSeriesobjects.Use
set()to change several attributes in one operation. On xlwings Lite, use the asynchronous getters to fetch current values from Excel.>>> # Assumes an existing workbook object named book. >>> chart = book.sheets[0].charts[0] >>> series = chart.series[0] >>> series.set(name="Revenue", marker_style="circle", marker_size=8)
Added in version 0.37.5.
- property axis_group: Literal['primary', 'secondary']
Returns or sets whether the series is plotted on the
"primary"or"secondary"axes. Format the secondary axes viaChart.secondary_value_axisandChart.secondary_category_axis.- Setter type:
str
Added in version 0.37.6.
- property chart_type: str
Returns or sets the series chart type, which turns the chart into a combination chart, e.g., columns and a line. See
Chart.chart_typefor the possible values. Excel rejects combinations it doesn’t support.Added in version 0.37.6.
- property fill_color: tuple[int, int, int] | None
Returns or sets the solid series fill color.
- Setter type:
tuple[int, int, int] | str | int
- async get_axis_group()
Fetches whether the series is plotted on the primary or secondary axes.
Requires xlwings Lite.
Added in version 0.37.6.
- Return type:
str
- async get_chart_type()
Fetches the series chart type.
Requires xlwings Lite.
Added in version 0.37.6.
- Return type:
str
- async get_fill_color()
Fetches the solid series fill color.
Requires xlwings Lite.
- Return type:
tuple[int, int, int] | None
- async get_line_color()
Fetches the series line color.
Requires xlwings Lite.
- Return type:
tuple[int, int, int] | None
- async get_marker_background_color()
Fetches the marker background color.
Requires xlwings Lite.
- Return type:
tuple[int, int, int] | None
- async get_marker_foreground_color()
Fetches the marker foreground color.
Requires xlwings Lite.
- Return type:
tuple[int, int, int] | None
- property line_color: tuple[int, int, int] | None
Returns or sets the series line color.
- Setter type:
tuple[int, int, int] | str | int
- property marker_background_color: tuple[int, int, int] | None
Returns or sets the marker background color.
- Setter type:
tuple[int, int, int] | str | int
- property marker_foreground_color: tuple[int, int, int] | None
Returns or sets the marker foreground color.
- Setter type:
tuple[int, int, int] | str | int
- property marker_style: Literal['automatic', 'none', 'square', 'diamond', 'triangle', 'x', 'star', 'dot', 'dash', 'circle', 'plus']
Returns or sets the marker style.
- Setter type:
str
- set(*, name=..., marker_style=..., marker_size=..., marker_foreground_color=..., marker_background_color=..., line_color=..., fill_color=..., chart_type=..., axis_group=...)
Sets one or more series attributes in one operation.
Only supplied attributes are changed, and all arguments are validated before anything is written.
chart_typeandaxis_groupare applied before the formatting attributes, whatever the argument order, as changing them can make Excel reformat the series.>>> series.set(chart_type="line_markers", axis_group="secondary")