Skip to content

Treemap Chart ^0.1.18 ​

Proportional rectangles packed to fill a rectangle. Works great for parts-of-a-whole with many items, hierarchies, and storage/market-cap visualizations.

Basic ​

Chrome62Safari19Edge
vue
<VxTreemapChart
  :data="[
    { name: 'Chrome',  value: 62 },
    { name: 'Safari',  value: 19 },
    { name: 'Edge',    value: 9 },
    { name: 'Firefox', value: 5 },
    { name: 'Other',   value: 5 },
  ]"
/>

Programming languages ​

JavaScript4.8k · 30.1%TypeScript3.2k · 20.1%Python2.8k · 17.6%GoJavaRustC++680 · 4.3%
vue
<VxTreemapChart :data="languages" showPercents />

Stock market cap ​

Apple3.2kMicrosoft3.1kNVIDIA2.6kGoogle2.1kAmazon1.9kMeta1.3kBerkshire900Tesla800TSMC720
vue
<VxTreemapChart :data="market" />

Hierarchical — file system ​

Groups render as outlines; leaves fill with color.

node_modulesothers340vue120vite85typescript62srccomponents280utils45locale32dist210docscomponents180guide25tests95
vue
<VxTreemapChart
  :data="[
    { name: 'node_modules', children: [
      { name: 'vue',        value: 120 },
      { name: 'vite',       value: 85 },
      ...
    ]},
    { name: 'src', children: [...] },
    { name: 'dist', value: 210 },
  ]"
/>

Hierarchical revenue ​

EnterpriseBanking1.8k · 31.1%Retail1.2k · 20.7%Health800 · 13.8%SMBStartup950 · 16.4%Agency620 · 10.7%Consumer420 · 7.3%
vue
<VxTreemapChart :data="revenue" showPercents />

Custom colors per leaf ​

Housing1.2kSavings600Food450Transport280Other220Utilities180
vue
<VxTreemapChart
  :data="[
    { name: 'Housing',   value: 1200, color: '#6366f1' },
    { name: 'Food',      value: 450,  color: '#22c55e' },
    ...
  ]"
/>

Minimal (no labels) ​

vue
<VxTreemapChart :data="market" :showLabels="false" />

Compact gap ​

JavaScript4.8kTypeScript3.2kPython2.8kGo1.4kJava1.1k
vue
<VxTreemapChart :data="data" :gap="0" :radius="0" />

Props ​

PropTypeDefaultDescription
dataTreemapNode[][]Tree of { name, value?, color?, children? }
heightnumber360SVG height
gapnumber2Gap between tiles
radiusnumber4Tile corner radius
colorsstring[][]Palette override
showLabelsbooleantruePrint node names inside
showValuesbooleantrueShow numeric value
showPercentsbooleanfalseShow % of total
tooltipbooleantrueHover tooltip
animatebooleantrueFade in on mount

Events ​

EventPayload
hover{ node, path }
click{ node, path }