BoxPlot
Compare distributions with explicit quartiles, whiskers and outliers.
Loading chart…
| Endpoint | Lower whisker (ms) | Q1 (ms) | Median (ms) | Q3 (ms) | Upper whisker (ms) | Outlier (ms) |
|---|---|---|---|---|---|---|
| Search | 18 | 32 | 44 | 61 | 84 | 112 |
| Checkout | 26 | 46 | 68 | 88 | 126 | 154 |
| Profile | 12 | 22 | 31 | 46 | 72 | 98 |
Usage
Supply caller-computed quartiles, whiskers and outliers to BoxPlotSeries.
<Chart.Root config={config}>
<Chart.Legend />
<Chart.ResponsiveContainer width="100%" height={280}>
<Chart.BoxPlotChart data={data} animate accessibilityLayer aria-label="Response time distributions">
<Chart.CartesianGrid vertical={false} />
<Chart.XAxis dataKey="period" />
<Chart.YAxis type="number" domain={[0, 180]} />
<Chart.BoxPlotSeries<(typeof data)[number]>
dataKey={(row) => ({
lowerWhisker: row.lowerWhisker,
q1: row.q1,
median: row.median,
q3: row.q3,
upperWhisker: row.upperWhisker,
outliers: [row.outlier],
})}
seriesKey="latency"
barSize={32}
/>
<Chart.Tooltip content={({ active, payload }) =>
active && payload?.[0] ? (
<div data-kind-ui="chart-tooltip">
Median: {payload[0].payload.median} ms
</div>
) : null
} />
</Chart.BoxPlotChart>
</Chart.ResponsiveContainer>
</Chart.Root>The tooltip reads the original row from payload to label statistics; native range values alone describe only the enclosing extent.
Summary contract
Supply finite ordered statistics: lowerWhisker <= q1 <= median <= q3 <= upperWhisker. Outliers must be finite and strictly outside the whiskers; duplicates remain separate, possibly overlapping marks.
Numeric domains must include every outlier; native domain inference includes them.
Compute quartiles, whiskers and outliers before rendering; Kind chooses no statistical convention. Boxes span Q1–Q3, lines mark medians and whiskers, and circles show outliers.
Equal quartiles collapse to a line. Equal whiskers, zero and negative values are valid. Missing summaries or empty data draw no marks; malformed present summaries throw.
Collapsed and missing summaries
Stable and Zero have collapsed summaries; Pending has no mark but retains its category label. Variable includes negative values and outliers.
Loading chart…
| Group | Summary (percentage points) |
|---|---|
| Stable | Lower whisker, Q1, median, Q3 and upper whisker: 5. No outliers. |
| Zero | Lower whisker, Q1, median, Q3 and upper whisker: 0. No outliers. |
| Pending | Missing summary; no mark. |
| Variable | Lower whisker: -12; Q1: -5; median: 1; Q3: 8; upper whisker: 18; outliers: -20, 24. |
Horizontal distributions
Use layout="vertical" with numeric X and categorical Y axes for horizontal boxes.
Loading chart…
| Endpoint | Lower whisker (ms) | Q1 (ms) | Median (ms) | Q3 (ms) | Upper whisker (ms) | Outlier (ms) |
|---|---|---|---|---|---|---|
| Search | 18 | 32 | 44 | 61 | 84 | 112 |
| Checkout | 26 | 46 | 68 | 88 | 126 | 154 |
| Profile | 12 | 22 | 31 | 46 | 72 | 98 |
Materials
Choose plain, paper, clay or glow. Explicit filter or style.filter overrides the finish; custom shapes can compose BoxPlotMark directly.
Loading chart…
| Endpoint | Lower whisker (ms) | Q1 (ms) | Median (ms) | Q3 (ms) | Upper whisker (ms) | Outlier (ms) |
|---|---|---|---|---|---|---|
| Search | 18 | 32 | 44 | 61 | 84 | 112 |
| Checkout | 26 | 46 | 68 | 88 | 126 | 154 |
| Profile | 12 | 22 | 31 | 46 | 72 | 98 |
API reference
Focused props for explicit range-Bar composition. BoxPlot uses public axis-scale hooks; it has no configured wrapper.
BoxPlotChart
| Prop | Type | Default | Description |
|---|---|---|---|
data | Row[] | — | Consumer-owned observations containing summaries or accessor inputs. |
layout | "horizontal" | "vertical" | "horizontal" | Native layout; "vertical" gives horizontal boxes with numeric X and categorical Y axes. |
animate | boolean | BarAnimation | false | Chart-owned clipped entrance; respects reduced motion. Native per-series animation is disabled. |
accessibilityLayer | boolean | true in Recharts | Native keyboard inspection. Set explicitly in these components. |
aria-label / aria-labelledby | string | — | Accessible plot name. |
children | ReactNode | — | Explicit series, axes, grid and tooltip. |
Custom range shapes retain inspection but cannot use Bar category emphasis. See Recharts BarChart.
BoxPlotSeries
| Prop | Type | Default | Description |
|---|---|---|---|
dataKey | (keyof Row & string) | ((row: Row) => BoxPlotSummary | null | undefined) | Required | Direct property name or accessor; nested string paths are not interpreted. |
seriesKey | string | Required | Root metadata, color and visibility identity, independent of the generated range accessor. |
material | "plain" | "paper" | "clay" | "glow" | "plain" | Static mark finish. Explicit filters and custom shapes retain ownership. |
barSize | number | string | Native automatic sizing | Category-axis width; numbers are pixels, native percentage strings are also accepted. |
outlierRadius | number | 3 | Radius of each outlier circle in screen pixels. |
shape | (props: BoxPlotShapeProps) => ReactNode | Built-in mark | Receives original summary, native Bar shape props and mapped coordinates. Owns returned markup. |
markProps | SVG group props, excluding children | — | Attributes, styles, handlers and refs forwarded to each present mark group. |
xAxisId / yAxisId | string | number | 0 | Native axes used to map statistical values. |
hide | boolean | false | Native hiding; Root controlled visibility also applies. |
Stacking, minPointSize, background, radius and activeBar are excluded. Cells, labels and handlers remain available. LabelList positions refer to the enclosing range. See Recharts Bar.
BoxPlotMark
Renders caller-owned screen coordinates; it neither computes statistics nor maps domains.
| Prop | Type | Default | Description |
|---|---|---|---|
coordinates | BoxPlotSummary | Required | Already mapped screen coordinates; these can reverse on a vertical numeric scale. |
center | number | Required | Category-axis center in pixels. |
size | number | Required | Category-axis mark width in pixels. |
orientation | "vertical" | "horizontal" | "vertical" | Direction of the quantitative geometry. |
outlierRadius | number | 3 | Screen-space circle radius. |
material | "plain" | "paper" | "clay" | "glow" | "plain" | Static finish; explicit group filters take precedence. |
strokeWidth | SVG stroke width | 1.5 | Native stroke width; explicit SVG paint stays consumer-owned. |
BoxPlotSummary and helpers
| Prop | Type | Default | Description |
|---|---|---|---|
lowerWhisker / upperWhisker | number | Required | Caller-defined finite whisker endpoints. |
q1 / q3 | number | Required | Caller-computed finite quartiles, ordered within whiskers. |
median | number | Required | Finite value between Q1 and Q3. |
outliers | readonly number[] | — | Finite observations strictly outside the supplied whiskers. |
validateBoxPlotSummary returns valid input unchanged, returns null for missing input, and throws for malformed summaries. boxPlotExtent returns the validated minimum/maximum including outliers. Neither mutates input.
Shared components
Root, SeriesConfig, Legend, Tooltip, Axes and grid, ResponsiveContainer.