-
Notifications
You must be signed in to change notification settings - Fork 609
word chart axis
goworm edited this page Jun 26, 2026
·
1 revision
Per-axis configuration of an embedded chart — scale, title, gridlines, and tick-label formatting addressed by axis role. Axes are created and destroyed implicitly by chart-type changes, so chart-axis covers post-creation tuning only.
Path: /chart[N]/axis[@role=ROLE]
Where ROLE is one of category, value, value2, or series.
- set - Modify axis scale, title, gridlines, and label formatting
- get - Read back axis attributes
Writable properties. Some apply only to specific roles, as noted.
| Property | Required/Default | Description |
|---|---|---|
title |
- | Axis title text. Applies to all roles (category, value). Pass none to remove. |
visible |
- | Show or hide the axis (bool). Applies to all roles. |
majorGridlines |
- | Show or hide major gridlines (bool). Applies to all roles. |
minorGridlines |
- | Show or hide minor gridlines (bool). Applies to all roles. |
min |
- | Minimum scale of the value axis (number). Only valid for role=value or role=value2; ignored on category axes. |
max |
- | Maximum scale of the value axis (number). Only valid for role=value or role=value2; ignored on category axes. |
logBase |
- | Logarithmic base for value axis scale (number). Only valid for role=value or role=value2; ignored on category axes. |
format |
- | Number format string. |
labelRotation |
- | Tick label rotation in degrees (number). |
| Attribute | Type | Description |
|---|---|---|
title |
string | Axis title text |
visible |
bool | Whether the axis is shown |
majorGridlines |
bool | Whether major gridlines are shown |
minorGridlines |
bool | Whether minor gridlines are shown |
min |
number | Value-axis minimum |
max |
number | Value-axis maximum |
logBase |
number | Logarithmic base (e.g. 10) |
format |
string | Number format string |
labelRotation |
number | Tick label rotation in degrees |
axisFont |
string | Axis text font name |
axisMin |
number | Value-axis minimum readback (also surfaced via min) |
axisMax |
number | Value-axis maximum readback (also surfaced via max) |
axisTitle |
string | Value-axis title readback (chart-level convenience; axis-by-role uses title) |
axisNumFmt |
string | Axis number format code |
axisOrientation |
string | Axis scaling orientation token (e.g. maxMin when reversed) |
labelOffset |
number | Category axis label offset (% of default 100) |
tickLabelSkip |
number | Category axis label skip interval (>1 means tick labels are sparser) |
# Set the value axis title
officecli set report.docx "/chart[1]/axis[@role=value]" --type chart-axis --prop title="Revenue"
# Set the category axis title
officecli set report.docx "/chart[1]/axis[@role=category]" --type chart-axis --prop title="Quarter"
# Fix the value axis scale to 0..1000
officecli set report.docx "/chart[1]/axis[@role=value]" --type chart-axis --prop min=0 --prop max=1000
# Logarithmic value axis
officecli set report.docx "/chart[1]/axis[@role=value]" --type chart-axis --prop logBase=10
# Number format and rotated tick labels on the category axis
officecli set report.docx "/chart[1]/axis[@role=category]" --type chart-axis --prop format="#,##0" --prop labelRotation=-45
# Show major gridlines, hide minor gridlines
officecli set report.docx "/chart[1]/axis[@role=value]" --type chart-axis --prop majorGridlines=true --prop minorGridlines=false
# Hide the secondary value axis
officecli set report.docx "/chart[1]/axis[@role=value2]" --type chart-axis --prop visible=false
# Read back all axis attributes
officecli get report.docx "/chart[1]/axis[@role=value]" --type chart-axis- Axes are created and destroyed implicitly by chart-type changes — there is no direct add or remove. At chart-creation time, configure axes through the chart's own
axis*props (axisMin,axisMax,axisTitle,axisFont, …);chart-axiscovers post-creation only. -
min,max, andlogBaseapply only to value axes (role=valueorrole=value2) and are ignored on category axes. -
title,visible,majorGridlines, andminorGridlinesapply to all roles. - Pass
title=noneto remove an axis title. - For series-specific line styling, use
chart-seriesrather than axis-level properties.
- Chart - Parent embedded chart element
- Chart - set - Chart-level title, legend, and axis convenience props
- Word Reference - All Word elements
Based on OfficeCLI v1.0.119