Skip to content
Sign upPro
DataHeatmap chartMenu

Heatmap chart (Pro)

ProIncluded in $99

Two categories against each other with the amount as shade: requests by weekday and hour, eval scores by model and task.

ProA week of requests by hour: the launch on Wednesday afternoon stands out, and a logging gap is hatched.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/heatmap-chart

Needs chatcn Pro

This command works with a Pro license, along with every Pro component.

Or start free: sign up and get three Pro components on us, with a new one every month.

Usage

tsx
import { HeatmapChart } from "@/components/ui/chatcn/pro/heatmap-chart"

<HeatmapChart
  title="Requests by hour, last week"
  x={["00:00", "01:00", …]}       // columns
  y={["Mon", "Tue", …]}           // rows
  values={[[120, 98, …], …]}      // one row per y, null for no data
  unit="requests"
  variant="isometric"             // or "grid" (default), "dots"
/>

Shades come from one palette color (palette, 1 to 6) mixed toward the card color on a smooth ramp, so the eye reads more and less rather than different hues, in light and dark. The legend shows the ramp and the real range. Cells are rounded with small gaps. Point at a cell, or focus the chart and walk it with the arrow keys: a crosshair keeps its row and column lit, the labels on both axes go bold, a card gives the value beside its row and column averages, and the readout says the same in words. Missing cells are hatched, never drawn as zero. When cells are large enough the value is printed inside, in a color chosen for contrast with its shade. variant="dots" draws a circle per cell whose area is the value, which reads well when a few cells dwarf the rest. variant="isometric" raises every cell into a column on a tilted floor: height and shade both carry the value, columns rise from the back corner on first draw, row and column names continue their lines past the front edges, the peak gets a pill, and pointing at a column fades the rest of the city toward the card while its row and column stay in color. The isometric chart sizes its own height to fit its width unless you pass height. Column labels thin out to fit in every variant.

Examples

States

ProEval pass rates by model and task on another palette color, loading, and empty.

Props

PropTypeNotes
x, ystring[]Column and row labels
values(number | null)[][]One row per y
variant"grid" | "dots" | "isometric"How cells are drawn. Default grid
palettenumberPalette color for the ramp, 1 to 6
unit, valueFormatHow values read
xLabelEverynumberShow every nth column label
heightnumberDefault 28 px per row plus the axis (30 for dots); isometric fits its width
loading, error, onRetry
labelsPartial<HeatmapChartLabels>Every string, for translation

Keyboard

KeyAction
TabFocus the chart; the highest cell is read out
Arrow keysMove between cells
Home, EndFirst or last cell in the row

Accessibility

  • The chart is an image summarized with its range and peak, with a full table for screen readers.
  • Missing values read as no data.
  • The table button shows the same grid as a table.

Motion

Cells fade in from left to right once, over 760 ms; dots grow from their centers. Isometric columns rise from the back corner to the front once, over 1.1 s. Highlights fade over 150 ms. Under reduced motion it appears drawn.