ChartAxis
- class ChartAxis
A primary chart axis, accessed through
Chart.category_axisorChart.value_axis.Use
set()to change several attributes in one operation. On xlwings Lite, use the asynchronous getters to fetch the current values from Excel.>>> chart = xw.books["Book1"].sheets[0].charts[0] >>> chart.value_axis.set( ... title="Revenue", minimum_scale=0, major_unit=10_000 ... )
在 0.37.5 版本加入.
- async get_title()
Fetches the axis title. Returns
Noneif the axis or title is hidden.Requires xlwings Lite.
- 返回类型:
str | None
- property major_unit: float
Returns or sets the interval between major tick marks. Set to
Noneto restore Excel's automatic interval; reads return the resolved value.- Setter type:
float | None
- property maximum_scale: float
Returns or sets the maximum scale. Set to
Noneto restore Excel's automatic scale; reads return the resolved numeric value.- Setter type:
float | None
- property minimum_scale: float
Returns or sets the minimum scale. Set to
Noneto restore Excel's automatic scale; reads return the resolved numeric value.- Setter type:
float | None
- set(*, title=..., minimum_scale=..., maximum_scale=..., major_unit=..., number_format=..., visible=...)
Sets one or more axis attributes in one operation.
Only supplied attributes are changed, and all arguments are validated before anything is written.
visible=Trueis applied before the other attributes;visible=Falseis applied last so it describes the final state.- 参数:
title (str | None) -- Axis title, or
Noneto hide it.minimum_scale (float | None) -- Minimum scale, or
Nonefor automatic scaling.maximum_scale (float | None) -- Maximum scale, or
Nonefor automatic scaling.major_unit (float | None) -- Positive major-unit interval, or
Nonefor automatic.number_format (str) -- Format code for the tick labels.
visible (bool) -- Whether the axis is shown.