/

Treemap

Visualize hierarchical data as nested rectangles. Area represents magnitude. Great for showing proportions within a hierarchy.

Usage

example.tsx
import { TreemapChart } from "@chartts/react"

<TreemapChart
  data={marketData}
  value="marketCap"
  label="company"
  color="sector"
/>

Props

PropTypeDescription
dataTreeNode[]Hierarchical data structure
valuekeyof TKey for area sizing
labelkeyof TKey for cell labels
colorkeyof T | stringColor key or fixed color
paddingnumberPadding between cells. Default: 2

Features

  • Nested hierarchies
  • Squarified layout algorithm
  • Cell labels with auto-sizing
  • Color by category or value
  • Interactive drill-down
  • Animated transitions

Other Charts