Treemap chart
Show parts of a whole as nested areas in a treemap chart, in one or two levels: rectangles with exact areas, or cells inside a circle.
- React
import { TreemapChart } from 'boardplot/react/treemap';- Reference
- Data, options and sizing
- Use for
- Many parts of one total, in groups · A few items take most of the total
Revenue growth by business area
Rectangular treemap of 19 business areas in five groups with a group key; Core software ($7,350m) and Online ads ($3,080m) are over half of the $17,843m growth.
growth-rect
JSON spec
This spec includes the theme shown and the options you selected.
Changed from the fixture: options.unit; options.size from {"width":960,"height":600} to the width of the site frame.
{
"type": "treemap",
"data": {
"groups": [
{
"id": "platforms",
"label": "Platforms"
},
{
"id": "commerce",
"label": "Commerce"
},
{
"id": "energy",
"label": "Energy"
},
{
"id": "health",
"label": "Health"
},
{
"id": "machines",
"label": "Machines"
}
],
"items": [
{
"id": "core-software",
"label": "Core software",
"group": "platforms",
"value": 7350
},
{
"id": "cloud-hosting",
"label": "Cloud hosting",
"group": "platforms",
"value": 1820
},
{
"id": "data-tools",
"label": "Data tools and services",
"group": "platforms",
"value": 1610
},
{
"id": "online-ads",
"label": "Online ads",
"group": "commerce",
"value": 3080
},
{
"id": "marketplaces",
"label": "Marketplaces",
"group": "commerce",
"value": 780
},
{
"id": "streaming",
"label": "Streaming",
"group": "commerce",
"value": 410
},
{
"id": "security",
"label": "Security",
"group": "commerce",
"value": 360
},
{
"id": "gaming",
"label": "Gaming",
"group": "commerce",
"value": 290
},
{
"id": "electric-fleets",
"label": "Electric fleets",
"group": "energy",
"value": 790
},
{
"id": "storage",
"label": "Storage",
"group": "energy",
"value": 102
},
{
"id": "small-reactors",
"label": "Small reactors",
"group": "energy",
"value": 36
},
{
"id": "hydrogen",
"label": "Hydrogen",
"group": "energy",
"value": 22
},
{
"id": "weight-care",
"label": "Weight care",
"group": "health",
"value": 612
},
{
"id": "lab-services",
"label": "Lab services",
"group": "health",
"value": 15
},
{
"id": "orbital",
"label": "Orbital",
"group": "machines",
"value": 398
},
{
"id": "automation",
"label": "Automation",
"group": "machines",
"value": 105
},
{
"id": "robotaxis",
"label": "Robotaxis",
"group": "machines",
"value": 49
},
{
"id": "air-taxis",
"label": "Air taxis",
"group": "machines",
"value": 14
},
{
"id": "prefab-housing",
"label": "Prefab housing",
"group": "machines",
"value": 0.4
}
]
},
"options": {
"title": "Core software and online ads made up more than half of the ~$18 billion growth",
"subtitle": {
"measure": "Revenue growth, by business area",
"period": "2022–25"
},
"unit": "$m",
"source": "Illustrative data",
"notes": {
"show": [
"note",
"disclosure"
]
},
"size": {
"width": 1000
}
}
}Revenue growth as a circular treemap
Circular treemap of 19 business areas in five groups, from Core software (7,350) to small areas with leader labels; Platforms is 10,780 of about 18 billion dollars in growth.
growth-circle
JSON spec
This spec includes the theme shown and the options you selected.
Changed from the fixture: options.title; options.unit; options.size from {"width":960,"height":760} to the width of the site frame.
{
"type": "treemap",
"data": {
"groups": [
{
"id": "platforms",
"label": "Platforms"
},
{
"id": "commerce",
"label": "Commerce"
},
{
"id": "energy",
"label": "Energy"
},
{
"id": "health",
"label": "Health"
},
{
"id": "machines",
"label": "Machines"
}
],
"items": [
{
"id": "core-software",
"label": "Core software",
"group": "platforms",
"value": 7350
},
{
"id": "cloud-hosting",
"label": "Cloud hosting",
"group": "platforms",
"value": 1820
},
{
"id": "data-tools",
"label": "Data tools and services",
"group": "platforms",
"value": 1610
},
{
"id": "online-ads",
"label": "Online ads",
"group": "commerce",
"value": 3080
},
{
"id": "marketplaces",
"label": "Marketplaces",
"group": "commerce",
"value": 780
},
{
"id": "streaming",
"label": "Streaming",
"group": "commerce",
"value": 410
},
{
"id": "security",
"label": "Security",
"group": "commerce",
"value": 360
},
{
"id": "gaming",
"label": "Gaming",
"group": "commerce",
"value": 290
},
{
"id": "electric-fleets",
"label": "Electric fleets",
"group": "energy",
"value": 790
},
{
"id": "storage",
"label": "Storage",
"group": "energy",
"value": 102
},
{
"id": "small-reactors",
"label": "Small reactors",
"group": "energy",
"value": 36
},
{
"id": "hydrogen",
"label": "Hydrogen",
"group": "energy",
"value": 22
},
{
"id": "weight-care",
"label": "Weight care",
"group": "health",
"value": 612
},
{
"id": "lab-services",
"label": "Lab services",
"group": "health",
"value": 15
},
{
"id": "orbital",
"label": "Orbital",
"group": "machines",
"value": 398
},
{
"id": "automation",
"label": "Automation",
"group": "machines",
"value": 105
},
{
"id": "robotaxis",
"label": "Robotaxis",
"group": "machines",
"value": 49
},
{
"id": "air-taxis",
"label": "Air taxis",
"group": "machines",
"value": 14
},
{
"id": "prefab-housing",
"label": "Prefab housing",
"group": "machines",
"value": 0.4
}
]
},
"options": {
"title": "Core software and online ads made up more than half of the ~$18 billion growth, shown as circles",
"subtitle": {
"measure": "Revenue growth, by business area",
"period": "2022–25"
},
"unit": "$m",
"source": "Illustrative data",
"variant": "circle",
"total": "~$18 billion",
"size": {
"width": 1000
}
}
}Minimal spec
Save this spec as treemap.json and run the command.
{
"type": "treemap",
"data": {
"groups": [{ "id": "core", "label": "Core" }, { "id": "new", "label": "New" }],
"items": [
{ "id": "a", "label": "Product A", "group": "core", "value": 420 },
{ "id": "b", "label": "Product B", "group": "core", "value": 260 },
{ "id": "c", "label": "Product C", "group": "new", "value": 180 },
{ "id": "d", "label": "Product D", "group": "new", "value": 40 }
]
},
"options": {
"title": "Core products earn three quarters of revenue",
"unit": "$m",
"source": "Illustrative data"
}
}npx boardplot render treemap.json --out treemap.svg