Box plot
The spread of several groups in five figures each: a box, its median and its whiskers.
On this page
A box plot sums a group of readings up in five figures so that several groups can be compared at once. The box runs from the first quartile to the third, a line of the surface cuts it at the median, and whiskers reach to the lowest and the highest reading within one and a half boxes of it. A reading further out is a dot of its own.
Box plot
<div class="card max-w(560) mx-auto"> <div class="card-header"> <h3 class="card-title">Latency</h3> <p class="card-description">By region, in milliseconds</p> </div> <figure class="chart" id="spread-by-region"></figure></div><script>addEventListener('DOMContentLoaded', function () {MasterUI.chart(document.getElementById('spread-by-region'), { type: 'box', label: 'Latency by region, in milliseconds', series: [ { name: 'Tokyo', values: [38, 41, 42, 44, 45, 47, 48, 49, 52, 55, 58, 96] }, { name: 'Frankfurt', values: [52, 56, 58, 60, 61, 63, 64, 66, 69, 72, 75] }, { name: 'Virginia', values: [61, 68, 71, 74, 75, 78, 80, 83, 85, 88, 92, 140, 150] } ]})})</script><script type="module"> import { attach } from '@master/ui/behaviors' attach()</script>import { Chart } from './ui/chart'<div className="card max-w(560) mx-auto"> <div className="card-header"> <h3 className="card-title">Latency</h3> <p className="card-description">By region, in milliseconds</p> </div> <Chart id="spread-by-region" type="box" label="Latency by region, in milliseconds" series={[ { name: 'Tokyo', values: [38, 41, 42, 44, 45, 47, 48, 49, 52, 55, 58, 96] }, { name: 'Frankfurt', values: [52, 56, 58, 60, 61, 63, 64, 66, 69, 72, 75] }, { name: 'Virginia', values: [61, 68, 71, 74, 75, 78, 80, 83, 85, 88, 92, 140, 150] } ]} /></div><script> import Chart from './ui/Chart.svelte'</script><div class="card max-w(560) mx-auto"> <div class="card-header"> <h3 class="card-title">Latency</h3> <p class="card-description">By region, in milliseconds</p> </div> <Chart id="spread-by-region" type="box" label="Latency by region, in milliseconds" series={[ { name: 'Tokyo', values: [38, 41, 42, 44, 45, 47, 48, 49, 52, 55, 58, 96] }, { name: 'Frankfurt', values: [52, 56, 58, 60, 61, 63, 64, 66, 69, 72, 75] }, { name: 'Virginia', values: [61, 68, 71, 74, 75, 78, 80, 83, 85, 88, 92, 140, 150] } ]} /></div><script setup>import Chart from './ui/Chart.vue'</script><template> <div class="card max-w(560) mx-auto"> <div class="card-header"> <h3 class="card-title">Latency</h3> <p class="card-description">By region, in milliseconds</p> </div> <Chart id="spread-by-region" type="box" label="Latency by region, in milliseconds" :series="[ { name: 'Tokyo', values: [38, 41, 42, 44, 45, 47, 48, 49, 52, 55, 58, 96] }, { name: 'Frankfurt', values: [52, 56, 58, 60, 61, 63, 64, 66, 69, 72, 75] }, { name: 'Virginia', values: [61, 68, 71, 74, 75, 78, 80, 83, 85, 88, 92, 140, 150] } ]" /> </div></template>Each series is one group: give its raw readings as values, and its name stands under its box. The scale fits the readings and does not start at zero. The readout lists the five figures from the top, and words names them in the page's language: { min, q1, median, q3, max }. With horizontal the boxes run across.
A box plot hides the shape between its five figures: two peaks look the same as one. Where the shape matters, draw a histogram of each group.
#Options
| Option | Default | |
|---|---|---|
label | none | What the chart shows and in what unit: the plot's accessible name |
series | [] | Each with a name and what its form reads: values, a value, points, ranges or children; optionally a category, a type, low and high, and a ring's max |
horizontal | false | Bars, ranges, dumbbells and boxes run across |
words | English | The names of a box plot's five figures: min, q1, median, q3 and max |
min, max, ticks | fit, 4 | The ends of the scale and about how many steps mark it; xMin, xMax and xTicks for a scatter's scale across |
format, tickFormat | the locale's | How a value and a tick are written; xFormat for a scatter's scale across |
current | none | The index of the point marked aria-current |
The readout, the keys, the legend, the colors and the scale are the same in every form: Chart holds them, with every option, class and custom property.