Skip to content
StatisticalGenerated from the public API

BoxPlotChart

See the distribution, the agreement or the uncertainty in the values you supply.

@luc/ui/charts

What it shows

Compare five-number summaries and explicitly supplied outliers across categories.

Live preview

Five-number summaries in percent, with the two points the caller classified as outliers.

<BoxPlotChart
  categories={["Momentum", "Value", "Carry"]}
  data={[
    [-1.8, -0.6, 0.12, 0.71, 1.9],
    [-2.4, -0.9, -0.18, 0.52, 1.6],
    [-1.2, -0.32, 0.24, 0.88, 2.2],
  ]}
  outliers={[{ category: 0, value: 2.6 }, { category: 1, value: -3.1 }]}
  format={{ kind: "percent", decimals: 1 }}
  height={320}
  ariaLabel="Dispersion by family"
/>

Controls

Height

320px

A chart measures its container, so it always needs a definite height.

State

The surface the chart is in — loading, empty and error are drawn by the component.

Accessible name

A drawing is not readable by a screen reader, so it needs a name that states what it shows.

The same fixture as the live preview above; the controls change how it is drawn, not what it measures.

Code
import { BoxPlotChart } from "@luc/ui/charts";

<BoxPlotChart
  categories={["Momentum", "Value", "Carry"]}
  data={[
    [-1.8, -0.6, 0.12, 0.71, 1.9],
    [-2.4, -0.9, -0.18, 0.52, 1.6],
    [-1.2, -0.32, 0.24, 0.88, 2.2],
  ]}
  outliers={[{ category: 0, value: 2.6 }, { category: 1, value: -3.1 }]}
  format={{ kind: "percent", decimals: 1 }}
  height={320}
  ariaLabel="Dispersion by family"
  state="ready"
/>

Not controllable here

  • series / rows — The numbers are the caller's; the fixture above is the example.
Copy for an AI agentA specification an agent can act on: the import, the setup, the chosen props, the data contract and the accessibility expectation.
Implement `BoxPlotChart` from Luc UI. It is: See the distribution, the agreement or the uncertainty in the values you supply.

Import it with: import { BoxPlotChart } from "@luc/ui/charts";
Requires: react ^19.0.0; react-dom ^19.0.0; react-hook-form ^7.0.0 (optional, for @luc/ui/forms/react-hook-form); tailwindcss ^4.0.0; node >= 22 (repository tools). Import the stylesheet once at the app root and wrap the tree in `LucProvider`. Both come from the package that publishes @luc.

Chosen configuration: `height={320}`, `state="ready"`, `ariaLabel="Dispersion by family"`.

Accessibility: keep the component's own semantics. Do not re-implement its ARIA wiring, do not add roles it does not declare, and make sure every interactive element is reachable and operable from the keyboard with a visible focus state.
Styling: use Luc UI design tokens and the component's own props. Do not restyle with raw colour literals and do not override the component's internal structure with page CSS.
Motion: respect `prefers-reduced-motion`. The component already does, so do not disable it.

Reproduce this state:
```tsx
<BoxPlotChart
  categories={["Momentum", "Value", "Carry"]}
  data={[
    [-1.8, -0.6, 0.12, 0.71, 1.9],
    [-2.4, -0.9, -0.18, 0.52, 1.6],
    [-1.2, -0.32, 0.24, 0.88, 2.2],
  ]}
  outliers={[{ category: 0, value: 2.6 }, { category: 1, value: -3.1 }]}
  format={{ kind: "percent", decimals: 1 }}
  height={320}
  ariaLabel="Dispersion by family"
  state="ready"
/>
```

Usage

The values are prepared by the caller: this component draws the points it is given and computes no statistic of its own, so units, scaling and any summary have to be settled before the data reaches it.

It is drawn by the ECharts engine.

Worked examples with real data are on the family overview: Statistical

import { BoxPlotChart } from "@luc/ui/charts";
<BoxPlotChart
  categories={["Momentum", "Value", "Carry"]}
  data={[
    [-1.8, -0.6, 0.12, 0.71, 1.9],
    [-2.4, -0.9, -0.18, 0.52, 1.6],
    [-1.2, -0.32, 0.24, 0.88, 2.2],
  ]}
  outliers={[{ category: 0, value: 2.6 }, { category: 1, value: -3.1 }]}
  format={{ kind: "percent", decimals: 1 }}
  height={320}
  ariaLabel="Dispersion by family"
/>

Data contract

`categories` name the groups; each `data` row is `[min, q1, median, q3, max]`; `outliers` are `{ category, value }` rows. The values must be supplied already.

Important configuration

Use `format` for the unit, keep quartiles ordered, and show outliers only when they are real caller-classified points rather than a second summary.

Guidelines

When not to use

Do not use a box plot to hide a multimodal distribution or to imply that no outlier exists when the summary was not inspected.

Configuration

Exported symbols
ExportKindSignature
BoxPlotChart16 documented props({ categories, data, outliers, format, tone, title, description, state, height, className, ariaLabel, ariaDescription, onReady, onEvent, }: BoxPlotChartProps) => import("@types/react").JSX.Element

BoxPlotChart props

Type: BoxPlotChartProps

Values the compiler reads from the declaration.

BoxPlotChart props
PropTypeDefaultNotes
ariaDescription?string | undefined—
ariaLabel?string | undefined—
categoriesreadonly string[]—
className?string | undefined—
datareadonly (BoxPlotSummary | null)[]—
description?string | undefined—
format?ChartFormat | undefined—
height?string | number | undefined—
onEvent?((event: EChartEvent) => void) | undefined—
onReady?((chart: EChartsInstance) => void) | undefined—
outliers?readonly BoxPlotOutlier[] | undefined—
state?ChartState | undefined—
title?string | undefined—
tone?SeriesTone | undefined—
xLabel?string | undefined—Display name of the value axis ("Return", "Observations"). An unlabelled pair of numbers leaves the reader to guess which axis is the bin and which is the count. The name is prese…
yLabel?string | undefined—

Accessibility

A chart is a picture of data, so it needs a name that states what it shows, and the numbers must exist as text somewhere on the page — in a table or a written summary — because a drawing is not readable by a screen reader and cannot be copied.

What happens on the server, and when hydration changes it.

Luc UI v1.0BoxPlotChartdark theme