Skip to content
WunderUI

Distribution Chart

Pro

Distribution chart for raw observations: histograms, box plot, violin, density, ridgeline, strip plot and error bars.

Playground

Response time

  • API
Distribution chart, 24 points from 84 ms to 275 ms. API from 14 ms to 2 ms, lowest 1 ms, highest 41 ms.
Response time, data table
binAPI
84 ms14 ms
92 ms30 ms
101 ms34 ms
109 ms32 ms
117 ms41 ms
125 ms41 ms
134 ms40 ms
142 ms30 ms
150 ms32 ms
159 ms24 ms
167 ms22 ms
175 ms14 ms
184 ms11 ms
192 ms6 ms
200 ms7 ms
208 ms5 ms
217 ms2 ms
225 ms4 ms
233 ms1 ms
242 ms2 ms
250 ms3 ms
258 ms2 ms
266 ms1 ms
275 ms2 ms

Installation

Distribution Chart comes with WunderUI Core and Pro, in the package from your plan. See the plans.

The charts live in their own entry point: import the chart, its card and its hooks from @wunderui/react/charts, not from @wunderui/react.

Then import what you need:

tsx
import {
  DistributionChart,
  DistributionChartProps,
  DistributionChartVariant,
} from "@wunderui/react/charts"

Then use it:

tsx
import { DistributionChart } from "@wunderui/react/charts"

const groups = [{ label: "API", values: [82, 91, 88, 120, 95, 140, 87, 99, 210, 101] }]

export function ResponseTime() {
  return <DistributionChart groups={groups} label="Response time" />
}

Expected result: You see a histogram of the ten response times, with most of them in the left bars and one slow value to the right.

When to use

Use Distribution Chart for

  • How raw observations spread: latencies, durations, sizes
  • Comparing the spread of two or three groups (boxplot, violin, ridgeline)
  • Percentiles marked on a histogram

Use something else for

States

Loading, empty and error keep the chart's size, so the card never jumps. Add a retry handler and the error state offers a Try again button.

Response time

  • API
Distribution chart, 24 points from 84 ms to 275 ms. API from 14 ms to 2 ms, lowest 1 ms, highest 41 ms.
Response time, data table
binAPI
84 ms14 ms
92 ms30 ms
101 ms34 ms
109 ms32 ms
117 ms41 ms
125 ms41 ms
134 ms40 ms
142 ms30 ms
150 ms32 ms
159 ms24 ms
167 ms22 ms
175 ms14 ms
184 ms11 ms
192 ms6 ms
200 ms7 ms
208 ms5 ms
217 ms2 ms
225 ms4 ms
233 ms1 ms
242 ms2 ms
250 ms3 ms
258 ms2 ms
266 ms1 ms
275 ms2 ms

Keyboard interactions

The plot is focusable: arrow keys walk the bins, or the groups on box, violin, strip and error-bar variants, and the live region reads each one.

TaborShiftTab
Moves focus to the plot and away from it. The plot is one tab stop; so is every legend badge.
ArrowRightorArrowLeft
Moves to the next or previous bin. The tooltip follows, and a live region announces the one you are on. The first press starts at the first one (Left: the last one).
HomeorEnd
Jumps to the first or last bin.
Escape
Clears the active point.
EnterorSpace
On a legend badge of a ChartCard: switches its series off or on. The last visible series stays on.

Behavior and motion

What the chart does on its own and what the page decides.

Raw values in
Groups take a label, a colour and the raw numbers, not summaries. Bins, quartiles and densities are computed inside the chart, and the bin count sets the histogram resolution (24 by default).
Markers
Markers draw labelled vertical lines at values such as p50 and p95, or a service-level target.
Box plot
The box runs from Q1 to Q3 with the median inside. Whiskers reach 1.5 times the interquartile range, and points beyond are drawn as outlier dots.
Axis
The count axis of histograms and densities starts at 0, the cumulative one runs 0 to 100 percent, and the other variants fit the axis to the data. Ridgeline drops the value axis.
Loading, empty and error
Loading shows a shimmering skeleton, empty and error show a centred message, and error adds a Try again button when a retry handler is set. The card never changes height.
Legend
A ChartCard shows the series as badges. With two or more, each badge toggles its series off (the last visible one stays on), and a static legend works for roles.
Size
The chart fills the width of its container, and a height setting controls the plot. Text never scales, so labels keep their size at every width.

Motion

The enter sequence and the hover follow the motion tokens of the library.

Enter
The marks play an enter sequence the first time the chart is in view, and again after loading or when the data changes. It can be turned off.
Reduced motion
With reduced motion the enter sequence is off and the chart appears at once. The tooltip, the crosshair and every state still work.

Anatomy

DistributionChart shows how raw observations spread, as histograms, boxplot, violin, density, ridgeline, strip plot or error bars. It computes bins, quartiles and densities itself.

Response time

Distribution chart, 24 points from 80 ms to 259 ms. API from 9 ms to 1 ms, lowest 0 ms, highest 9 ms.
Response time, data table
binAPI
80 ms9 ms
88 ms3 ms
96 ms3 ms
103 ms1 ms
111 ms2 ms
119 ms2 ms
127 ms1 ms
135 ms2 ms
142 ms4 ms
150 ms1 ms
158 ms2 ms
166 ms0 ms
174 ms0 ms
181 ms0 ms
189 ms1 ms
197 ms2 ms
205 ms0 ms
212 ms1 ms
220 ms0 ms
228 ms0 ms
236 ms0 ms
244 ms0 ms
251 ms1 ms
259 ms1 ms
  • Takes groups, each with a label, a colour and the raw numbers, not summaries. The bin count sets the histogram resolution (24 by default) and markers draw lines such as p50 and p95.

  • data-slot="chart-plot"

    The focusable region. Arrow keys walk the bins, or the groups on box, violin, strip and error-bar variants, and the live region reads each one.

  • data-slot="chart-grid"

    The count axis of histograms and densities starts at 0, the cumulative one runs 0 to 100 percent, and the other variants fit the axis to the data. Ridgeline drops the value axis.

  • data-slot="chart-marks"

    Bars for histograms, a box with whiskers and outlier dots for boxplot, a mirrored curve for violin, a smoothed line for density and ridgeline, and jittered dots for strip plot.

  • Optional

    Vertical reference lines with a label, for percentiles or a service-level target.

  • data-slot="chart-tooltip"Optional

    The bin with its count, or on box variants the median, Q1 to Q3 and range, and on error bars the mean and one standard deviation.

  • data-slot="chart-message"Optional

    Muted columns, or rows on ridgeline, under the shimmer; density loads as a muted area. Empty and error use the shared message and Try again button.

  • Bins or summary statistics as a table for screen readers.

Best practices

  • Do

    Pass the raw observations. Pre-aggregated bins break the quartiles and the density, because the chart aggregates once and the same way everywhere.

  • Do

    Pick bins for the story. Around 20 to 30 shows the shape of a few thousand points, fewer than 10 hides it, and charts you compare should share one bin width.

  • Do

    Mark the percentiles people act on, such as p50 and p95. A long tail looks harmless until a line shows where most requests end.

  • Don’t

    Don't use density or violin curves for fewer than about 30 points. The smoothing invents a shape, so show a strip plot of the points instead.

  • Don’t

    Don't compare groups with histograms of different bin widths. Use a layered histogram or boxplot, which share one scale.

API reference

One table covers DistributionChart and lists every prop. The ChartCard around it has its own props, and the chart works without one.

Takes groups, each with a label, a colour and the raw numbers, not summaries. The bin count sets the histogram resolution (24 by default) and markers draw lines such as p50 and p95.

PropTypeDefaultDescription
groups requiredreadonly DistributionGroup[]—Raw observations per group (histogram variants use the first one or two).
variant"histogram" | "cumulative-histogram" | "layered-histogram" | "boxplot" | "violin" | "density" | "ridgeline" | "strip-plot" | "error-bars""histogram"Figma variant. Default .
binsnumber24Number of bins of the histogram variants (default 24).
markersreadonly { value: number; label: string }[]—Vertical markers on the value axis, e.g. p50 / p95.
valueFormatterChartValueFormatter—Values in tooltip, labels, table and live region. Default: 42000 → "42k".
labelstring—Accessible name, e.g. the card title.
heightnumber—Height of the plot frame in px. Default 434 = the plot of the Figma large card.
state"ready" | "loading" | "empty" | "error"— shows the chart-shaped skeleton, and a message in the plot.
activeIndexnumber | null—The active point (hovered or focused) as an index into , to control it yourself. shows none.
animateboolean—Enter sequence (draw, wipe, grow) on scroll into view, after loading and on new data. Default true; off with reduced motion.
animationKeystring | number—Change it to play the enter sequence again (e.g. ). New replays it by itself.
axisFormatterChartValueFormatter—Value-axis labels; defaults to .
categoryAxisboolean—Category-axis labels (default true).
categoryFormatter(label) => string—Shortens category labels on the axis, e.g. "Mar 12" → "Mar"; tooltip and pill keep the full label.
categoryTicksreadonly string[]—Only these category labels are shown on the axis (the rest stay hoverable).
defaultActiveIndexnumber | null—The point that is active at first, for an uncontrolled chart. It shows the tooltip without a pointer.
defaultSelectedRangeChartRange | null—The range that is selected at first, for an uncontrolled chart.
descriptionstring—Screen-reader summary; generated from the data when omitted.
emptyDescriptionstring—Text under the title in the empty state.
emptyTitlestring—Title of the message in the empty state.
errorDescriptionstring—Text under the title in the error state.
errorTitlestring—Title of the message in the error state.
gridboolean—Grid lines (default true).
gridIntervalsnumber—Number of equal grid intervals (default 6 = 7 grid lines like the Figma cards).
gridStyle"solid" | "dashed"— draws the grid lines 4 / 4 dashed (dense dashboards).
hiddenSeriesreadonly string[]—Series keys that are switched off (legend toggle): drawn faded, dimmed in the tooltip.
includeZeroboolean—The value axis starts at 0 (owner rule, default). fits the data (prices, temperatures).
onActiveIndexChange(index) => void—Called with the index when the pointer or the arrow keys move to another point, and with when they leave. Use it to show the hovered value in a headline.
onRetry() => void—Shows a Try again button in the error state and calls this when it is pressed.
onSelectedRangeChange(range) => void—Called when a drag across the plot or Shift with an arrow key changes the range, and with when Escape or a click clears it.
rangeSelectableboolean—Allow selecting a range by dragging or Shift + arrow keys. On when is set.
selectedRangeChartRange | null—The selected range as inclusive indices into , to control it yourself. selects nothing.
tooltipboolean—Tooltip on hover / keyboard focus. Default true.
tooltipTitle(datum, index) => ReactNode—Title line of the tooltip; defaults to the category label.
valueAxisboolean—Value-axis labels (default true). Off for compact cards and sparkline-like plots.
valueAxisSide"left" | "right"—Side of the value axis (vertical charts). is the price axis of trading charts.
valueDomainreadonly [number, number]—Fix the value domain instead of fitting it to the data (still rounded to nice steps).
valueTicksreadonly number[]—Exact value-axis ticks (ascending), e.g. [0, 10000, … 70000]; replaces the nice-step domain.
widthnumber—Fixed width instead of filling and measuring the container.

Notes for AI

Give your coding assistant the Markdown reference instead of screenshots.

MCPget_component("distribution-chart")
InstallIncluded in Core and Pro

The full library index for assistants is at /llms.txt.