Skip to content
peakcharts

HeatmapChart

Intensity across two categories, such as day and time.

Activity
ActivityClick a mark to pin its value; click it again to release. Keyboard: Enter or Space to pin, Escape to release. Data table below.MonTueWedThuFriMorningAfternoonEveningMorning, Mon: 12Morning, Tue: 28Morning, Wed: 34Morning, Thu: 19Morning, Fri: 8Afternoon, Mon: 22Afternoon, Tue: 41Afternoon, Wed: 47Afternoon, Thu: 38Afternoon, Fri: 25Evening, Mon: 9Evening, Tue: 14Evening, Wed: 21Evening, Thu: 17Evening, Fri: 30
Click a mark to pin its value
Low 8High 47
View data
Activity
Row / ColumnValue
Morning, Mon12
Morning, Tue28
Morning, Wed34
Morning, Thu19
Morning, Fri8
Afternoon, Mon22
Afternoon, Tue41
Afternoon, Wed47
Afternoon, Thu38
Afternoon, Fri25
Evening, Mon9
Evening, Tue14
Evening, Wed21
Evening, Thu17
Evening, Fri30
<HeatmapChart title="Activity" data={data} />

Usage

HeatmapChart.tsx
import { HeatmapChart } from 'peakcharts';
import 'peakcharts/styles.css';

const data = [
  { x: 'Mon', y: 'Morning', value: 12 },
  { x: 'Tue', y: 'Morning', value: 28 },
  { x: 'Wed', y: 'Morning', value: 34 },
  { x: 'Thu', y: 'Morning', value: 19 },
  { x: 'Fri', y: 'Morning', value: 8 },
  { x: 'Mon', y: 'Afternoon', value: 22 },
  { x: 'Tue', y: 'Afternoon', value: 41 },
  { x: 'Wed', y: 'Afternoon', value: 47 },
  { x: 'Thu', y: 'Afternoon', value: 38 },
  { x: 'Fri', y: 'Afternoon', value: 25 },
  { x: 'Mon', y: 'Evening', value: 9 },
  { x: 'Tue', y: 'Evening', value: 14 },
  { x: 'Wed', y: 'Evening', value: 21 },
  { x: 'Thu', y: 'Evening', value: 17 },
  { x: 'Fri', y: 'Evening', value: 30 },
];

export default function Example() {
  return <HeatmapChart title="Activity" data={data} />;
}

Data

data takes { x: string; y: string; value: number }[]. Input arrays are never mutated and order is preserved.

  • Columns (x) and rows (y) appear in first-occurrence order.
  • Intensity follows one shared scale with low and high labels.
  • A missing pair renders blank, while an explicit 0 renders a low-intensity cell. Duplicate pairs and non-finite values are rejected.

Every chart also accepts the common props: description, height, color, variant, animate, formatValue and className.