Box plot

Use it to compare distributions side by side, such as the cost of a conversation by theme or the time a conversation takes by week. The box holds the middle half, the line is the median and the dots are the unusual ones. Cap the axis when one outlier would flatten the rest.

← All charts

Live demo

Made-up data. Try the options, then switch to the empty and one-point states.

Focus the chart with Tab, then use ← → Home End to move between columns; Esc closes the tooltip. On a phone, touch a column.

How to use it

Paste the toolkit from Get the code into your page first, then call the chart like this.

JavaScript
const chart = boxPlot({
  groups: themes.map(t => ({
    label: t.name,
    colour: catColor(t.name),
    values: threads.filter(x => x.theme === t.id).map(x => x.cost)
  })),
  cap: 0.35,                       // outliers above this get a ▲ and their real value
  mean: true,
  yfmt: v => '£' + (Math.round(v * 100) / 100),
  unit: 'Threads',
  label: 'Cost per thread by theme'
});
document.querySelector('#host').append(chart);

Options

What you can pass to this chart.

groups

[{ label, values: [numbers], colour? }]. The chart works out the quartiles and whiskers; a group with no values says 'no data'.

cap

Clip the axis here. Groups with outliers above it get a ▲ and the real maximum.

mean

True to add a diamond at the mean, which a long tail pulls above the median.

colour

One colour for every box (a group's own colour wins).

yfmt, unit, height

Axis and tooltip formatter, the noun for the count, and the chart height.

label / empty

aria-label for screen readers; text shown when no group has data.

Want charts or dashboards like these in your own product?

Tell me what you are trying to see and I can help work out the right approach, from the data behind it to the screen in front of people.