ChartSeries

class ChartSeries

A chart data series.

Chart.series and Chart.get_series return a ChartSeriesCollection. Indexing or iterating that collection returns ChartSeries objects.

Use set() to change several attributes in one operation. On xlwings Lite, use the asynchronous getters to fetch current values from Excel.

>>> chart = xw.books["Book1"].sheets[0].charts[0]
>>> series = chart.series[0]
>>> series.set(name="Revenue", marker_style="circle", marker_size=8)

在 0.37.5 版本加入.

property api: Any

Returns the native pywin32 or appscript series object.

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_fill_color()

Fetches the solid series fill color.

Requires xlwings Lite.

返回类型:

tuple[int, int, int] | None

async get_line_color()

Fetches the series line color.

Requires xlwings Lite.

返回类型:

tuple[int, int, int] | None

async get_marker_background_color()

Fetches the marker background color.

Requires xlwings Lite.

返回类型:

tuple[int, int, int] | None

async get_marker_foreground_color()

Fetches the marker foreground color.

Requires xlwings Lite.

返回类型:

tuple[int, int, int] | None

async get_marker_size()

Fetches the marker size.

Requires xlwings Lite.

返回类型:

int

async get_marker_style()

Fetches the marker style.

Requires xlwings Lite.

返回类型:

str

async get_name()

Fetches the displayed series name.

Requires xlwings Lite.

返回类型:

str

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_size: int

Returns or sets the marker size in points, from 2 through 72.

property marker_style: Literal['automatic', 'none', 'square', 'diamond', 'triangle', 'x', 'star', 'dot', 'dash', 'circle', 'plus']

Returns or sets the marker style.

Setter type:

str

property name: str

Returns or sets the displayed series name.

set(*, name=..., marker_style=..., marker_size=..., marker_foreground_color=..., marker_background_color=..., line_color=..., fill_color=...)

Sets one or more series attributes in one operation.

Only supplied attributes are changed, and all arguments are validated before anything is written.