noahgdev

Heatmap Chart

Dashboards 1

About

A matrix heatmap with a row per line and a column per label, e.g. weekday by hour, with hover highlighting and tooltips.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Heatmap Chart to your project and fits it to your theme.

Code

How Heatmap Chart is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client"

import { HeatmapChart } from "@/components/ui/dashboardcn-heatmap-chart"

const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]

// Orders per region and month, in thousands. Each region has its own size and
// seasonal shape so the rows read differently instead of as one gradient.
const regions: { label: string; size: number; peak: number }[] = [
  { label: "North America", size: 48, peak: 11 },
  { label: "Europe", size: 36, peak: 10 },
  { label: "Asia Pacific", size: 42, peak: 5 },
  { label: "Latin America", size: 14, peak: 7 },
  { label: "Middle East", size: 9, peak: 2 },
  { label: "Africa", size: 5, peak: 8 },
]

function sampleRows() {
  let seed = 19
  const random = () => {
    seed = (seed * 1664525 + 1013904223) % 4294967296
    return seed / 4294967296
  }
  return regions.map((region) => ({
    label: region.label,
    values: months.map((_, m) => {
      const distance = Math.min(Math.abs(m - region.peak), 12 - Math.abs(m - region.peak))
      const season = 0.45 + 0.55 * Math.cos((distance / 6) * Math.PI) ** 2
      return Math.round(region.size * season * (0.85 + random() * 0.3) * 10) / 10
    }),
  }))
}

const rows = sampleRows()

export default function HeatmapChartRegionsDemo() {
  return (
    <div className="w-full max-w-lg">
      <HeatmapChart
        rows={rows}
        columns={months}
        color="var(--color-violet-500)"
        scale="sqrt"
        unit="K orders"
        valueFormatter={(value) => value.toFixed(1)}
      />
    </div>
  )
}

More by noahgdev

View all
  • Donut Chart

    Donut Chart

    5
  • Funnel Chart

    Funnel Chart

    3
  • Sankey Chart

    Sankey Chart

    1
  • Segmented Meter

    Segmented Meter

    1
  • Revenue Ring Card

    Revenue Ring Card

  • Payment Summary Card

    Payment Summary Card

  • Commerce KPI Row

    Commerce KPI Row

  • Tick KPI Card

    Tick KPI Card

More in Dashboards

View all
  • Fernly — Project Management Dashboard with Kanban

    Fernly — Project Management Dashboard with Kanban

    751
  • Analytics Dashboard

    Analytics Dashboard

    81
  • Creator Dashboard

    Creator Dashboard

    216
  • Insights Dashboard

    Insights Dashboard

    44
  • Corbel — Sales Analytics Dashboard

    Corbel — Sales Analytics Dashboard

    446
  • serf dashboard

    serf dashboard

    144
  • Dashboard with Collapsible Sidebar

    Dashboard with Collapsible Sidebar

    2.7K
  • Halden — CRM Dashboard with Sales Pipeline

    Halden — CRM Dashboard with Sales Pipeline

    65