Skip to main content
196

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Web docs
Data display

BoxPlot

Shows precomputed quartiles, whiskers and outliers.

FrameworksAstro · React · Elements

Registry commandlumen add BoxPlot

InteractionNative markup

← All chart guides · Framework setup · Native counterparts

01

See it and copy it

Framework example

Explore the live chart, then open its code for Astro, React, or Elements.

AstroCode target · live preview uses Astro

Response-time distribution

Precomputed statistics · milliseconds

Search. Lower whisker: 40 ms. First quartile: 58 ms. Median: 72 ms. Third quartile: 92 ms. Upper whisker: 115 ms. Outliers: 140 ms. Checkout. Lower whisker: 65 ms. First quartile: 80 ms. Median: 105 ms. Third quartile: 130 ms. Upper whisker: 160 ms. Outliers: 190 ms.

  • SearchMedian: 72 ms
  • CheckoutMedian: 105 ms
View chart data
CategoryLower whiskerFirst quartileMedianThird quartileUpper whiskerOutliers
Search40 ms58 ms72 ms92 ms115 ms140 ms
Checkout65 ms80 ms105 ms130 ms160 ms190 ms
View BoxPlot code

Framework usage

Switch targets to compare the adapter code. This live preview runs the Astro example. React and Elements use their own behavior APIs; complete the matching framework setup before copying an example.
astro
---
import { BoxPlot } from '@santi020k/lumen-astro'

const data = [
  { id: 'search', label: 'Search', min: 40, q1: 58, median: 72, q3: 92, max: 115, outliers: [140] },
  { id: 'checkout', label: 'Checkout', min: 65, q1: 80, median: 105, q3: 130, max: 160, outliers: [190] }
]
---

<BoxPlot
  aria-label="Response-time distribution"
  heading="Response-time distribution"
  description="Precomputed statistics · milliseconds"
  data={data}
  domain={{ min: 0, max: 200 }}
  formatValue={value => `${value} ms`}
/>
Edit BoxPlot in browser

When to use BoxPlot

Use to compare the spread and center of several populations when the underlying summary statistics are already available.

  • The box spans q1 through q3, the middle marker is the median, and the whiskers end at min/max. Separate dots show supplied outliers.
  • State the quartile and whisker convention in a caption. Use statisticLabels and formatValue to name and format exact values for your audience.

Prepare the data

ts
import type { LumenBoxPlotDatum } from '@santi020k/lumen-core'

const data = [{
  id: 'search',
  label: 'Search',
  min: 40,
  q1: 58,
  median: 72,
  q3: 92,
  max: 115,
  outliers: [140]
}] satisfies readonly LumenBoxPlotDatum[]
  • Compute the statistics in your application. Each uniquely identified row must satisfy min ≤ q1 ≤ median ≤ q3 ≤ max with finite numbers.
  • min and max are the supplied whisker bounds. Lumen does not calculate quartiles, choose a whisker rule, or detect outliers.
  • Use all five statistics as null for a missing summary, with no outliers. Partial-null summaries are invalid. A supplied domain must enclose every statistic and outlier.

Shared data and formatting guidance →

Avoid misleading comparisons

  • Do not label whisker bounds as the absolute minimum and maximum when your statistical method excludes outliers.
  • A box plot does not reveal sample size or multiple peaks. Add that context or use a Histogram when distribution shape matters.

Chart accessibility and keyboard guidance →

02

Choose your target

Add this component

Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.

bash@santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
bashAstro wrapper
lumen add BoxPlot
lumen add BoxPlot

API reference

Lumen-specific props and runtime attributes for the Astro primitive. Use the framework differences above and the copyable examples for React composition and Elements attributes; the public adapter types define their supported contracts.

AttributeValuesDefaultDescription
datareadonly LumenBoxPlotDatum[]requiredPrecomputed min, q1, median, q3, max and optional outliers. All five null represents a missing summary.
domainLumenChartDomainautomaticIncludes all whiskers, quartiles and outliers. Invalid or unordered summaries fail closed.
formatValue, statisticLabels, labelsFormatter and localized labelsEnglishNames and formats every statistic in visible and accessible content.
showTablebooleantrueRetains exact statistics and outliers in a keyboard-accessible data disclosure.
class, classNamestring""Merges custom classes with the generated ui-* root classes.
...native attributesHTML attributes-Forwards standard attributes to the root element unless the component consumes them.

Web docsFull catalog