Treemap
Hierarchical rectangle area chart, single-level slice-and-dice layout.
Basic usage
Data comes in via props; rendered as pure SVG with no third-party charting dependency.
Colors come from the --viz-1..8 tokens, colorblind-friendly.
Demo source
<CfTreemap ... /> <CfTreemap ... /> Label visibility
showLabels=false shows only color blocks — useful for thumbnail layouts. Text only appears when a rectangle is large enough (w>50, h>20).
5 个节点(label 显示)
label 隐藏
Demo source
<CfTreemap :nodes="nodes" />
<CfTreemap :nodes="nodes" :show-labels="false" /> <CfTreemap nodes={nodes} />
<CfTreemap nodes={nodes} showLabels={false} /> API
| Prop | Type | Default | Description |
|---|---|---|---|
nodes | TreemapNode[] | — | { name, value, colorIndex? }[] |
width / height | number | 480 / 240 |
反馈与讨论
Treemap · Discussion