Native Solid 2 fork of solid-recharts (MIT, © Thomas Guehenneux), derived from Recharts (MIT, © recharts). Adapted documentation; neither project endorses this fork.
Treemap
Treemap is a self-contained hierarchical chart that packs a tree of data into nested
rectangles. Each rectangle's area is proportional to its data value, making it easy to
spot large and small items across hierarchies. It is not placed inside another chart
container.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
data | object[] | — | Array of top-level nodes; each may have children |
dataKey | string | function | "value" | Key or function to read each node's numeric value |
nameKey | string | function | "name" | Key to read each node's name / label |
width, height | number | "%" | — | Fixed size or percentage inside ResponsiveContainer |
aspectRatio | number | 0.5*φ (~1.6) | Squarified layout aspect ratio target |
type | "flat" | "nest" | "flat" | Render the whole tree or nested drill-down mode |
nodeGap | number | 0 | Space between sibling rectangles |
nodeInset | number | 0 | Padding inside each parent rectangle |
The base props follow the Recharts 3.9.2 Treemap API (reference commit b3451050) that solid-recharts tracks; see the Recharts Treemap reference. The next-suite release scope lists selected adaptations, not full Recharts 3.10.1 parity.
Notes
- Data shape: Each node can have a
childrenproperty (array of child nodes). Leaf nodes should have a numericdataKeyvalue; parent nodes' values are rolled up from their children. - Animation: Only entry animation is implemented: nodes slide in from the left on mount.
Update animation is not ported, and
Treemaphas noisUpdateAnimationActiveprop. - nest mode: Set
type="nest"to render an interactive treemap where clicking a parent node drills in; a breadcrumb strip at the bottom navigates back up. - Tooltip: Treemap supports item-type tooltips; hover a rectangle to see its details.
See also
- ResponsiveContainer — fluid sizing
- Tooltip — hover info