{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chart-pie-donut",
  "title": "Donut Chart",
  "description": "A donut with an animated total in the center; the slices resize as new data arrives.",
  "dependencies": [
    "@wick-charts/react@^0.9.2"
  ],
  "registryDependencies": [
    "card",
    "https://wick-charts.eeff.io/r/wick-chart.json"
  ],
  "files": [
    {
      "path": "blocks/chart-pie-donut.tsx",
      "content": "\"use client\"\n\nimport { useEffect, useState } from \"react\"\n\nimport {\n  NumberFlow,\n  PieSeries,\n  type PieSliceData,\n  PieTooltip,\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 TICK_MS = 2000\n\nconst initialBrowsers: PieSliceData[] = [\n  { label: \"Chrome\", value: 275 },\n  { label: \"Safari\", value: 200 },\n  { label: \"Firefox\", value: 187 },\n  { label: \"Edge\", value: 173 },\n  { label: \"Other\", value: 90 },\n]\n\n// Demo feed: a few new visits land on random browsers every tick.\nfunction addVisits(slices: PieSliceData[]): PieSliceData[] {\n  return slices.map((slice) => ({\n    ...slice,\n    value: slice.value + Math.round(Math.random() * 6),\n  }))\n}\n\nexport function ChartPieDonut() {\n  const [browsers, setBrowsers] = useState(initialBrowsers)\n\n  useEffect(() => {\n    const timer = setInterval(() => setBrowsers(addVisits), TICK_MS)\n\n    return () => clearInterval(timer)\n  }, [])\n\n  const total = browsers.reduce((sum, slice) => sum + slice.value, 0)\n\n  return (\n    <Card>\n      <CardHeader className=\"items-center text-center\">\n        <CardTitle>Visitors by browser</CardTitle>\n        <CardDescription>Today, live</CardDescription>\n      </CardHeader>\n      <CardContent>\n        <div className=\"relative\">\n          {/* Under the chart, so the tooltip stays on top; the donut hole is transparent. */}\n          <div className=\"absolute inset-0 flex flex-col items-center justify-center\">\n            <NumberFlow\n              value={total}\n              className=\"text-3xl font-bold tabular-nums\"\n            />\n            <span className=\"text-xs text-muted-foreground\">Visitors</span>\n          </div>\n          <WickChart className=\"relative aspect-auto h-[280px]\">\n            <PieSeries\n              data={browsers}\n              options={{\n                innerRadiusRatio: 0.62,\n                sliceLabels: { mode: \"none\" },\n              }}\n            />\n            <PieTooltip />\n          </WickChart>\n        </div>\n      </CardContent>\n    </Card>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "charts",
    "dashboard"
  ],
  "type": "registry:block"
}