Custom visualization
Sunburst chart
A zoomable sunburst that breaks one metric down through up to three nested dimensions. Click a slice to zoom in, the center to zoom out, and an outer slice to drill through.
Shared by Metabase team
Screenshots
Distilled prompt
Follow our guide to build your own version: Get started (opens in a new tab)
Build a Metabase custom visualization (custom viz SDK v2) called "sunburst" that shows a hierarchy as concentric rings.
Input: a query with two or three breakout columns and one numeric metric. The example uses Product Category → Customer Source → Order Year, sized by Sum of Total.
Settings:
- Dimensions: an ordered list of up to three columns, innermost ring first.
- Metric: the numeric column that sizes each slice.
Pick sensible defaults from the result columns so it renders with no setup.
Rendering:
- Draw it as SVG. Each ring is one dimension; each slice's angle is its share of its parent.
- Give each top-level slice its own color, and lighter tints of that color for its children, so a branch reads as one family.
- Write labels along the slice when they fit and truncate them with an ellipsis when they don't. Hide labels on very thin slices.
- Show the total of whatever is in view in the center, abbreviated (247.4k).
- On hover, show a tooltip with the full path, the value, and its percent of the parent and of the total.
Interactions:
- Click a slice to zoom so that slice becomes the center. Click the center to zoom back out one level. Animate the transition.
- Clicking an outermost slice drills through to the underlying rows, filtered by every value on its path.
Fit the card at any size, keep the chart circular and centered, and follow Metabase's light and dark themes.