Box Plot
Documentation Index
Fetch the complete documentation index at: /llms.txt. Use this file to discover all available pages before exploring further.
A composable box-and-whisker chart for comparing distributions, medians, and spread.
Overview
Use a box plot to compare the shape of several distributions without drawing every observation. Each box shows the first quartile, median, and third quartile; the whiskers show the minimum and maximum values supplied in the five-number summary.
The default variant uses a quiet translucent fill. Choose the blocks variant when stronger quartile bands make the distribution easier to scan.
Anatomy
BoxPlot owns the rows, category key, loading state, and selection. Add one Box per five-number-summary field, then compose optional Grid, XAxis, YAxis, Legend, and Tooltip parts.
Accessibility
Canvas charts need a meaningful text alternative. Provide an ariaLabel that explains the measure and categories, keep the tooltip enabled for exact values, and pair the chart with a table or written summary when the distribution is essential to the task. Do not rely on fill color alone to distinguish series.
Installation
Usage
Each box value is an ordered tuple of [minimum, firstQuartile, median, thirdQuartile, maximum].
import { BoxPlot, type BoxPlotValue, type ChartConfig } from "honestui/charts";const data: { region: string; latency: BoxPlotValue }[] = [
{ region: "North America", latency: [42, 58, 71, 86, 119] },
{ region: "Europe", latency: [38, 52, 66, 79, 108] },
];
<BoxPlot data={data} config={chartConfig} xDataKey="region">
<BoxPlot.Grid />
<BoxPlot.XAxis />
<BoxPlot.YAxis />
<BoxPlot.Legend />
<BoxPlot.Tooltip />
<BoxPlot.Box dataKey="latency" variant="default" />
</BoxPlot>ECharts renders to a <canvas>, so the compound children are declarative configuration rather than live DOM nodes. Colors come from the same theme-aware ChartConfig used by the other Honest UI charts.
Blocks Variant
The blocks variant draws hard color bands inside each box. Give the series multiple colors in ChartConfig to control the bands, or provide one color and the chart will derive four opacity levels automatically.
Loading State
Pass isLoading to preserve the chart dimensions with neutral placeholder boxes and the shared loading treatment.