Skip to content
StatisticalGenerated from the public API

ScatterRegressionChart

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

@luc/ui/charts

What it shows

Show observations together with a regression line and uncertainty band supplied by the analysis.

Live preview

The line and the band are supplied endpoints and widths: Luc UI draws a fit, it never computes one.

<ScatterRegressionChart
  points={[
    { x: -1.42, y: -1.18, label: "EQ" },
    { x: -1.05, y: -0.84, label: "HY" },
    { x: -0.63, y: -0.51, label: "IG" },
    { x: -0.24, y: -0.31, label: "CMD" },
    { x: 0.18, y: 0.11, label: "FX" },
    { x: 0.55, y: 0.62, label: "REIT" },
    { x: 0.94, y: 0.71, label: "GOLD" },
    { x: 1.38, y: 1.24, label: "TECH" },
  ]}
  regression={{ slope: 0.86, intercept: 0.03, label: "Prepared fit" }}
  band={{
    xValues: [-1.42, -1.05, -0.63, -0.24, 0.18, 0.55, 0.94, 1.38],
    lower: [
      -1.3312,
      -1.013,
      -0.6517999999999999,
      -0.3164,
      0.04479999999999998,
      0.363,
      0.6983999999999999,
      1.0768,
    ],
    upper: [
      -1.0511999999999997,
      -0.733,
      -0.3717999999999999,
      -0.03639999999999999,
      0.3248,
      0.643,
      0.9783999999999999,
      1.3567999999999998,
    ],
    label: "95% band",
  }}
  pointLabel="Asset"
  xLabel="Factor exposure"
  yLabel="Realised return"
  height={340}
  ariaLabel="Fit with confidence band"
/>

Controls

Height

340px

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 { ScatterRegressionChart } from "@luc/ui/charts";

<ScatterRegressionChart
  points={[
    { x: -1.42, y: -1.18, label: "EQ" },
    { x: -1.05, y: -0.84, label: "HY" },
    { x: -0.63, y: -0.51, label: "IG" },
    { x: -0.24, y: -0.31, label: "CMD" },
    { x: 0.18, y: 0.11, label: "FX" },
    { x: 0.55, y: 0.62, label: "REIT" },
    { x: 0.94, y: 0.71, label: "GOLD" },
    { x: 1.38, y: 1.24, label: "TECH" },
  ]}
  regression={{ slope: 0.86, intercept: 0.03, label: "Prepared fit" }}
  band={{
    xValues: [-1.42, -1.05, -0.63, -0.24, 0.18, 0.55, 0.94, 1.38],
    lower: [
      -1.3312,
      -1.013,
      -0.6517999999999999,
      -0.3164,
      0.04479999999999998,
      0.363,
      0.6983999999999999,
      1.0768,
    ],
    upper: [
      -1.0511999999999997,
      -0.733,
      -0.3717999999999999,
      -0.03639999999999999,
      0.3248,
      0.643,
      0.9783999999999999,
      1.3567999999999998,
    ],
    label: "95% band",
  }}
  pointLabel="Asset"
  xLabel="Factor exposure"
  yLabel="Realised return"
  height={340}
  ariaLabel="Fit with confidence band"
  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 `ScatterRegressionChart` from Luc UI. It is: See the distribution, the agreement or the uncertainty in the values you supply.

Import it with: import { ScatterRegressionChart } 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={340}`, `state="ready"`, `ariaLabel="Fit with confidence band"`.

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
<ScatterRegressionChart
  points={[
    { x: -1.42, y: -1.18, label: "EQ" },
    { x: -1.05, y: -0.84, label: "HY" },
    { x: -0.63, y: -0.51, label: "IG" },
    { x: -0.24, y: -0.31, label: "CMD" },
    { x: 0.18, y: 0.11, label: "FX" },
    { x: 0.55, y: 0.62, label: "REIT" },
    { x: 0.94, y: 0.71, label: "GOLD" },
    { x: 1.38, y: 1.24, label: "TECH" },
  ]}
  regression={{ slope: 0.86, intercept: 0.03, label: "Prepared fit" }}
  band={{
    xValues: [-1.42, -1.05, -0.63, -0.24, 0.18, 0.55, 0.94, 1.38],
    lower: [
      -1.3312,
      -1.013,
      -0.6517999999999999,
      -0.3164,
      0.04479999999999998,
      0.363,
      0.6983999999999999,
      1.0768,
    ],
    upper: [
      -1.0511999999999997,
      -0.733,
      -0.3717999999999999,
      -0.03639999999999999,
      0.3248,
      0.643,
      0.9783999999999999,
      1.3567999999999998,
    ],
    label: "95% band",
  }}
  pointLabel="Asset"
  xLabel="Factor exposure"
  yLabel="Realised return"
  height={340}
  ariaLabel="Fit with confidence band"
  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 { ScatterRegressionChart } from "@luc/ui/charts";
<ScatterRegressionChart
  points={[
    { x: -1.42, y: -1.18, label: "EQ" },
    { x: -1.05, y: -0.84, label: "HY" },
    { x: -0.63, y: -0.51, label: "IG" },
    { x: -0.24, y: -0.31, label: "CMD" },
    { x: 0.18, y: 0.11, label: "FX" },
    { x: 0.55, y: 0.62, label: "REIT" },
    { x: 0.94, y: 0.71, label: "GOLD" },
    { x: 1.38, y: 1.24, label: "TECH" },
  ]}
  regression={{ slope: 0.86, intercept: 0.03, label: "Prepared fit" }}
  band={{
    xValues: [-1.42, -1.05, -0.63, -0.24, 0.18, 0.55, 0.94, 1.38],
    lower: [
      -1.3312,
      -1.013,
      -0.6517999999999999,
      -0.3164,
      0.04479999999999998,
      0.363,
      0.6983999999999999,
      1.0768,
    ],
    upper: [
      -1.0511999999999997,
      -0.733,
      -0.3717999999999999,
      -0.03639999999999999,
      0.3248,
      0.643,
      0.9783999999999999,
      1.3567999999999998,
    ],
    label: "95% band",
  }}
  pointLabel="Asset"
  xLabel="Factor exposure"
  yLabel="Realised return"
  height={340}
  ariaLabel="Fit with confidence band"
/>

Data contract

`points` contain x/y observations; `regression` supplies line endpoints and `band` supplies interval widths or bounds. The chart does not fit or bootstrap anything.

Important configuration

Label both axes, keep the band method in the caption, and use `pointLabel` only when individual observations need names.

Guidelines

When not to use

Do not say the chart fitted a model or computed significance; the fit and the band are caller-provided.

Configuration

Exported symbols
ExportKindSignature
ScatterRegressionChart20 documented props({ points, regression, band, zeroLines, emphasis, pointLabel, regressionLabel, xFormat, yFormat, xLabel, yLabel, title, description, state, height, className, ariaLabel, ariaDescription, onReady, onE…

ScatterRegressionChart props

Type: ScatterRegressionChartProps

Values the compiler reads from the declaration.

ScatterRegressionChart props
PropTypeDefaultNotes
ariaDescription?string | undefined—
ariaLabel?string | undefined—
band?RegressionBand | undefined—
className?string | undefined—
description?string | undefined—
emphasis?readonly string[] | undefined—Highlight these points (outliers, a named cohort).
height?string | number | undefined—
onEvent?((event: EChartEvent) => void) | undefined—
onReady?((chart: EChartsInstance) => void) | undefined—
pointLabel?string | undefined—
pointsreadonly Observation[]—
regression?RegressionLine | undefined—Pre-computed fit. Luc UI never regresses — the analytics layer does.
regressionLabel?string | undefined—
state?ChartState | undefined—
title?string | undefined—
xFormat?ChartFormat | undefined—
xLabel?string | undefined—
yFormat?ChartFormat | undefined—
yLabel?string | undefined—
zeroLines?boolean | undefined—Draw x = 0 and y = 0 guides (default: true when the extent crosses zero).

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.0ScatterRegressionChartdark theme