Treemap
Use it to show how a whole divides across many categories at once, when you want to see the big pieces at a glance. Small blocks lose their labels but stay hoverable and keyboard-focusable.
How to use it
Paste the toolkit from Get the code into your page first, then call the chart like this.
const chart = treemap({
items: [
{ label: 'Housing', value: 13850, colour: catColor('Housing') },
{ label: 'Groceries', value: 5120, colour: catColor('Groceries') },
{ label: 'Travel', value: 4710, colour: catColor('Travel') }
],
height: 340,
onClick: item => openCategory(item.label),
label: 'Spending by category, last 12 months'
});Options
What you can pass to this chart.
items
[{ label, value, colour }]. Zero and negative values are dropped; sorted largest first.
height
Chart height (width follows the container).
onClick
(item) => void.
setPatterns(true)
Adds a texture per block so colour is not the only cue.
More charts like this
Other charts in the “Parts of a whole” group.
Flow
Where money comes from and where it goes, as proportional ribbons.
View chart →Funnel
A journey where each step can only lose people, with the drop-off between steps.
View chart →Stacked
Parts of a whole per period, one stable colour per category.
View chart →Want charts or dashboards like these in your own product?
Tell me what you are trying to see and I can help work out the right approach, from the data behind it to the screen in front of people.