Circle Packing
Source: Data Visualisation Catalogue - Circle Packing
Why This Belongs In The Compiler Gallery
Circle packing is a hierarchy layout problem. The visible marks are circles, but the useful compiler capability is normalizing parent-child rows into aggregate hierarchy values and deriving nested circle positions and radii.
Data Contract
Each raw row is one hierarchy node.
| Field | Type | Purpose |
|---|---|---|
node | categorical | Stable node id. |
parent | categorical/null | Parent node id; null identifies the root. |
label | text | Visible node label. |
value | quantitative | Leaf metric used for aggregate sizing. |
aggregateValue, depth, childCount | derived | Hierarchy normalization output. |
cx, cy, r | quantitative, derived | Packed circle geometry. |
Compiler Mapping
| Compiler part | Mapping |
|---|---|
| Data source | Raw hierarchy-rows, normalized hierarchy, and derived circles. |
| Transform | hierarchy normalizes parent-child rows; layout with layoutKind: "circlePack" derives circle geometry. |
| Scales | Ordinal depth color. |
| Layers | Point glyphs render circles; text glyphs render labels where circles are large enough. |
Faithfulness Notes
This is a first-pass deterministic circle-pack layout. It establishes compiler-owned hierarchy aggregation and nested circle output, but it is not yet a full front-chain packing engine with optimal sibling placement.