Skip to content
Scientific & mathematicalGenerated from the public API

RidgelineChart

Read a field, a geometry or a spectrum, with the scale handled for you.

@luc/ui/charts

What it shows

Compare several distribution shapes by stacking supplied density curves with a vertical offset.

Live preview

Three supplied densities offset vertically, so the shapes can be compared without overlaying them.

<RidgelineChart
  groups={[
    {
      label: "2024",
      tone: "neutral",
      points: [
        { label: "2024", x: -2, density: 0.05 },
        { label: "2024", x: -1, density: 0.24 },
        { label: "2024", x: 0, density: 0.42 },
        { label: "2024", x: 1, density: 0.28 },
        { label: "2024", x: 2, density: 0.09 },
      ],
    },
    {
      label: "2025",
      tone: "accent",
      points: [
        { label: "2025", x: -2, density: 0.03 },
        { label: "2025", x: -1, density: 0.18 },
        { label: "2025", x: 0, density: 0.36 },
        { label: "2025", x: 1, density: 0.33 },
        { label: "2025", x: 2, density: 0.14 },
      ],
    },
    {
      label: "2026",
      tone: "info",
      points: [
        { label: "2026", x: -2, density: 0.02 },
        { label: "2026", x: -1, density: 0.12 },
        { label: "2026", x: 0, density: 0.29 },
        { label: "2026", x: 1, density: 0.38 },
        { label: "2026", x: 2, density: 0.21 },
      ],
    },
  ]}
  overlap={0.5}
  xFormat={{ kind: "number", decimals: 1 }}
  height={340}
  ariaLabel="Densities by year"
/>

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

<RidgelineChart
  groups={[
    {
      label: "2024",
      tone: "neutral",
      points: [
        { label: "2024", x: -2, density: 0.05 },
        { label: "2024", x: -1, density: 0.24 },
        { label: "2024", x: 0, density: 0.42 },
        { label: "2024", x: 1, density: 0.28 },
        { label: "2024", x: 2, density: 0.09 },
      ],
    },
    {
      label: "2025",
      tone: "accent",
      points: [
        { label: "2025", x: -2, density: 0.03 },
        { label: "2025", x: -1, density: 0.18 },
        { label: "2025", x: 0, density: 0.36 },
        { label: "2025", x: 1, density: 0.33 },
        { label: "2025", x: 2, density: 0.14 },
      ],
    },
    {
      label: "2026",
      tone: "info",
      points: [
        { label: "2026", x: -2, density: 0.02 },
        { label: "2026", x: -1, density: 0.12 },
        { label: "2026", x: 0, density: 0.29 },
        { label: "2026", x: 1, density: 0.38 },
        { label: "2026", x: 2, density: 0.21 },
      ],
    },
  ]}
  overlap={0.5}
  xFormat={{ kind: "number", decimals: 1 }}
  height={340}
  ariaLabel="Densities by year"
  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 `RidgelineChart` from Luc UI. It is: Read a field, a geometry or a spectrum, with the scale handled for you.

Import it with: import { RidgelineChart } 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="Densities by year"`.

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
<RidgelineChart
  groups={[
    {
      label: "2024",
      tone: "neutral",
      points: [
        { label: "2024", x: -2, density: 0.05 },
        { label: "2024", x: -1, density: 0.24 },
        { label: "2024", x: 0, density: 0.42 },
        { label: "2024", x: 1, density: 0.28 },
        { label: "2024", x: 2, density: 0.09 },
      ],
    },
    {
      label: "2025",
      tone: "accent",
      points: [
        { label: "2025", x: -2, density: 0.03 },
        { label: "2025", x: -1, density: 0.18 },
        { label: "2025", x: 0, density: 0.36 },
        { label: "2025", x: 1, density: 0.33 },
        { label: "2025", x: 2, density: 0.14 },
      ],
    },
    {
      label: "2026",
      tone: "info",
      points: [
        { label: "2026", x: -2, density: 0.02 },
        { label: "2026", x: -1, density: 0.12 },
        { label: "2026", x: 0, density: 0.29 },
        { label: "2026", x: 1, density: 0.38 },
        { label: "2026", x: 2, density: 0.21 },
      ],
    },
  ]}
  overlap={0.5}
  xFormat={{ kind: "number", decimals: 1 }}
  height={340}
  ariaLabel="Densities by year"
  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: Scientific & mathematical

import { RidgelineChart } from "@luc/ui/charts";
<RidgelineChart
  groups={[
    {
      label: "2024",
      tone: "neutral",
      points: [
        { label: "2024", x: -2, density: 0.05 },
        { label: "2024", x: -1, density: 0.24 },
        { label: "2024", x: 0, density: 0.42 },
        { label: "2024", x: 1, density: 0.28 },
        { label: "2024", x: 2, density: 0.09 },
      ],
    },
    {
      label: "2025",
      tone: "accent",
      points: [
        { label: "2025", x: -2, density: 0.03 },
        { label: "2025", x: -1, density: 0.18 },
        { label: "2025", x: 0, density: 0.36 },
        { label: "2025", x: 1, density: 0.33 },
        { label: "2025", x: 2, density: 0.14 },
      ],
    },
    {
      label: "2026",
      tone: "info",
      points: [
        { label: "2026", x: -2, density: 0.02 },
        { label: "2026", x: -1, density: 0.12 },
        { label: "2026", x: 0, density: 0.29 },
        { label: "2026", x: 1, density: 0.38 },
        { label: "2026", x: 2, density: 0.21 },
      ],
    },
  ]}
  overlap={0.5}
  xFormat={{ kind: "number", decimals: 1 }}
  height={340}
  ariaLabel="Densities by year"
/>

Data contract

`groups` supply a label and density points/values; `overlap` controls the vertical offset and `xFormat` names the measured axis. The densities are caller-supplied.

Important configuration

Choose `overlap` so peaks remain distinguishable, keep group order stable, and make the x scale shared across all ridges.

Guidelines

When not to use

Do not use ridgelines for exact per-group values or silently vary bandwidths between groups.

Configuration

Exported symbols
ExportKindSignature
RidgelineChart13 documented props({ groups, overlap, xFormat, title, description, state, height, className, ariaLabel, ariaDescription, onReady, onEvent, eager, }: RidgelineChartProps) => import("@types/react").JSX.Element

RidgelineChart props

Type: RidgelineChartProps

Values the compiler reads from the declaration.

RidgelineChart props
PropTypeDefaultNotes
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.
groupsreadonly { label: string; points: readonly RidgelineGroup[]; tone?: SeriesTone; }[]—Groups drawn top to bottom, each one stepped down by `overlap`.
height?string | number | undefined—
onEvent?((event: EChartEvent) => void) | undefined—
onReady?((chart: EChartsInstance) => void) | undefined—
overlap?number | undefined—Vertical step as a fraction of a row. 0.5 is a classic joyplot.
state?ChartState | undefined—
title?string | undefined—
xFormat?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.

Luc UI v1.0RidgelineChartdark theme