Heatmap
Documentation Index
Fetch the complete documentation index at: /llms.txt. Use this file to discover all available pages before exploring further.
A composable heatmap for finding patterns across two categorical dimensions.
Overview
Use a heatmap to reveal clusters, quiet periods, and outliers across two categorical dimensions. The default variant uses a continuous color scale; choose the blocks variant when discrete intensity bands are easier to scan.
Anatomy
Heatmap owns the flat cell data, category axes, value range, loading state, and color scale. Add XAxis and YAxis for context, Cells for the rendered matrix, and optional Grid, Legend, and Tooltip parts.
Accessibility
Color is not enough when exact values matter. Provide a clear ariaLabel, keep the tooltip enabled, and pair the canvas with a data table or text summary in reporting workflows. Use a multi-stop palette with sufficient contrast between adjacent levels when using the blocks variant.
Installation
Usage
The data is a flat array with one row per cell. xDataKey and yDataKey define the categories, while valueDataKey selects the numeric intensity and matching chart config entry.
import { Heatmap, type ChartConfig } from "honestui/charts";<Heatmap
data={data}
config={chartConfig}
xDataKey="day"
yDataKey="hour"
valueDataKey="requests"
>
<Heatmap.Grid />
<Heatmap.XAxis />
<Heatmap.YAxis />
<Heatmap.Legend minLabel="Quiet" maxLabel="Busy" />
<Heatmap.Tooltip />
<Heatmap.Cells variant="default" />
</Heatmap>ECharts renders to a <canvas>, so the compound children are declarative configuration rather than live DOM nodes. Colors come from the same theme-aware ChartConfig used by every Honest UI chart.
Blocks Variant
The blocks variant divides the value range into discrete buckets and gives each cell more separation. Use levels to control how many intensity steps are shown.
Dense Field
Dense matrices can read like a continuous field by removing cell gaps, using a multi-stop diverging palette, disabling intro animation, and enabling progressive rendering. The vertical calculable legend keeps the full value range visible without competing with the x-axis. This example leaves out per-cell hover interaction so the canvas remains responsive while rendering thousands of cells.
Loading State
Pass isLoading to reserve the chart layout with a neutral cell matrix and the same loading treatment as the other Honest UI charts.