{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chart-area-census",
  "title": "Census area chart",
  "description": "Daily census by status, as a stacked area chart.",
  "dependencies": [
    "recharts@^3.8.0"
  ],
  "registryDependencies": [
    "card",
    "chart"
  ],
  "files": [
    {
      "path": "registry/base-nova/charts/chart-area-census.tsx",
      "content": "\"use client\"\n\nimport {\n  Area,\n  AreaChart,\n  CartesianGrid,\n  Label,\n  ReferenceLine,\n  XAxis,\n  YAxis,\n} 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  ChartLegend,\n  ChartLegendContent,\n  ChartTooltip,\n  ChartTooltipContent,\n  type ChartConfig,\n} from \"@/components/ui/chart\"\n\nexport const description = \"Daily census by status, as a stacked area chart\"\n\n// Average beds in use per day, illustrative.\nconst chartData = [\n  { month: \"January\", inpatient: 186, observation: 42 },\n  { month: \"February\", inpatient: 205, observation: 51 },\n  { month: \"March\", inpatient: 197, observation: 47 },\n  { month: \"April\", inpatient: 173, observation: 38 },\n  { month: \"May\", inpatient: 169, observation: 36 },\n  { month: \"June\", inpatient: 181, observation: 44 },\n]\n\nconst chartConfig = {\n  inpatient: {\n    label: \"Inpatient\",\n    color: \"var(--chart-2)\",\n  },\n  observation: {\n    label: \"Observation\",\n    color: \"var(--chart-1)\",\n  },\n} satisfies ChartConfig\n\n// Beds the hospital can staff, the ceiling the census works against.\nconst staffedBeds = 260\n\nconst busiest = chartData.reduce((a, b) =>\n  b.inpatient + b.observation > a.inpatient + a.observation ? b : a\n)\n\nexport function ChartAreaCensus() {\n  return (\n    <Card>\n      <CardHeader>\n        <CardTitle>Census</CardTitle>\n        <CardDescription>\n          Average beds in use per day, January to June\n        </CardDescription>\n      </CardHeader>\n      <CardContent>\n        <ChartContainer config={chartConfig}>\n          <AreaChart\n            accessibilityLayer\n            data={chartData}\n            margin={{ left: 12, right: 12 }}\n          >\n            <CartesianGrid vertical={false} />\n            <XAxis\n              dataKey=\"month\"\n              tickLine={false}\n              axisLine={false}\n              tickMargin={8}\n              tickFormatter={(value) => value.slice(0, 3)}\n            />\n            <YAxis hide domain={[0, staffedBeds + 20]} />\n            <ChartTooltip\n              cursor={false}\n              content={<ChartTooltipContent indicator=\"dot\" />}\n            />\n            <Area\n              dataKey=\"observation\"\n              type=\"monotone\"\n              fill=\"var(--color-observation)\"\n              fillOpacity={0.4}\n              stroke=\"var(--color-observation)\"\n              stackId=\"a\"\n            />\n            <Area\n              dataKey=\"inpatient\"\n              type=\"monotone\"\n              fill=\"var(--color-inpatient)\"\n              fillOpacity={0.4}\n              stroke=\"var(--color-inpatient)\"\n              stackId=\"a\"\n            />\n            <ChartLegend content={<ChartLegendContent />} />\n            <ReferenceLine\n              y={staffedBeds}\n              stroke=\"var(--muted-foreground)\"\n              strokeDasharray=\"4 4\"\n            >\n              <Label\n                value={`Staffed beds ${staffedBeds}`}\n                position=\"insideTopRight\"\n                className=\"fill-muted-foreground\"\n                fontSize={11}\n              />\n            </ReferenceLine>\n          </AreaChart>\n        </ChartContainer>\n      </CardContent>\n      <CardFooter className=\"flex-col items-start gap-2 text-sm\">\n        <div className=\"flex items-center gap-2 leading-none font-medium\">\n          Busiest in {busiest.month}, at{\" \"}\n          {busiest.inpatient + busiest.observation} beds\n        </div>\n        <div className=\"leading-none text-muted-foreground\">\n          Illustrative data for one hospital\n        </div>\n      </CardFooter>\n    </Card>\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "docs": "Census area chart: https://organui.com/charts/area#chart-area-census",
  "categories": [
    "charts",
    "charts-area"
  ],
  "type": "registry:block"
}