{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chart-heatmap",
  "title": "Heatmap",
  "description": "Sessions by weekday and hour on a ramp from your theme, with a cell tooltip.",
  "dependencies": [
    "@wick-charts/react@^0.9.2"
  ],
  "registryDependencies": [
    "card",
    "https://wick-charts.eeff.io/r/wick-chart.json"
  ],
  "files": [
    {
      "path": "blocks/chart-heatmap.tsx",
      "content": "\"use client\"\n\nimport {\n  type HeatmapCellData,\n  HeatmapSeries,\n  HeatmapTooltip,\n} from \"@wick-charts/react\"\n\nimport {\n  Card,\n  CardContent,\n  CardDescription,\n  CardHeader,\n  CardTitle,\n} from \"@/components/ui/card\"\nimport { WickChart } from \"@/components/ui/wick-chart\"\n\nconst WEEKDAYS = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"]\nconst HOURS = Array.from({ length: 24 }, (_, hour) =>\n  String(hour).padStart(2, \"0\")\n)\n\nconst formatCount = (value: number) => Math.round(value).toLocaleString(\"en-US\")\n\nconst heatmapOptions = { rows: WEEKDAYS, columns: HOURS }\n\n// Seeded, so every render shows the same picture.\nfunction seededRandom(seed: number): () => number {\n  let state = seed\n\n  return () => {\n    state = (state * 1_664_525 + 1_013_904_223) % 4_294_967_296\n\n    return state / 4_294_967_296\n  }\n}\n\n// Demo data: a work-hours peak on weekdays and an evening peak at the weekend.\nfunction makeActivity(): HeatmapCellData[] {\n  const random = seededRandom(5)\n  const cells: HeatmapCellData[] = []\n\n  for (const [day, weekday] of WEEKDAYS.entries()) {\n    const weekend = day >= 5\n\n    for (const [hour, label] of HOURS.entries()) {\n      const work = Math.exp(-((hour - 14) ** 2) / 18) * (weekend ? 0.35 : 1)\n      const evening = Math.exp(-((hour - 21) ** 2) / 6) * (weekend ? 0.8 : 0.4)\n      cells.push({\n        x: label,\n        y: weekday,\n        value: Math.round((work + evening) * 100 + random() * 12),\n      })\n    }\n  }\n\n  return cells\n}\n\nconst activity = makeActivity()\n\nexport function ChartHeatmap() {\n  return (\n    <Card>\n      <CardHeader>\n        <CardTitle>Activity</CardTitle>\n        <CardDescription>Sessions by weekday and hour</CardDescription>\n      </CardHeader>\n      <CardContent>\n        <WickChart className=\"aspect-auto h-[280px]\">\n          <HeatmapSeries data={activity} options={heatmapOptions} />\n          <HeatmapTooltip format={formatCount} />\n        </WickChart>\n      </CardContent>\n    </Card>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "charts",
    "dashboard"
  ],
  "type": "registry:block"
}