Charts
HeatmapChart
Density and pattern visualization as calendar grids and hour-by-day matrices.
<script>
import { HeatmapChart } from "@codeatlasdev/ui/charts";
</script>
<HeatmapChart variant="calendar" data={[["2026-03-01", 4]]} range={["2026-01-01", "2026-09-15"]} />
<HeatmapChart variant="matrix" matrixData={[[0, 0, 3]]} xCategories={hours} yCategories={days} />
variant is required. The calendar variant reads data and range; the matrix variant reads matrixData, xCategories and yCategories.
Calendar heatmap
Daily commit activity from January to September.
Code
Hour by day matrix
Points are [xIndex, yIndex, value] into xCategories and yCategories.
Code
Year toggle
Swap data and range to move between years.
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'calendar' | 'matrix' | – | Which layout to render. Required. |
data | CalendarHeatmapPoint[] | [] | Calendar variant: [date as YYYY-MM-DD, value] per day. |
range | [string, string] | – | Calendar variant: first and last date shown. |
matrixData | MatrixHeatmapPoint[] | [] | Matrix variant: [xIndex, yIndex, value]. |
xCategories | string[] | [] | Matrix variant: x-axis labels. |
yCategories | string[] | [] | Matrix variant: y-axis labels. |
color | string | – | Hex or rgb color of the high end of the ramp. Defaults to the first palette color. Use hex or rgb, not oklch. |
max | number | – | Value that maps to the full color. Defaults to the data maximum. |
tooltipFormatter | (value: number) => string | – | Formats the value in the tooltip. |
height | string | '240px' | CSS height of the chart. |
class | string | '' | Extra class names. |