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

Distilled prompt

249 words

Follow our guide to build your own version: Get started (opens in a new tab)

Read the prompt before you paste it into an AI tool, and check that it only does what you expect.

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.

  • Custom visualization

    Cohort retention heatmap

    A retention triangle: rows are the month an account first paid, columns are months since then, and each cell is the share of that cohort still active. Hover for counts, click to drill through.

    By Metabase team

  • Custom visualization

    Strike zone

    Plots every pitch a pitcher threw where it crossed the plate, colored by pitch type, with the strike zone drawn from the batter's own zone limits. The example is Zack Wheeler's season.

    By Metabase team