{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chart-radial-fluids",
  "title": "Fluid balance radial chart",
  "description": "Fluid intake and output, as a stacked radial chart.",
  "dependencies": [
    "recharts@^3.8.0"
  ],
  "registryDependencies": [
    "card",
    "chart"
  ],
  "files": [
    {
      "path": "registry/base-nova/charts/chart-radial-fluids.tsx",
      "content": "\"use client\"\n\nimport { Label, PolarRadiusAxis, RadialBar, RadialBarChart } from \"recharts\"\n\nimport {\n  Card,\n  CardContent,\n  CardDescription,\n  CardFooter,\n  CardHeader,\n  CardTitle,\n} from \"@/components/ui/card\"\nimport {\n  ChartContainer,\n  ChartTooltip,\n  ChartTooltipContent,\n  type ChartConfig,\n} from \"@/components/ui/chart\"\n\nexport const description = \"Fluid intake and output, as a stacked radial chart\"\n\n// Millilitres over 24 hours, a fictional patient.\nconst chartData = [{ day: \"today\", intake: 2150, output: 1680 }]\n\nconst chartConfig = {\n  intake: {\n    label: \"Intake (mL)\",\n    color: \"var(--chart-2)\",\n  },\n  output: {\n    label: \"Output (mL)\",\n    color: \"var(--chart-1)\",\n  },\n} satisfies ChartConfig\n\nexport function ChartRadialFluids() {\n  const { intake, output } = chartData[0]!\n  return (\n    <Card className=\"flex flex-col\">\n      <CardHeader className=\"items-center pb-0\">\n        <CardTitle>Fluid balance</CardTitle>\n        <CardDescription>Intake and output, last 24 hours</CardDescription>\n      </CardHeader>\n      <CardContent className=\"flex flex-1 items-center pb-0\">\n        <ChartContainer\n          config={chartConfig}\n          className=\"mx-auto aspect-square w-full max-w-[250px]\"\n        >\n          <RadialBarChart\n            data={chartData}\n            endAngle={180}\n            innerRadius={80}\n            outerRadius={130}\n          >\n            <ChartTooltip\n              cursor={false}\n              content={<ChartTooltipContent hideLabel />}\n            />\n            <PolarRadiusAxis tick={false} tickLine={false} axisLine={false}>\n              <Label\n                content={({ viewBox }) => {\n                  if (viewBox && \"cx\" in viewBox && \"cy\" in viewBox) {\n                    return (\n                      <text x={viewBox.cx} y={viewBox.cy} textAnchor=\"middle\">\n                        <tspan\n                          x={viewBox.cx}\n                          y={(viewBox.cy || 0) - 16}\n                          className=\"fill-foreground text-2xl font-bold\"\n                        >\n                          {intake >= output ? \"+\" : \"−\"}\n                          {Math.abs(intake - output).toLocaleString(\"en-US\")} mL\n                        </tspan>\n                        <tspan\n                          x={viewBox.cx}\n                          y={(viewBox.cy || 0) + 4}\n                          className=\"fill-muted-foreground\"\n                        >\n                          net balance\n                        </tspan>\n                      </text>\n                    )\n                  }\n                }}\n              />\n            </PolarRadiusAxis>\n            <RadialBar\n              dataKey=\"intake\"\n              stackId=\"a\"\n              cornerRadius={5}\n              fill=\"var(--color-intake)\"\n              className=\"stroke-transparent stroke-2\"\n            />\n            <RadialBar\n              dataKey=\"output\"\n              fill=\"var(--color-output)\"\n              stackId=\"a\"\n              cornerRadius={5}\n              className=\"stroke-transparent stroke-2\"\n            />\n          </RadialBarChart>\n        </ChartContainer>\n      </CardContent>\n      <CardFooter className=\"flex-col gap-2 text-sm\">\n        <div className=\"flex items-center gap-2 leading-none font-medium\">\n          Net {intake >= output ? \"positive\" : \"negative\"} by{\" \"}\n          {Math.abs(intake - output).toLocaleString(\"en-US\")} mL\n        </div>\n        <div className=\"leading-none text-muted-foreground\">\n          Illustrative; check your own unit&apos;s charting rules\n        </div>\n      </CardFooter>\n    </Card>\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "docs": "Fluid balance radial chart: https://organui.com/charts/radial#chart-radial-fluids",
  "categories": [
    "charts",
    "charts-radial"
  ],
  "type": "registry:block"
}