-
Notifications
You must be signed in to change notification settings - Fork 514
excel chart bar
zmworm edited this page Apr 29, 2026
·
16 revisions
A dedicated page for the bar chart type. Bar charts display data as
horizontal bars, ideal for ranked comparisons and long category labels.
Bar charts are the horizontal variant of column
and share all column-specific properties (gap width, overlap, invert
if negative, bar shape).
Path: /{SheetName}/chart[N]
Add command shape:
officecli add data.xlsx /Sheet1 --type chart \
--prop chartType=bar \
--prop title="Department Budget" \
--prop data="Budget:50,80,120,60" \
--prop categories="Engineering,Sales,Marketing,Support" \
<styling props>See also: Chart - add, Chart - set, column for the vertical variant.
| Type string | Grouping | 3D |
|---|---|---|
bar |
Clustered | No |
barStacked |
Stacked | No |
barPercentStacked |
PercentStacked | No |
bar3d |
Clustered | Yes |
Bar charts share all properties with column charts — the only difference is the orientation (horizontal vs vertical). See column for the full type-specific reference.
| Property | Default | Notes |
|---|---|---|
gapWidth / gap
|
150 | Space between bar groups (0-500, as % of bar width) |
# Tight bars (no gap)
officecli add data.xlsx /Sheet1 --type chart \
--prop chartType=bar --prop gapWidth=0 \
--prop data="Sales:10,20,30" --prop categories="A,B,C"
# Wide gap
officecli set data.xlsx /Sheet1/chart[1] --prop gapWidth=300| Property | Default | Notes |
|---|---|---|
overlap |
0 (clustered), 100 (stacked) | Bar overlap (-100 to 100, as % of bar width) |
officecli set data.xlsx /Sheet1/chart[1] --prop overlap=50| Property | Default | Notes |
|---|---|---|
invertIfNeg / invertIfNegative
|
false |
Reverse bar color/direction for negative values |
| Property | Default | Notes |
|---|---|---|
shape / barShape
|
box |
3D bar shape: box, cone, cylinder, pyramid
|
| Property | Default | Notes |
|---|---|---|
title |
— | Chart title text |
title.font / titleFont
|
— | Font family |
title.size / titleSize
|
— | Font size (pt) |
title.color / titleColor
|
— | Font color (hex) |
title.bold / titleBold
|
— | Bold (true/false) |
title.glow / titleGlow
|
— | Glow: "COLOR-RADIUS-OPACITY" or "none"
|
title.shadow / titleShadow
|
— | Shadow: "COLOR-BLUR-ANGLE-DIST-OPACITY" or "none"
|
| Property | Default | Notes |
|---|---|---|
legend |
true |
Position: top, bottom, left, right, none
|
legend.overlay |
false |
Float legend on top of the chart |
legendFont / legend.font
|
— | "size:color:fontname" |
| Property | Default | Notes |
|---|---|---|
axisMin / min
|
(auto) | Value axis lower bound |
axisMax / max
|
(auto) | Value axis upper bound |
majorUnit |
(auto) | Major gridline / tick interval |
minorUnit |
(auto) | Minor gridline / tick interval |
axisNumFmt / axisNumberFormat
|
General |
Number format for tick labels (e.g. "$#,##0", "0%") |
# Lock value axis range
officecli add data.xlsx /Sheet1 --type chart \
--prop chartType=bar \
--prop data="Budget:50,80,120,60" \
--prop categories="Eng,Sales,Mkt,Support" \
--prop axisMin=0 --prop axisMax=150 --prop majorUnit=25| Property | Default | Notes |
|---|---|---|
logBase / logScale
|
— | Logarithmic scale base (e.g. 10) |
| Property | Default | Notes |
|---|---|---|
axisOrientation / axisReverse
|
minMax |
Set to maxMin or true to flip the value axis |
| Property | Default | Notes |
|---|---|---|
secondaryAxis / secondary
|
— | Comma-separated 1-based series indices for secondary value axis |
# Budget on primary axis, headcount on secondary
officecli add data.xlsx /Sheet1 --type chart \
--prop chartType=bar \
--prop series1="Budget:50,80,120,60" \
--prop series2="Headcount:5,12,20,8" \
--prop categories="Eng,Sales,Mkt,Support" \
--prop secondaryAxis=2| Property | Default | Notes |
|---|---|---|
dispUnits / displayUnits
|
— |
thousands, millions, billions, etc. |
| Property | Default | Notes |
|---|---|---|
axisVisible / axis.visible
|
true |
Show/hide both axes |
axisLine / axis.line
|
— | Value axis line: "color:width:dash"
|
catAxisLine |
— | Category axis line: "color:width:dash"
|
majorTickMark / majorTick
|
— |
out, in, cross, none
|
minorTickMark / minorTick
|
— | Same as major tick |
tickLabelPos |
nextTo |
nextTo, high, low, none
|
| Property | Default | Notes |
|---|---|---|
gridlines / majorGridlines
|
true |
Toggle or configure: true, false/none, or "color:widthPt:dash"
|
minorGridlines |
false |
Same format as gridlines
|
# Custom gridlines
officecli add data.xlsx /Sheet1 --type chart \
--prop chartType=bar \
--prop data="Sales:50,80,120" --prop categories="A,B,C" \
--prop "gridlines=D0D0D0:0.5:solid" \
--prop "minorGridlines=EEEEEE:0.3:sysDot"| Property | Default | Notes |
|---|---|---|
referenceLine / refLine
|
— |
value or "value:color:width:dash"
|
Reference lines are vertical overlays (since the value axis is horizontal in bar charts) drawn at a constant value.
# Target line at 100 — red, dashed
officecli add data.xlsx /Sheet1 --type chart \
--prop chartType=bar \
--prop data="Budget:50,80,120,60" \
--prop categories="Eng,Sales,Mkt,Support" \
--prop "referenceLine=100:FF0000:1.5:dash"| Property | Default | Notes |
|---|---|---|
plotFill / plotAreaFill
|
— | Plot area background: hex, gradient "C1-C2[:angle]", or "none"
|
chartFill / chartAreaFill
|
— | Chart area background |
plotArea.border / plotBorder
|
— | Plot area outline: "color:width:dash" or "none"
|
chartArea.border / chartBorder
|
— | Chart area outline |
| Property | Default | Notes |
|---|---|---|
series.shadow / seriesShadow
|
— |
"COLOR-BLUR-ANGLE-DIST-OPACITY" or "none"
|
series.outline / seriesOutline
|
— |
"COLOR-WIDTH" e.g. "FFFFFF-0.5" or "none"
|
| Property | Default | Notes |
|---|---|---|
dataLabels |
false |
Toggle data labels |
labelPos / labelPosition
|
— | Position: center, insideEnd, insideBase, outsideEnd, top, bottom, left, right, bestFit
|
labelFont |
— | "size:color:bold" |
dataLabel{N}.text |
— | Custom text for individual label |
dataLabel{N}.x/y/w/h |
— | Manual layout of individual label |
dataLabel{N}.delete |
— | Hide individual label |
dataLabels.separator |
— | Separator between label parts |
dataLabels.numFmt |
— | Number format for labels |
| Property | Default | Notes |
|---|---|---|
transparency |
0 | Series transparency (0-100%) |
opacity / alpha
|
100 | Series opacity (0-100%) |
| Property | Default | Notes |
|---|---|---|
x, y
|
0 |
Chart position (column/row index) |
width |
8 |
Chart width (column units) |
height |
15 |
Chart height (row units) |
plotArea.x/y/w/h |
— | Manual plot area layout (0-1 decimal) |
title.x/y/w/h |
— | Manual title layout |
legend.x/y/w/h |
— | Manual legend layout |
| Property | Default | Notes |
|---|---|---|
dispBlanksAs / blanksAs
|
gap |
How blank cells are handled: gap, zero, span/connect
|
| Property | Default | Notes |
|---|---|---|
colorRule / conditionalColor
|
— | Color data points conditionally |
point{N}.color |
— | Individual data point color (hex) |
| Property | Default | Notes |
|---|---|---|
view3d / camera / perspective
|
— |
"rotX,rotY,perspective" e.g. "15,20,30"
|
Applies only to bar3d chart type.
# Horizontal bar chart
officecli add data.xlsx /Sheet1 --type chart \
--prop chartType=bar \
--prop title="Department Budget" \
--prop data="Budget:50,80,120,60" \
--prop categories="Engineering,Sales,Marketing,Support"
# Stacked horizontal bars
officecli add data.xlsx /Sheet1 --type chart \
--prop chartType=barStacked \
--prop title="Task Breakdown" \
--prop data="Dev:40,60,30;QA:20,15,25;Design:10,20,15" \
--prop categories="Sprint 1,Sprint 2,Sprint 3"officecli add data.xlsx /Sheet1 --type chart \
--prop chartType=bar \
--prop title="Department Budget Ranking" \
--prop title.size=14 --prop title.bold=true \
--prop title.font="Arial" --prop title.color=1F2937 \
--prop series1="FY2024:50,80,120,60,45" \
--prop series2="FY2023:40,70,100,55,40" \
--prop categories="Engineering,Sales,Marketing,Support,Legal" \
--prop colors="4472C4,ED7D31" \
--prop gapWidth=100 \
--prop dataLabels=true --prop labelPos=outsideEnd \
--prop "labelFont=9:6B7280:false" \
--prop "gridlines=E5E7EB:0.5:solid" \
--prop "referenceLine=80:FF0000:1:dash" \
--prop plotFill=FAFBFC \
--prop legend=bottom \
--prop "legendfont=9:6B7280:Arial" \
--prop x=0 --prop y=0 --prop width=14 --prop height=20| Feature | Preview | Notes |
|---|---|---|
| Horizontal bars | Yes | Labels on left axis |
| Stacked / percent stacked | Yes | |
| Gap width | Yes | |
| Data labels | Yes | Positioned at bar center |
| Reference lines | Yes | Vertical overlays |
| 3D bars | Yes | Isometric projection |
| Custom axis scale | Yes | axisMin/axisMax/majorUnit |
| Gridlines | Yes | Color, width, dash from OOXML |
| Shadow effects | No | Decorative; not rendered |
| Glow effects | No | Decorative; not rendered |
-
Bar is horizontal column. All column-specific properties
(
gapWidth,overlap,invertIfNeg,shape) work identically on bar charts. The only difference is axis orientation. - Reference lines are vertical in bar charts (since the value axis is horizontal), unlike column/line charts where they are horizontal.
-
3D bar charts use
bar3dtype string. Theshapeproperty controls the 3D bar shape.
# List all charts
officecli query data.xlsx chart
# Inspect a specific chart
officecli get data.xlsx "/Sheet1/chart[1]"
# Render to HTML preview
officecli view data.xlsx html > preview.html- Chart - Overview of chart operations
- Chart add - Generic chart add (all types)
- Chart set - Modify existing charts
- Chart get - Read back chart properties
- column - Vertical variant (shared type-specific properties)
Based on OfficeCLI v1.0.64