RocCurveChart
See the distribution, the agreement or the uncertainty in the values you supply.
@luc/ui/chartsWhat it shows
Compare binary classifiers across thresholds using true-positive rate against false-positive rate.
Live preview
Both curves rise monotonically to (1, 1); the areas under them are the caller's numbers.
<RocCurveChart
curves={[
{
label: "Model A",
auc: 0.84,
tone: "accent",
points: [
{ x: 0, y: 0 },
{ x: 0.04, y: 0.28 },
{ x: 0.11, y: 0.51 },
{ x: 0.22, y: 0.68 },
{ x: 0.38, y: 0.81 },
{ x: 0.61, y: 0.9 },
{ x: 1, y: 1 },
],
},
{
label: "Model B",
auc: 0.74,
tone: "neutral",
points: [
{ x: 0, y: 0 },
{ x: 0.06, y: 0.21 },
{ x: 0.15, y: 0.39 },
{ x: 0.3, y: 0.57 },
{ x: 0.49, y: 0.72 },
{ x: 0.72, y: 0.85 },
{ x: 1, y: 1 },
],
},
]}
xFormat={{ kind: "percent", decimals: 0 }}
yFormat={{ kind: "percent", decimals: 0 }}
height={320}
ariaLabel="ROC for two models"
/>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 { RocCurveChart } from "@luc/ui/charts";
<RocCurveChart
curves={[
{
label: "Model A",
auc: 0.84,
tone: "accent",
points: [
{ x: 0, y: 0 },
{ x: 0.04, y: 0.28 },
{ x: 0.11, y: 0.51 },
{ x: 0.22, y: 0.68 },
{ x: 0.38, y: 0.81 },
{ x: 0.61, y: 0.9 },
{ x: 1, y: 1 },
],
},
{
label: "Model B",
auc: 0.74,
tone: "neutral",
points: [
{ x: 0, y: 0 },
{ x: 0.06, y: 0.21 },
{ x: 0.15, y: 0.39 },
{ x: 0.3, y: 0.57 },
{ x: 0.49, y: 0.72 },
{ x: 0.72, y: 0.85 },
{ x: 1, y: 1 },
],
},
]}
xFormat={{ kind: "percent", decimals: 0 }}
yFormat={{ kind: "percent", decimals: 0 }}
height={320}
ariaLabel="ROC for two models"
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 `RocCurveChart` from Luc UI. It is: See the distribution, the agreement or the uncertainty in the values you supply.
Import it with: import { RocCurveChart } 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="ROC for two models"`.
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
<RocCurveChart
curves={[
{
label: "Model A",
auc: 0.84,
tone: "accent",
points: [
{ x: 0, y: 0 },
{ x: 0.04, y: 0.28 },
{ x: 0.11, y: 0.51 },
{ x: 0.22, y: 0.68 },
{ x: 0.38, y: 0.81 },
{ x: 0.61, y: 0.9 },
{ x: 1, y: 1 },
],
},
{
label: "Model B",
auc: 0.74,
tone: "neutral",
points: [
{ x: 0, y: 0 },
{ x: 0.06, y: 0.21 },
{ x: 0.15, y: 0.39 },
{ x: 0.3, y: 0.57 },
{ x: 0.49, y: 0.72 },
{ x: 0.72, y: 0.85 },
{ x: 1, y: 1 },
],
},
]}
xFormat={{ kind: "percent", decimals: 0 }}
yFormat={{ kind: "percent", decimals: 0 }}
height={320}
ariaLabel="ROC for two models"
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 { RocCurveChart } from "@luc/ui/charts";<RocCurveChart
curves={[
{
label: "Model A",
auc: 0.84,
tone: "accent",
points: [
{ x: 0, y: 0 },
{ x: 0.04, y: 0.28 },
{ x: 0.11, y: 0.51 },
{ x: 0.22, y: 0.68 },
{ x: 0.38, y: 0.81 },
{ x: 0.61, y: 0.9 },
{ x: 1, y: 1 },
],
},
{
label: "Model B",
auc: 0.74,
tone: "neutral",
points: [
{ x: 0, y: 0 },
{ x: 0.06, y: 0.21 },
{ x: 0.15, y: 0.39 },
{ x: 0.3, y: 0.57 },
{ x: 0.49, y: 0.72 },
{ x: 0.72, y: 0.85 },
{ x: 1, y: 1 },
],
},
]}
xFormat={{ kind: "percent", decimals: 0 }}
yFormat={{ kind: "percent", decimals: 0 }}
height={320}
ariaLabel="ROC for two models"
/>Data contract
Each `curve` has an ordered `points` array of `{ x, y }`; x is false-positive rate and y is true-positive rate. `auc` is a supplied summary, not a value the chart integrates.
Important configuration
Use percent formats on both axes, keep the diagonal baseline visible in the explanation, and label curves by model rather than colour alone.
Guidelines
When not to use
Do not compare ROC curves from datasets with materially different class prevalence without stating that limitation.
Configuration
| Export | Kind | Signature |
|---|---|---|
RocCurveChart | 13 documented props | ({ curves, xFormat, yFormat, title, description, state, height, className, ariaLabel, ariaDescription, onReady, onEvent, eager, }: RocCurveChartProps) => import("@types/react").JSX.Element |
RocCurveChart props
Type: RocCurveChartProps
Values the compiler reads from the declaration.
| Prop | Type | Default | Notes |
|---|---|---|---|
ariaDescription? | string | undefined | — | |
ariaLabel? | string | undefined | — | |
className? | string | undefined | — | |
curves | readonly RocCurve[] | — | |
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 | — | |
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