Box plot chart reference

Box plot examples

Contents: Use cases, Chart IDs, Minimal spec, Data, Options, Annotations, Sizing, Fixtures, Not for.

Compares group distributions from raw observations — type-7 quartiles, a declared whisker rule, individually drawn outliers, and a mandatory per-group n. Type box. Aliases: boxplot, box-and-whisker.

Use cases

Chart IDs

One form; its chart ID is box.

Minimal spec

{
  "type": "box",
  "data": {
    "groups": [
      { "id": "north", "label": "North", "observations": [4, 5, 6, 7, 8, 10] },
      { "id": "south", "label": "South", "observations": [3, 4, 5, 6, 7, 9] }
    ]
  },
  "options": {
    "unit": "days",
    "title": "North has a higher median delivery time",
    "source": "Illustrative data"
  }
}

Data

PathTypeRequiredMeaning
groupsarrayyesObservation groups whose quartiles and whiskers are computed by the engine. Rows: category,value; optional categoryLabel,date.
groups[].idstringyesNonempty stable identifier used to match data, labels and annotation anchors.
groups[].labelstringVisible group name; defaults to the group id.
groups[].datestringISO observation date for CAGR between group snapshots; requires a positive date interval.
groups[].observationsarrayyesRaw observations. Pre-computed q1/median/q3 are rejected in v1: quartiles the engine cannot recompute cannot be checked.

Options

PathTypeValuesDefaultMeaning
valueAxis.breakfalse | objectfalse (or another value of its type)No break by default or with false. Set { from, to, style? } for a straight value-axis break; the omitted span collapses to a fixed 12px gap when valid. Automatic placement is supported only by waterfall and pvm.
columnOverridesobjectSettings per generated column. Ids: label, n, median.
columnOverrides.*.widthnumberTrack width in px. It beats the width the type would pick.
columnOverrides.*.headAlignstring'left', 'right', 'center'Head alignment; defaults to align.
columnOverrides.*.labelstringHead text.
axisTitlesobjectTitle of the value axis when it is drawn: under the tick row, ending at the right end of the axis. Drawn only when authored.
axisTitles.primarystring'Measure, unit' title of the value axis, e.g. 'Margin, %'.
whiskersstring'tukey', 'minmax', 'p10p90''tukey'Whisker rule. 'tukey' (default): most extreme observations within 1.5xIQR of the quartiles. 'minmax': whiskers reach every observation. 'p10p90': whiskers at the 10th/90th type-7 percentile.
showOutliersbooleantrueDraw values beyond the whisker rule individually. Default true; ignored for minmax. Under 'tukey' those values are outliers; under 'p10p90' they are the outer deciles, which every sample has. Setting it false withholds real observations from both the ink and the value axis, and the exhibit says so in a footnote.
showObservationsstring'none', 'small-n''small-n'Default 'small-n': groups with fewer than 5 observations plot their values instead of a box.
methodNotebooleanfalseDefault false. true adds the footnote stating the quartile definition and the Tukey whisker rule. A 'minmax' or 'p10p90' whisker rule changes what whiskers and dots mean, so its note prints regardless, as do the small-n dot note and the note on withheld observations.
boxValuesstring'median', 'all''median'Default 'median': each box prints its median. 'all' also prints Q1 and Q3 under the box edges and the whisker ends under the caps, so a quartile or percentile reads as a number.

Plus the shared options. This type does not accept detailFields, labelPosition, valueAxis.tickStep, valueAxis.includeZero, valueAxis.percent, valueAxis.log, valueAxis.reverse, hatchStrength, rounding. This type ignores animate, debug, categoryAxis, categoryLabels, secondaryAxis, topN, bandFraction, legend with an option-ignored warning.

Annotations

An annotation anchor is a category or item id string, or an object with categoryId plus optional seriesId, segmentId and edge (start, end, total); pointId addresses a scatter point. Category anchors, including from/to, take category ids, not category labels.

KindPurposeRequiredAnchorsOptional fieldsNotes
cagrDraws a growth arrow between two anchored points and computes the compound annual growth rate from their values and ISO-date span.from: AnchorRef (optional); to: AnchorRef (optional)suffix: string, default 'p.a.'. Text after the rate. period: boolean. Print the period before the rate from the anchors' category labels, '2014–2019: +5.8% p.a.'. Default true when the chart carries two or more CAGRs, so nested brackets are told apart by their text, false otherwise. An arrow's ends show its span, so an arrow prints the rate alone unless period is true. shape: bracket | arrow, default bracket. arrow draws one straight arrow over the marks with the rate in an oval on it, lifted until it clears them. Where no straight line clears the chart, the span is too short for the oval, a stack's inner layer is the anchor or the chart lays comparisons out itself, it draws the bracket and warns cagr-arrow-no-room.Omitted endpoints span the first to the last category, or the first to the last total on a waterfall. Resolved endpoints need a positive date interval from ISO dates or year-bearing labels and a positive start value; an end of zero reads -100%, and a start at or below zero or a negative end omits the rate and warns cagr-undefined. On a continuous time axis the years are the exact span between the two readings. An anchor on one series of several (seriesId, or a category of an unstacked line, which reads the first drawn series; on a stack a category reads the stack total) names that series in the label, "Product B +10.1% p.a.", and the arm runs from that series' segment or point. In text, ${value} prints the rate with its suffix, so "CAGR 2014–2019: ${value}" keeps the computed number.
diffDraws a level-difference arrow between two anchors and computes either percent change or their signed value difference.from, tofrom: AnchorRef; to: AnchorRefmode: relative | absolute | reversed | both, default relative. relative prints the percent change from 'from' to 'to', reversed the change from 'to' to 'from', absolute the value difference, both the value difference with the percent change beside it.Mode defaults to relative. Relative and reversed changes need a nonzero base; negative bases use its absolute magnitude and emit a warning. Absolute mode reports the raw value difference. A hidden label removes its arm.
deltaComputes the signed difference between an anchored value and another anchor or literal, then places a collision-managed label at the first anchor.at, vsat: AnchorRef; vs: AnchorRef | numbermode: absolute | relative | both, default absolute. absolute prints at minus vs, relative the percent change from vs to at, both the two as '+149 (+36%)'. relative and both need a nonzero vs.
textPlaces authored text at a point through the label solver: on the point, or above, below, right or left of it. The text prints as written.at, textat: AnchorRef | { categoryId, value }A point is an anchor or { categoryId, value } with value in axis units. A value outside the plot, a chart with no value scale or an anchor that does not resolve warns bad-anchor and draws nothing; the axis does not grow. The text prints as written, ${value} included. It takes id and priority, and no other field.
lineDraws a straight line between two points or from a text annotation, in the ink and rule width of a bracket; a stretch that would cross text is cut.from, tofrom: AnchorRef | { categoryId, value } | { annotationId }; to: AnchorRef | { categoryId, value } | { annotationId }dashed: boolean, default false. Draws the line in the dash of a reference line.A point is an anchor or { categoryId, value } with value in axis units. A value outside the plot, a chart with no value scale or an anchor that does not resolve warns bad-anchor and draws nothing; the axis does not grow. An end { annotationId } names a text annotation: the line starts or ends at the nearest edge of that text, at every size, and is not drawn when the text is not. A { categoryId, value } end stands on the category's center. A stretch that would cross text is cut and warns draw-crosses-text. It takes dashed and id, and no other field.
arrowDraws a straight arrow between two points or from a text annotation to a point, in the theme arrow look (marks.arrow); a stretch that would cross text is cut.from, tofrom: AnchorRef | { categoryId, value } | { annotationId }; to: AnchorRef | { categoryId, value } | { annotationId }dashed: boolean, default false. Draws the shaft in the dash of a reference line.A point is an anchor or { categoryId, value } with value in axis units. A value outside the plot, a chart with no value scale or an anchor that does not resolve warns bad-anchor and draws nothing; the axis does not grow. An end { annotationId } names a text annotation: the arrow starts or ends at the nearest edge of that text, at every size, and is not drawn when the text is not. A { categoryId, value } end stands on the category's center. A stretch that would cross text is cut and warns draw-crosses-text. It takes dashed and id, and no other field.
boxDraws an unfilled box with two points as opposite corners, wrapping whole category bands, in the ink and rule width of a bracket; text inside the box stays free.from, tofrom: AnchorRef | { categoryId, value }; to: AnchorRef | { categoryId, value }dashed: boolean, default false. Draws the edges in the dash of a reference line.A point is an anchor or { categoryId, value } with value in axis units. A value outside the plot, a chart with no value scale or an anchor that does not resolve warns bad-anchor and draws nothing; the axis does not grow. from and to are opposite corners, the box has no fill, and text inside it stays free. A { categoryId, value } corner spans that category's whole band, so the box wraps whole bars, values and markers; from and to on one category wrap that category. A stretch that would cross text is cut and warns draw-crosses-text. It takes dashed and id, and no other field.

Sizing

Floor 280 × 270 px; fit fill. Below 270 px high, down to the compact floor of 280 × 180 px, the chart draws in compact mode; belowMinimum: 'refuse' refuses there instead.

Below the floor a render is refused with size-below-floor and the pixels it needs. measure returns the natural and comfortable size for a given spec; see Sizing in the manual.

Fixtures

IDKindUse case
deal-size-by-regionexampleDeal-size distributions: DACH carries the long right tail
cycle-time-by-teamexampleCycle-time spread by team, with the slow tickets shown individually
salary-bands-p10p90examplePercentile whiskers put a tenth of the sample outside each end by construction
mixed-support-groupstortureMixed support samples: empty, tiny, and zero-spread groups each say why they drew no box
dated-median-growthexampleMedian order value grew 20% annually across two snapshots
deal-size-minmaxexampleDeal-size distributions with full-range whiskers and no observation dots
torture-long-labelstortureTorture: long names at a generous size read whole, never cut
outliers-withheld-method-noteexampleOutliers withheld from the ink and the axis, with the quartile and whisker rule stated
salary-bands-pinned-medianexampleThe IC5 median label pinned above its box through labelPlacements
twelve-teams-median-columnexampleTwelve dense rows print their medians in one column beside n
outliers-axis-breakexampleA value-axis break across the empty range keeps two far outliers visible
column-overridesexamplecolumnOverrides sets the name and n columns

Not for

Precomputed quartiles; box takes raw observations and computes them.