Skip to content
ChartslibraryUI Get Pro

Heatmap

A grid coloured by value, sequential or diverging, with missing cells hatched.

When to use

  • Channel by week vs plan
  • Hour by weekday activity
  • Item by month matrices

When not to use

  • Readers need precise values for a few items – use Table chart

Good practice

  • Use a diverging scale only when the centre means something (plan, zero).
  • Set a fixed domain to compare several heatmaps.

Installation

Heatmap is a Pro chart.

Installation is part of Pro

The full source is included in the Pro download. Get Pro to install it with the CLI and use it in unlimited projects.

Unlock with Pro
Already have Pro?npx chartslibraryui add heatmap --from ./chartslibraryui-pro

Usage

Usage examples are part of Pro

Every example on this page comes with its code in the Pro download. The props and data shape below are public.

Unlock with Pro

Data

Long-format rows: row key, column key, value key.

[{ channel: "Search", week: "W1", delta: 1.4 }, ...]

Missing values are null. Invalid values make the chart say what’s wrong instead of drawing a misleading picture. How charts handle bad data

Props

Every chart also accepts the shared frame props: title, subtitle, source, height, mode, toolbar. Common API

export interface HeatmapProps extends FrameProps {
  /** Long-format rows: one row per cell. */
  data: Row[];
  /** Key of the row label (y). */
  row: string;
  /** Key of the column label (x). */
  column: string;
  /** Key of the cell value. */
  value: string;
  format?: FormatInput;
  /** "sequential" for magnitude (default); "diverging" for above/below a centre (e.g. variance to plan). */
  scale?: "sequential" | "diverging";
  /** Diverging centre. Default 0. */
  center?: number;
  /** Fixed colour domain [min, max]; values beyond it take the end colour (the legend says so). */
  domain?: [number, number];
  /** Print values in cells when they fit. Default "auto". */
  labels?: boolean | "auto";
  /** Explicit column order. Default: order of first appearance. */
  columnOrder?: string[];
  rowOrder?: string[];
  /** Cell height in px. Default 28. */
  cellHeight?: number;
}
Pro

Cohort heatmap

Retention by cohort with incomplete cohorts left blank and a size-weighted average.

Table chart

A sortable table with inline bars, coloured deltas and sparklines.