EcdfChart
See the distribution, the agreement or the uncertainty in the values you supply.
@luc/ui/chartsWhat it shows
Compare full sample distributions through their cumulative probability, including tails rather than only a mean.
Live preview
Twelve order statistics per sample, drawn as a step because a cumulative distribution is a step function.
<EcdfChart
series={[
{
key: "baseline",
label: "Baseline",
tone: "neutral",
points: [
{ x: -2.9, y: 0 },
{ x: -2.9, y: 0.08 },
{ x: -2.1, y: 0.17 },
{ x: -1.4, y: 0.25 },
{ x: -0.8, y: 0.33 },
{ x: -0.3, y: 0.42 },
{ x: -0.3, y: 0.5 },
{ x: 0.2, y: 0.58 },
{ x: 0.7, y: 0.67 },
{ x: 1.1, y: 0.75 },
{ x: 1.8, y: 0.83 },
{ x: 2.6, y: 0.92 },
{ x: 3.4, y: 1 },
],
},
{
key: "candidate",
label: "Candidate",
tone: "accent",
points: [
{ x: -2.4, y: 0 },
{ x: -2.4, y: 0.08 },
{ x: -1.6, y: 0.17 },
{ x: -1, y: 0.25 },
{ x: -0.4, y: 0.33 },
{ x: 0.1, y: 0.42 },
{ x: 0.1, y: 0.5 },
{ x: 0.6, y: 0.58 },
{ x: 1.2, y: 0.67 },
{ x: 1.9, y: 0.75 },
{ x: 2.7, y: 0.83 },
{ x: 3.6, y: 0.92 },
{ x: 4.8, y: 1 },
],
},
]}
xFormat={{ kind: "percent", decimals: 1 }}
height={320}
ariaLabel="ECDF of returns"
/>Controls
Height
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 { EcdfChart } from "@luc/ui/charts";
<EcdfChart
series={[
{
key: "baseline",
label: "Baseline",
tone: "neutral",
points: [
{ x: -2.9, y: 0 },
{ x: -2.9, y: 0.08 },
{ x: -2.1, y: 0.17 },
{ x: -1.4, y: 0.25 },
{ x: -0.8, y: 0.33 },
{ x: -0.3, y: 0.42 },
{ x: -0.3, y: 0.5 },
{ x: 0.2, y: 0.58 },
{ x: 0.7, y: 0.67 },
{ x: 1.1, y: 0.75 },
{ x: 1.8, y: 0.83 },
{ x: 2.6, y: 0.92 },
{ x: 3.4, y: 1 },
],
},
{
key: "candidate",
label: "Candidate",
tone: "accent",
points: [
{ x: -2.4, y: 0 },
{ x: -2.4, y: 0.08 },
{ x: -1.6, y: 0.17 },
{ x: -1, y: 0.25 },
{ x: -0.4, y: 0.33 },
{ x: 0.1, y: 0.42 },
{ x: 0.1, y: 0.5 },
{ x: 0.6, y: 0.58 },
{ x: 1.2, y: 0.67 },
{ x: 1.9, y: 0.75 },
{ x: 2.7, y: 0.83 },
{ x: 3.6, y: 0.92 },
{ x: 4.8, y: 1 },
],
},
]}
xFormat={{ kind: "percent", decimals: 1 }}
height={320}
ariaLabel="ECDF of returns"
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 `EcdfChart` from Luc UI. It is: See the distribution, the agreement or the uncertainty in the values you supply.
Import it with: import { EcdfChart } 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="ECDF of returns"`.
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
<EcdfChart
series={[
{
key: "baseline",
label: "Baseline",
tone: "neutral",
points: [
{ x: -2.9, y: 0 },
{ x: -2.9, y: 0.08 },
{ x: -2.1, y: 0.17 },
{ x: -1.4, y: 0.25 },
{ x: -0.8, y: 0.33 },
{ x: -0.3, y: 0.42 },
{ x: -0.3, y: 0.5 },
{ x: 0.2, y: 0.58 },
{ x: 0.7, y: 0.67 },
{ x: 1.1, y: 0.75 },
{ x: 1.8, y: 0.83 },
{ x: 2.6, y: 0.92 },
{ x: 3.4, y: 1 },
],
},
{
key: "candidate",
label: "Candidate",
tone: "accent",
points: [
{ x: -2.4, y: 0 },
{ x: -2.4, y: 0.08 },
{ x: -1.6, y: 0.17 },
{ x: -1, y: 0.25 },
{ x: -0.4, y: 0.33 },
{ x: 0.1, y: 0.42 },
{ x: 0.1, y: 0.5 },
{ x: 0.6, y: 0.58 },
{ x: 1.2, y: 0.67 },
{ x: 1.9, y: 0.75 },
{ x: 2.7, y: 0.83 },
{ x: 3.6, y: 0.92 },
{ x: 4.8, y: 1 },
],
},
]}
xFormat={{ kind: "percent", decimals: 1 }}
height={320}
ariaLabel="ECDF of returns"
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 { EcdfChart } from "@luc/ui/charts";<EcdfChart
series={[
{
key: "baseline",
label: "Baseline",
tone: "neutral",
points: [
{ x: -2.9, y: 0 },
{ x: -2.9, y: 0.08 },
{ x: -2.1, y: 0.17 },
{ x: -1.4, y: 0.25 },
{ x: -0.8, y: 0.33 },
{ x: -0.3, y: 0.42 },
{ x: -0.3, y: 0.5 },
{ x: 0.2, y: 0.58 },
{ x: 0.7, y: 0.67 },
{ x: 1.1, y: 0.75 },
{ x: 1.8, y: 0.83 },
{ x: 2.6, y: 0.92 },
{ x: 3.4, y: 1 },
],
},
{
key: "candidate",
label: "Candidate",
tone: "accent",
points: [
{ x: -2.4, y: 0 },
{ x: -2.4, y: 0.08 },
{ x: -1.6, y: 0.17 },
{ x: -1, y: 0.25 },
{ x: -0.4, y: 0.33 },
{ x: 0.1, y: 0.42 },
{ x: 0.1, y: 0.5 },
{ x: 0.6, y: 0.58 },
{ x: 1.2, y: 0.67 },
{ x: 1.9, y: 0.75 },
{ x: 2.7, y: 0.83 },
{ x: 3.6, y: 0.92 },
{ x: 4.8, y: 1 },
],
},
]}
xFormat={{ kind: "percent", decimals: 1 }}
height={320}
ariaLabel="ECDF of returns"
/>Data contract
Each `series` has a `key`, `label`, `tone` and ordered `points` of `{ x, y }`, where y is the cumulative probability. The caller supplies the order statistics.
Important configuration
Use `xFormat` for the measured variable, keep y on a 0–1 probability scale, and distinguish samples with `tone` and direct labels.
Guidelines
When not to use
Do not smooth an ECDF into a continuous density; the step is the definition, and interpolating it invents observations.
Configuration
| Export | Kind | Signature |
|---|---|---|
EcdfChart | 13 documented props | ({ series, xFormat, yFormat, title, description, state, height, className, ariaLabel, ariaDescription, onReady, onEvent, eager, }: EcdfChartProps) => import("@types/react").JSX.Element |
EcdfChart props
Type: EcdfChartProps
Values the compiler reads from the declaration.
| Prop | Type | Default | Notes |
|---|---|---|---|
ariaDescription? | string | undefined | — | |
ariaLabel? | string | undefined | — | |
className? | string | undefined | — | |
description? | string | undefined | — | |
eager? | boolean | undefined | — | Create the engine on mount rather than when the surface is approached. |
height? | string | number | undefined | — | |
onEvent? | ((event: EChartEvent) => void) | undefined | — | |
onReady? | ((chart: EChartsInstance) => void) | undefined | — | |
series | readonly EcdfSeries[] | — | |
state? | ChartState | undefined | — | |
title? | string | undefined | — | |
xFormat? | ChartFormat | undefined | — | |
yFormat? | ChartFormat | 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.
Family
Statistical
Distributions, agreement and uncertainty — all from prepared values.
Related