Skip to content
GeneralGenerated from the public API

FanChart

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

@luc/ui/charts

What it shows

Show a supplied forecast distribution as nested uncertainty bands around a median path.

Live preview

Nested quantile bands ordered widest to narrowest, with the median the analytics layer computed.

<FanChart
  x={["2026-08", "2026-09", "2026-10", "2026-11", "2026-12", "2027-01", "2027-02", "2027-03"]}
  bands={[
    {
      label: "P5–P95",
      lower: [96, 94.8, 94.1, 93.6, 93.2, 92.9, 92.7, 92.6],
      upper: [104, 107.2, 110.4, 113.1, 115.6, 118.2, 120.4, 122.7],
    },
    {
      label: "P25–P75",
      lower: [98.6, 99.2, 99.9, 100.7, 101.4, 102.1, 102.8, 103.6],
      upper: [101.4, 103.2, 105.1, 106.9, 108.7, 110.4, 112.1, 113.9],
    },
  ]}
  median={[100, 101.4, 102.9, 104.2, 105.6, 107.1, 108.4, 109.9]}
  format={{ kind: "decimal", decimals: 1 }}
  height={340}
  ariaLabel="Forecast cone"
/>

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

<FanChart
  x={["2026-08", "2026-09", "2026-10", "2026-11", "2026-12", "2027-01", "2027-02", "2027-03"]}
  bands={[
    {
      label: "P5–P95",
      lower: [96, 94.8, 94.1, 93.6, 93.2, 92.9, 92.7, 92.6],
      upper: [104, 107.2, 110.4, 113.1, 115.6, 118.2, 120.4, 122.7],
    },
    {
      label: "P25–P75",
      lower: [98.6, 99.2, 99.9, 100.7, 101.4, 102.1, 102.8, 103.6],
      upper: [101.4, 103.2, 105.1, 106.9, 108.7, 110.4, 112.1, 113.9],
    },
  ]}
  median={[100, 101.4, 102.9, 104.2, 105.6, 107.1, 108.4, 109.9]}
  format={{ kind: "decimal", decimals: 1 }}
  height={340}
  ariaLabel="Forecast cone"
  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 `FanChart` 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 { FanChart } 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="Forecast cone"`.

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
<FanChart
  x={["2026-08", "2026-09", "2026-10", "2026-11", "2026-12", "2027-01", "2027-02", "2027-03"]}
  bands={[
    {
      label: "P5–P95",
      lower: [96, 94.8, 94.1, 93.6, 93.2, 92.9, 92.7, 92.6],
      upper: [104, 107.2, 110.4, 113.1, 115.6, 118.2, 120.4, 122.7],
    },
    {
      label: "P25–P75",
      lower: [98.6, 99.2, 99.9, 100.7, 101.4, 102.1, 102.8, 103.6],
      upper: [101.4, 103.2, 105.1, 106.9, 108.7, 110.4, 112.1, 113.9],
    },
  ]}
  median={[100, 101.4, 102.9, 104.2, 105.6, 107.1, 108.4, 109.9]}
  format={{ kind: "decimal", decimals: 1 }}
  height={340}
  ariaLabel="Forecast cone"
  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 { FanChart } from "@luc/ui/charts";
<FanChart
  x={["2026-08", "2026-09", "2026-10", "2026-11", "2026-12", "2027-01", "2027-02", "2027-03"]}
  bands={[
    {
      label: "P5–P95",
      lower: [96, 94.8, 94.1, 93.6, 93.2, 92.9, 92.7, 92.6],
      upper: [104, 107.2, 110.4, 113.1, 115.6, 118.2, 120.4, 122.7],
    },
    {
      label: "P25–P75",
      lower: [98.6, 99.2, 99.9, 100.7, 101.4, 102.1, 102.8, 103.6],
      upper: [101.4, 103.2, 105.1, 106.9, 108.7, 110.4, 112.1, 113.9],
    },
  ]}
  median={[100, 101.4, 102.9, 104.2, 105.6, 107.1, 108.4, 109.9]}
  format={{ kind: "decimal", decimals: 1 }}
  height={340}
  ariaLabel="Forecast cone"
/>

Data contract

`x` contains ordered periods; `bands` contain aligned `lower` and `upper` arrays ordered widest to narrowest, and `median` has one value per x.

Important configuration

Order the bands from the widest to the narrowest, format the forecast unit, and name the quantiles in the copy rather than relying on colour alone.

Guidelines

When not to use

Do not present a forecast cone as a guarantee or let band arrays drift out of alignment; a mismatched fan is a different claim.

Configuration

Exported symbols
ExportKindSignature
FanChart17 documented props({ x, bands, median, format, medianMode, annotations, syncGroup, title, description, state, height, className, ariaLabel, ariaDescription, onReady, onEvent, }: FanChartProps) => import("@types/react"…

FanChart props

Type: FanChartProps

Values the compiler reads from the declaration.

FanChart props
PropTypeDefaultNotes
annotations?AnnotationSpec | undefined—
ariaDescription?string | undefined—
ariaLabel?string | undefined—
bandsreadonly FanBand[]—Bands ordered widest → narrowest, which is also the draw order.
className?string | undefined—
description?string | undefined—
format?ChartFormat | undefined—
height?string | number | undefined—
interaction?ChartInteractionSpec | undefined—
medianreadonly number[]—
medianMode?"area" | "line" | undefined—Draw the median as a line (default) or as a filled area.
onEvent?((event: EChartEvent) => void) | undefined—
onReady?((chart: EChartsInstance) => void) | undefined—
state?ChartState | undefined—
syncGroup?string | undefined—
title?string | undefined—
xreadonly (string | number | Date)[]—Shared time axis, one entry per array element of every band and the median.

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