Klar

Charts / React chart kit primitives / Schedule

Heatmap

A grid of cells shaded by value, with row and column labels; here consults by weekday and hour.

React component Heatmap, data through props. Things placed on a calendar or clock: Gantts, punchcards, traces. Tags: heatmap, grid, matrix, weekday-hour, density, cells.

Install

npm i klar-charts

import 'klar-charts/styles.css'
import { ThemeScope, Heatmap } from 'klar-charts'

# or copy the source:
npx shadcn@latest add https://klar.run/r/kit-heatmap.json

Usage

<Heatmap
  className="mt-5"
  data={rhythm.map((row) => row.map((c) => (c.closed ? null : c.n)))}
  rowLabels={lumenDays}
  colLabels={lumenHours.map((h) => (h > 12 ? `${h - 12}p` : h === 12 ? '12p' : `${h}a`))}
  cellHeight={26}
  showValues
  color="var(--accent)"
/>

Related heatmap charts