HeatmapChart
Place regimes, events and calendars on one time axis a reader can inspect.
@luc/ui/chartsWhat it shows
Read intensity across two categorical axes and find cells that differ from their neighbours.
Live preview
A five-by-five grid of supplied intensities with one empty cell kept empty rather than filled with zero.
<HeatmapChart
xLabels={["09:00", "11:00", "13:00", "15:00", "17:00"]}
yLabels={["Mon", "Tue", "Wed", "Thu", "Fri"]}
values={[
[12, 34, 28, 41, 18],
[9, 47, 33, 52, 24],
[15, 38, 22, null, 19],
[11, 44, 39, 48, 27],
[8, 29, 31, 36, 14],
]}
format={{ kind: "integer" }}
showCellValues
height={320}
ariaLabel="Volume by hour"
/>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 { HeatmapChart } from "@luc/ui/charts";
<HeatmapChart
xLabels={["09:00", "11:00", "13:00", "15:00", "17:00"]}
yLabels={["Mon", "Tue", "Wed", "Thu", "Fri"]}
values={[
[12, 34, 28, 41, 18],
[9, 47, 33, 52, 24],
[15, 38, 22, null, 19],
[11, 44, 39, 48, 27],
[8, 29, 31, 36, 14],
]}
format={{ kind: "integer" }}
showCellValues
height={320}
ariaLabel="Volume by hour"
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 `HeatmapChart` from Luc UI. It is: Place regimes, events and calendars on one time axis a reader can inspect.
Import it with: import { HeatmapChart } 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="Volume by hour"`.
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
<HeatmapChart
xLabels={["09:00", "11:00", "13:00", "15:00", "17:00"]}
yLabels={["Mon", "Tue", "Wed", "Thu", "Fri"]}
values={[
[12, 34, 28, 41, 18],
[9, 47, 33, 52, 24],
[15, 38, 22, null, 19],
[11, 44, 39, 48, 27],
[8, 29, 31, 36, 14],
]}
format={{ kind: "integer" }}
showCellValues
height={320}
ariaLabel="Volume by hour"
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: Time series & sequence
import { HeatmapChart } from "@luc/ui/charts";<HeatmapChart
xLabels={["09:00", "11:00", "13:00", "15:00", "17:00"]}
yLabels={["Mon", "Tue", "Wed", "Thu", "Fri"]}
values={[
[12, 34, 28, 41, 18],
[9, 47, 33, 52, 24],
[15, 38, 22, null, 19],
[11, 44, 39, 48, 27],
[8, 29, 31, 36, 14],
]}
format={{ kind: "integer" }}
showCellValues
height={320}
ariaLabel="Volume by hour"
/>Data contract
`xLabels` and `yLabels` define the ordered axes; `values[y][x]` is a rectangular numeric matrix. A `null` cell is drawn as absent, not as zero.
Important configuration
Set the value format, choose whether cell labels are readable with `showCellValues`, and disclose the colour domain when comparing two heatmaps.
Guidelines
When not to use
Do not use a heatmap for precise comparisons of many close values; a table or ranked bars preserves the exact ordering.
Configuration
| Export | Kind | Signature |
|---|---|---|
HeatmapChart | 23 documented props | ({ xLabels, yLabels, values, min, max, format, showCellValues, palette, midpoint, ramp, labelMode, robustDomain, highlight, title, description, state, height, className, ariaLabel, ariaDescription, o… |
HeatmapChart props
Type: HeatmapChartProps
Values the compiler reads from the declaration.
| Prop | Type | Default | Notes |
|---|---|---|---|
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. |
format? | ChartFormat | undefined | — | |
height? | string | number | undefined | — | |
highlight? | readonly (readonly [number, number])[] | undefined | — | Cells to mark as the **current** one, as `[x, y]` index pairs. A period matrix has a newest cell and a reader needs to find it without counting columns: the marked cells keep the … |
labelMode? | MatrixLabelMode | undefined | — | When to print the value inside each cell. `"auto"` (the default once labelling is requested) decides per *rendered* cell: the value appears when a cell is at least 44×18 CSS px an… |
max? | number | undefined | — | |
midpoint? | number | undefined | — | The midpoint for a diverging ramp (0 for correlations, a mean, a target). |
min? | number | undefined | — | |
onEvent? | ((event: EChartEvent) => void) | undefined | — | |
onReady? | ((chart: EChartsInstance) => void) | undefined | — | |
palette? | "sequential" | "diverging" | "correlation" | undefined | — | `sequential` answers "how much" (an intensity ramp); `diverging` answers "which side of a midpoint" and uses `midpoint`. A correlation matrix is always diverging — a sequential ra… |
ramp? | readonly [string, string, string] | undefined | — | An explicit low → mid → high ramp that overrides the theme's diverging anchors (a product's own loss → flat → gain ramp, passed to `palette: "diverging"`). `palette` still decides… |
robustDomain? | number | boolean | undefined | — | Use a **robust, symmetric, zero-centred colour domain** instead of min/max. `true` caps the domain at the 95th percentile of |value − midpoint| (the top 5% of magnitudes saturate … |
showCellValues? | boolean | undefined | — | Cell labels are shown when the grid is small enough to stay readable. |
state? | ChartState | undefined | — | |
title? | string | undefined | — | |
values | readonly (readonly (number | null)[])[] | — | Row-major values: `values[y][x]`. `null` renders an empty cell. |
xLabels | readonly string[] | — | |
yLabels | readonly string[] | — |
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
Time series & sequence
Regimes, events and calendars over a shared inspection cursor.
Related