Heatmap
One measure across two dimensions — endpoint by time. The fleet view: which hosts were bad, and when, in one picture.
{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}
One measure across two dimensions — endpoint by time. The fleet view: which hosts were bad, and when, in one picture.
Import
import { Heatmap } from "@ir/ui";Watch out
- This is the one chart in Picasso that colours by VALUE, and it is the only place the sequential scale belongs. A cell has no length and no height to encode with — colour is the only channel it has, which is exactly the case
chart/scale/1–5exists for. Everywhere else, colour carries identity andchart/1–6are the slots. - Five bins, not a continuous gradient. Nobody reads a colour back to a number off a smooth ramp; they read it to a band. Banding it makes the legend honest and the scale discrete enough to match against.
- Light runs light→dark and dark runs dark→light. In dark mode nothing can sit below the surface, so the quiet end has to be the dark end — a scale flipped by
invert()would put the loudest cells nearest the background. - No data is not zero. A host that reported nothing is drawn as an empty outlined cell, never as the lowest bin, because "fine" and "we don't know" are different answers and only one of them is safe to ignore.
Props
| Prop | Type | Required | What it does |
|---|---|---|---|
x | readonly string[] | yes | Column headings — time buckets, usually. |
min | number | Pin the scale so two heatmaps can be compared. Defaults to the data. | |
stops | readonly number[] | Four boundaries cutting the range into five bins. Defaults to equal widths. Pass explicit stops when the thresholds mean something — an SLA band is not a fifth of the range. | |
lowLabel | string | What the colour means, at each end of the legend. | |
label | string | yes | Sentence for the table caption. |
Do and don't
Draw it as an outlined empty cell.
Don't — Draw a host that reported nothing as the lowest band.
"Fine" and "we don't know" are different answers and only one of them is safe to ignore. A silent agent painted the same colour as a healthy one is the failure mode a fleet view exists to prevent.
Cut the range into five bands and show them in the legend.
Don't — Interpolate a smooth gradient across the cells.
Nobody reads a colour back to a number off a continuous ramp; they read it to a band and then look for that band in the legend. Banding it makes the legend honest, and makes two cells of the same severity actually the same colour.
Use chart/scale/1–5 — this is the one place colour means magnitude.
Don't — Reach for chart/1–6 because they are the chart colours.
The categorical slots are chosen to be maximally unlike each other, which is the opposite of what an ordered scale needs. A heatmap cell has no length and no height to encode with, so colour is its only channel, and it has to carry order.
Let the dark mode scale run dark to light, from its own steps.
Don't — Invert the light scale to get a dark one.
Nothing can sit below the surface it is drawn on. In dark mode the quiet end has to be the dark end, so an inverted light scale puts the loudest cells nearest the background and the calmest ones shouting.
Accessibility
- The grid is
aria-hidden; every value is carried by a visually-hidden table with row and column headers, and a missing value reads as the words "No data". - Each cell carries its own
title— row, column and value — so a pointer can read one without a tooltip layer. - The legend's bands each carry their numeric range as visually-hidden text, so the mapping from colour to number is available without reading colour.
- Row labels truncate with the full name on
titlerather than setting the chart's width.
Where it is drawn
Figma — structure from code, measurements from code.