Skip to main content

Heatmap

Every example on this page is live, drawn by the library's Storybook, where you can also change its props and see the result.

A grid-based heatmap with pattern fills for intensity levels. Uses patterns where color cannot differentiate data.

The cells fill whatever box the chart is given, stretching with it, including a widget's stored preview, while their outlines, patterns and labels keep their size. Column labels sit above the grid and row labels down its left.

Import​

import { Heatmap } from "~lib/charts/heatmap";

Props​

NameTypeRequiredDefaultDescription
data{ x: number; y: number; value: number }[]YesN/AGrid data points
rowsnumberYesN/ANumber of rows
columnsnumberYesN/ANumber of columns
cellSizenumberNoN/ADeprecated: no effect; cells fill the chart
xLabelsstring[]NoN/AColumn labels
yLabelsstring[]NoN/ARow labels
showValuesbooleanNofalseShow values in cells
widthnumber | stringNo300Chart width
heightnumber | stringNo300Chart height

Intensity mapping: the data's range is split into equal bands, and each cell is shaded by the band its value falls in — lowest = dots, then diagonal, then crosshatch, highest = solid. A cell with no value is left empty.

Examples​

Default​

Open Default in Storybook

With Labels​

Open With Labels in Storybook

With Values​

Open With Values in Storybook

Weekly Activity​

Open Weekly Activity in Storybook

See Also​