Sunburst vs. icicle charts: choose a layout for hierarchical data
Both charts show a hierarchy with space-filling partitions. Choose the radial sunburst or rectangular icicle by reading task, depth, and label space.
Sunburst uses concentric arcs that move outward from parent to child; an icicle uses adjacent rectangles arranged by depth. Both show hierarchy through adjacency and can encode quantity with area. A treemap instead nests each child inside its parent. These layouts help explore structure, but a sorted bar chart or table is usually more suitable when exact ranking matters.
How the layouts show hierarchy
A hierarchy is a tree in which each item has one parent. Sunburst and icicle are adjacency diagrams: a node's position next to its parent and siblings shows its place in the tree. Treemap is an enclosure diagram: children sit inside the parent's rectangle. D3 documents this distinction.
| Layout | Structural cue | Consider it when | Limitation |
|---|---|---|---|
| Sunburst | Rings and arcs radiating outward | You want a compact radial overview of large branches | Deep, small arcs leave little room for labels. |
| Icicle | Rectangles in rows or columns by depth | You need to follow levels and sibling order | Deep trees consume rows and screen space. |
| Treemap | Child rectangles nested in a parent rectangle | Containment and filling the available area matter | Boundaries must make parent-child containment clear. |
Define the measure before drawing
Area is meaningful when the measure is additive, such as file size. A rate or average cannot simply be summed to create a parent value; aggregate its numerator and denominator according to the metric definition, then recompute the rate.
Illustrative file-storage example: a 100-GiB project contains a Documents folder of 60 GiB (Contracts 40, Manuals 20) and a Code folder of 40 GiB (App 30, Tests 10). Each layout first splits the project into two branches, then divides each branch among its files in proportion to file size. These are fictional values, not a measurement.
D3's node.sum applies its value function to the node and every descendant, then adds child totals. If source rows already contain both folder totals and file sizes, returning every value double-counts the files. Put the measure on leaves, or return zero for internal nodes and let their values roll up from children. D3 requires the value function to return a non-negative number; show negative changes or missing values with a more suitable chart or table rather than hiding them in area.
Choose for the reader's task
Use Sunburst for a radial overview where the reader first needs to spot major branches. Use an icicle when ordered depth bands make branch structure and sibling order easier to follow. Use treemap when the enclosing parent boundary is central. These are task-based choices, not a universal performance ranking.
If readers must answer “which file is exactly twice as large?”, area is a weak basis for precise comparison. Cleveland and McGill's 1984 experiments ranked several elementary visual judgments and found length judgments generally more accurate than area judgments. The study did not directly compare sunburst with icicle, so treat it as a general caution about area encoding, not a head-to-head result. Add a sorted bar chart on a common scale or a value table when precise ranking is the main task.
Prepare a D3 partition
This is the documented data-preparation sequence, not code claimed to have been executed:
Give each node a stable ID and valid parent. Check for one root, duplicate IDs, multiple parents, cycles, and disconnected nodes.
Decide what area means and where the raw measure lives. Avoid counting both a folder total and its files.
In D3, call `root.sum(...)` before `d3.partition()(root)`; sort first when a deliberate order is needed. D3 documents that partition assigns coordinates and that icicle layouts can be sorted by height and value.
Render those coordinates as arcs for sunburst or rectangles for icicle. Keep area and color meanings separate and explain them in a legend. Vega's official sunburst example maps file bytes to area, uses color by depth, and shows node name and bytes in a tooltip.
Compare the root, an internal folder and a leaf against the source totals. Check paths, ordering, zero/missing handling and clipped labels.
Labels, color and limits
Many tiny nodes or deep levels make labels hard to read in either layout. Plan filtering, search, collapse or zoom if users need detail; keep a tree or table alternative for the full structure. Tooltips should show the full path as well as the value, so “Tests” can be distinguished from another folder's tests.
Color can indicate depth or a category, but state its meaning. Do not rely on color alone to communicate hierarchy or status: add labels, symbols or a text/table alternative. Provide keyboard and assistive-technology users a way to inspect every node.
Before publishing
Confirm every node has a valid parent and every leaf connects to the root.
Check that the measure is additive and non-negative for area encoding.
Confirm internal totals are not counted twice and parent totals match the source.
Ensure the chosen layout answers the reader's question.
Check small nodes, deep paths, labels, tooltips, color meanings and a text alternative.
Add bars or a table if exact value comparison is important.
Sources
[D3: d3-hierarchy](https://d3js.org/d3-hierarchy) — adjacency versus enclosure diagrams.
[D3: Hierarchies](https://d3js.org/d3-hierarchy/hierarchy) — hierarchy values, non-negative `sum`, descendant aggregation and sorting.
[D3: Partition](https://d3js.org/d3-hierarchy/partition) — partition coordinates and preparation.
[Vega: Sunburst Example](https://vega.github.io/vega/examples/sunburst/) — a documented radial example with area, depth color and tooltips.
[Cleveland & McGill (1984), Graphical Perception](https://doi.org/10.1080/01621459.1984.10478080) — experiments on basic visual judgments; not a direct comparison of these layouts.
[W3C WCAG 2.2: Use of Color](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color) — do not communicate information by color alone.