Skip to content
GeneralGenerated from the public API

ScatterChart

Compare series and read the change behind them, with the axes, legend and tooltip already wired.

@luc/ui/charts

What it shows

Expose the relationship between two numeric variables, including clusters, outliers and the absence of a relationship.

Live preview

Two numeric axes with zero guides: the points are observations, not a fitted relationship.

<ScatterChart
  data={[
    { factor: -1.42, forward: -1.05, turnover: 12 },
    { factor: -1.05, forward: -0.78, turnover: 8 },
    { factor: -0.63, forward: -0.41, turnover: 21 },
    { factor: -0.24, forward: -0.32, turnover: 15 },
    { factor: 0.18, forward: 0.24, turnover: 9 },
    { factor: 0.55, forward: 0.48, turnover: 27 },
    { factor: 0.94, forward: 0.86, turnover: 18 },
    { factor: 1.38, forward: 1.31, turnover: 11 },
  ]}
  xKey="factor"
  x={{ type: "value", format: { kind: "decimal", decimals: 2 } }}
  axes={[{ id: "primary", format: { kind: "percent", decimals: 1 } }]}
  series={[{ key: "forward", label: "Forward return", type: "scatter", tone: "accent" }]}
  annotations={{
    referenceLines: [
      { value: 0, axis: "x", label: "Zero factor", tone: "neutral" },
      { value: 0, axis: "y", label: "Zero return", tone: "neutral" },
    ],
  }}
  height={320}
  ariaLabel="Factor against return"
/>

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

<ScatterChart
  data={[
    { factor: -1.42, forward: -1.05, turnover: 12 },
    { factor: -1.05, forward: -0.78, turnover: 8 },
    { factor: -0.63, forward: -0.41, turnover: 21 },
    { factor: -0.24, forward: -0.32, turnover: 15 },
    { factor: 0.18, forward: 0.24, turnover: 9 },
    { factor: 0.55, forward: 0.48, turnover: 27 },
    { factor: 0.94, forward: 0.86, turnover: 18 },
    { factor: 1.38, forward: 1.31, turnover: 11 },
  ]}
  xKey="factor"
  x={{ type: "value", format: { kind: "decimal", decimals: 2 } }}
  axes={[{ id: "primary", format: { kind: "percent", decimals: 1 } }]}
  series={[{ key: "forward", label: "Forward return", type: "scatter", tone: "accent" }]}
  annotations={{
    referenceLines: [
      { value: 0, axis: "x", label: "Zero factor", tone: "neutral" },
      { value: 0, axis: "y", label: "Zero return", tone: "neutral" },
    ],
  }}
  height={320}
  ariaLabel="Factor against return"
  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 `ScatterChart` from Luc UI. It is: Compare series and read the change behind them, with the axes, legend and tooltip already wired.

Import it with: import { ScatterChart } 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="Factor against return"`.

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
<ScatterChart
  data={[
    { factor: -1.42, forward: -1.05, turnover: 12 },
    { factor: -1.05, forward: -0.78, turnover: 8 },
    { factor: -0.63, forward: -0.41, turnover: 21 },
    { factor: -0.24, forward: -0.32, turnover: 15 },
    { factor: 0.18, forward: 0.24, turnover: 9 },
    { factor: 0.55, forward: 0.48, turnover: 27 },
    { factor: 0.94, forward: 0.86, turnover: 18 },
    { factor: 1.38, forward: 1.31, turnover: 11 },
  ]}
  xKey="factor"
  x={{ type: "value", format: { kind: "decimal", decimals: 2 } }}
  axes={[{ id: "primary", format: { kind: "percent", decimals: 1 } }]}
  series={[{ key: "forward", label: "Forward return", type: "scatter", tone: "accent" }]}
  annotations={{
    referenceLines: [
      { value: 0, axis: "x", label: "Zero factor", tone: "neutral" },
      { value: 0, axis: "y", label: "Zero return", tone: "neutral" },
    ],
  }}
  height={320}
  ariaLabel="Factor against return"
  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: General

import { ScatterChart } from "@luc/ui/charts";
<ScatterChart
  data={[
    { factor: -1.42, forward: -1.05, turnover: 12 },
    { factor: -1.05, forward: -0.78, turnover: 8 },
    { factor: -0.63, forward: -0.41, turnover: 21 },
    { factor: -0.24, forward: -0.32, turnover: 15 },
    { factor: 0.18, forward: 0.24, turnover: 9 },
    { factor: 0.55, forward: 0.48, turnover: 27 },
    { factor: 0.94, forward: 0.86, turnover: 18 },
    { factor: 1.38, forward: 1.31, turnover: 11 },
  ]}
  xKey="factor"
  x={{ type: "value", format: { kind: "decimal", decimals: 2 } }}
  axes={[{ id: "primary", format: { kind: "percent", decimals: 1 } }]}
  series={[{ key: "forward", label: "Forward return", type: "scatter", tone: "accent" }]}
  annotations={{
    referenceLines: [
      { value: 0, axis: "x", label: "Zero factor", tone: "neutral" },
      { value: 0, axis: "y", label: "Zero return", tone: "neutral" },
    ],
  }}
  height={320}
  ariaLabel="Factor against return"
/>

Data contract

`data` rows contain a numeric `xKey` and one numeric value per `series.key`; declare `x.type: "value"`. The chart draws observations and does not fit a model.

Important configuration

Use `annotations.referenceLines` for meaningful zero or threshold lines, `axes[].format` for units, and `tooltip.mode: "item"` when individual points matter.

Guidelines

When not to use

Do not describe the cloud as a fitted relationship or causality; add an explicitly supplied regression series if a line is part of the claim.

Configuration

Exported symbols
ExportKindSignature
ScatterChart33 documented props<TRow extends object = Record<string, unknown>>({ family, state, height, className, visibleSeries, ariaLabel, ariaDescription, onReady, onEvent, ...spec }: CartesianChartProps<TRow>) => import("@type…

ScatterChart props

Type: CartesianChartProps<TRow>

Values the compiler reads from the declaration.

ScatterChart props
PropTypeDefaultNotes
animation?ChartAnimationPreset | undefined—Animation budget. Defaults to `standard`.
annotations?AnnotationSpec | undefined—
ariaDescription?string | undefined—
ariaLabel?string | undefined—
axes?readonly AxisSpec[] | undefined—Extra axes beyond the primary one.
className?string | undefined—
data?readonly TRow[] | undefined—
description?string | undefined—
engine?ChartEngine | undefined—
extendOption?((option: unknown) => void) | undefined—Advanced: mutate the assembled engine option. Clearly not the normal path.
family?ChartFamily | undefined—Override the family the wrapper defaults to. Advanced.
height?string | number | undefined—
id?string | undefined—
interaction?ChartInteractionSpec | undefined—
legend?boolean | undefined—
onEvent?((event: EChartEvent) => void) | undefined—
onReady?((chart: EChartsInstance) => void) | undefined—
orientation?"horizontal" | "vertical" | undefined—Bar family only: which way the bars grow. Defaults to `vertical`.
pointCount?number | undefined—The number of plotted points, when the caller already knows it. Used only to *reduce* animation for a large series; it never changes what is drawn.
points?Readonly<Record<string, ChartPointMeta>> | undefined—Per-point display metadata, keyed by the x value's canonical string form. A generic hook for a caller whose x values carry a better label or extra hover context than the axis can …
ranges?ChartRangeSpec | undefined—
renderer?ChartRenderer | undefined—Drawing layer. Defaults to `canvas`. Set `svg` when the chart is going to be captured rather than read: vector output survives PDF export and scales without a density choice. Igno…
scale?{ allowed?: readonly YScaleMode[]; default?: YScaleMode; mode?: YScaleMode; } | undefined—Scale capability and current mode. `allowed` is what the *product* declares it may offer (a signed drawdown is linear-only); `default` is what it opens on; `mode` is what the read…
seriesreadonly SeriesSpec[]—
state?ChartState | undefined—
syncGroup?string | undefined—
title?string | undefined—
tooltip?ChartTooltipSpec | undefined—
unit?string | undefined—
universalTransition?boolean | undefined—Morph the *same data* between two representations (a histogram ↔ a ranked bar, a stacked ↔ a grouped bar). Opt-in, because a morph between charts that do not share a data identity…
visibleSeries?readonly string[] | undefined—
x?AxisSpec | undefined—
xKey?string | undefined—Field that supplies the x value for tabular data.

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