-
Notifications
You must be signed in to change notification settings - Fork 517
excel chart treemap
A dedicated page for the treemap chart type. Treemaps are part of
Excel's cx:chart (extended chart, Office 2016+) family. They display
hierarchical data as nested rectangles where each cell's area is
proportional to its value.
Path: /{SheetName}/chart[N]
Add command shape:
officecli add data.xlsx /Sheet1 --type chart \
--prop chartType=treemap \
--prop series1="Name:v1,v2,v3,..." \
--prop categories="Cat1,Cat2,Cat3,..." \
<styling props>See also: Chart - add, Chart - set, histogram for the full cx styling reference.
A treemap divides a rectangular area into nested tiles where each tile's area is proportional to its value. Categories provide the cell labels, and colors cycle through the palette to visually distinguish cells. Treemaps are ideal for showing composition and relative size at a glance (e.g. disk usage, revenue by product, portfolio allocation).
officecli add data.xlsx /Sheet1 --type chart \
--prop chartType=treemap \
--prop title="Revenue by Product" \
--prop series1="Revenue:400,300,200,150,100,80,50" \
--prop categories="Product A,Product B,Product C,Product D,Product E,Product F,Product G"| Property | Default | Notes |
|---|---|---|
parentLabelLayout |
overlapping |
How parent category labels are placed in multi-level treemaps |
| Value | Description |
|---|---|
overlapping |
Labels overlap children (default) |
banner |
Labels in a separate banner strip above children |
none |
No parent labels |
officecli add data.xlsx /Sheet1 --type chart \
--prop chartType=treemap \
--prop series1="Sales:400,300,200,100" \
--prop categories="A,B,C,D" \
--prop parentLabelLayout=banner
officecli set data.xlsx /Sheet1/chart[1] --prop parentLabelLayout=none| Property | Default | Notes |
|---|---|---|
x / y
|
0 |
Top-left cell position (column / row index) |
width |
8 |
Chart width in column units |
height |
15 |
Chart height in row units |
| Property | Default | Notes |
|---|---|---|
fill |
(theme) | Single hex color for all cells: "4472C4" or with #. Internally stored without #. |
colors |
(theme) | Comma-separated hex colors, cycled across cells. E.g. "4472C4,ED7D31,A5A5A5,FFC000"
|
series.shadow / seriesshadow
|
— | Outer drop shadow on every cell: "COLOR-BLUR-ANGLE-DIST-OPACITY" (e.g. "000000-6-45-3-35") or "none" to remove |
| Property | Default | Notes |
|---|---|---|
dataLabels |
false |
true draws the value inside each cell |
datalabels.numfmt / labelnumfmt
|
— | Excel format code for the label text: "0", "0.0", "0.00%", "#,##0", etc. |
# Value labels with thousands separator
officecli add data.xlsx /Sheet1 --type chart \
--prop chartType=treemap \
--prop series1="Revenue:4000,3000,2000,1000" \
--prop categories="A,B,C,D" \
--prop dataLabels=true \
--prop "datalabels.numfmt=#,##0"Treemaps have no axes and no gridlines. All axis-related properties
(xAxisTitle, yAxisTitle, axismin, gridlines, etc.) are silently
ignored on treemap charts.
| Property | Default | Notes |
|---|---|---|
title |
— | Chart title text; none/false to hide |
title.color / titlecolor
|
— | Title font color (hex) |
title.size / titlesize
|
— | Title font size (pt) |
title.bold / titlebold
|
— | Title bold (true/false) |
title.font / titlefont
|
— | Title font family |
title.shadow / titleshadow
|
— | Title drop shadow: "COLOR-BLUR-ANGLE-DIST-OPACITY" or "none"
|
| Property | Default | Notes |
|---|---|---|
legend |
— |
top / bottom / left / right / none (omit legend) |
legend.overlay / legendoverlay
|
false |
Let the legend float on top of the plot area when true. Useful when chart space is tight. |
legendfont / legend.font
|
— | Compound legend text styling: "size:color:fontname"
|
The plot area is the rectangle the treemap cells are drawn inside. The chart area is the outer frame that also contains the title and legend.
| Property | Default | Notes |
|---|---|---|
plotareafill / plotfill
|
— | Plot-area solid background: hex color |
plotarea.border / plotborder
|
— | Plot-area outline: "color", "color:width", "color:width:dash", or "none"
|
chartareafill / chartfill
|
— | Chart-area (outer frame) solid background: hex color |
chartarea.border / chartborder
|
— | Chart-area outline, same grammar as plotarea.border
|
# "Card" look — light plot area with a subtle border
officecli add data.xlsx /Sheet1 --type chart \
--prop chartType=treemap \
--prop series1="Revenue:400,300,200,100" \
--prop categories="A,B,C,D" \
--prop plotareafill=FAFBFC \
--prop "plotarea.border=D0D7DE:1" \
--prop chartareafill=FFFFFF \
--prop "chartarea.border=E5E5E5:0.75"officecli add data.xlsx /Sheet1 --type chart \
--prop chartType=treemap \
--prop title="Market Share by Segment" \
--prop title.color=2B2B2B --prop title.size=18 --prop title.bold=true \
--prop title.font="Helvetica Neue" \
--prop series1="Share:350,280,200,150,120,80,50,30" \
--prop categories="Enterprise,Mid-Market,SMB,Startup,Government,Education,Non-Profit,Other" \
--prop colors=2E86AB,A23B72,F18F01,C73E1D,3B1F2B,44BBA4,E94F37,393E41 \
--prop parentLabelLayout=banner \
--prop dataLabels=true --prop "datalabels.numfmt=0.0%" \
--prop plotareafill=F8F9FA \
--prop "plotarea.border=DEE2E6:1" \
--prop chartareafill=FFFFFF \
--prop "chartarea.border=CED4DA:0.75" \
--prop legend=bottom \
--prop "legendfont=10:6C757D:Helvetica Neue" \
--prop x=0 --prop y=0 --prop width=14 --prop height=20| Feature | Preview | Notes |
|---|---|---|
| Squarified layout | Yes | Bruls et al. algorithm |
| Proportional cell areas | Yes | |
| Per-cell colors | Yes | Cycled through palette |
| Cell labels | Yes | Hidden when cell is too small (<40px wide or <18px tall) |
| White cell borders | Yes | |
| Plot/chart area fills | Yes |
- No axes. Treemaps are a pure area-proportional visualization with no axes or gridlines. All axis-related properties are silently ignored.
-
parentLabelLayoutonly matters for multi-level treemaps. With a single flat list of categories, all three values produce identical output. - Preview font fallback. The HTML preview renders cell colors and fills correctly but does not reproduce custom font families — labels fall back to the preview's default sans font. Use Excel for final typographic QA.
# Count all charts across the workbook
officecli query data.xlsx chart
# Introspect a single chart's bound properties
officecli get data.xlsx "/Sheet1/chart[1]"
# Render the sheet to HTML preview
officecli view data.xlsx html > preview.html- Chart — Overview of chart operations
- Chart add — Generic chart add (all 17 types)
- Chart set — Modify existing charts (incl. treemap)
- Chart get — Read back chart properties
- sunburst — Ring-based hierarchy
- funnel — Pipeline stages
- histogram — Full cx styling reference
Based on OfficeCLI v1.0.64