noahgdev

Heatmap Chart

Dashboards

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

    1
  • Metric List

    Metric List

  • Sankey Chart

    Sankey Chart

  • Scatter Chart

    Scatter Chart

  • Radar Chart

    Radar Chart

  • Composed Chart

    Composed Chart

  • Bar Chart

    Bar Chart

  • Funnel Chart

    Funnel Chart

More in Dashboards

View all
  • Fernly — Project Management Dashboard with Kanban

    Fernly — Project Management Dashboard with Kanban

    659
  • Analytics Dashboard

    Analytics Dashboard

    59
  • Creator Dashboard

    Creator Dashboard

    208
  • Insights Dashboard

    Insights Dashboard

    35
  • serf dashboard

    serf dashboard

    137
  • Corbel — Sales Analytics Dashboard

    Corbel — Sales Analytics Dashboard

    293
  • Dashboard with Collapsible Sidebar

    Dashboard with Collapsible Sidebar

    2.7K
  • Business/Sales Dashboard

    Business/Sales Dashboard

    1.5K