{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chart-line-glucose",
  "title": "Fasting glucose line chart",
  "description": "Fasting glucose readings, as a line chart with dots.",
  "dependencies": [
    "recharts@^3.8.0"
  ],
  "registryDependencies": [
    "card",
    "badge",
    "chart"
  ],
  "files": [
    {
      "path": "registry/base-nova/charts/chart-line-glucose.tsx",
      "content": "\"use client\"\n\nimport {\n  CartesianGrid,\n  Label,\n  Line,\n  LineChart,\n  ReferenceArea,\n  XAxis,\n  YAxis,\n} from \"recharts\"\n\nimport {\n  Card,\n  CardAction,\n  CardContent,\n  CardDescription,\n  CardFooter,\n  CardHeader,\n  CardTitle,\n} from \"@/components/ui/card\"\nimport { Badge } from \"@/components/ui/badge\"\nimport {\n  ChartContainer,\n  ChartTooltip,\n  ChartTooltipContent,\n  type ChartConfig,\n} from \"@/components/ui/chart\"\nimport { IconPlaceholder } from \"@/icons/icon-placeholder\"\n\nexport const description = \"Fasting glucose readings, as a line chart with dots\"\n\n// Fasting fingerstick readings in mg/dL, a fictional patient.\nconst chartData = [\n  { day: \"Mon\", glucose: 132 },\n  { day: \"Tue\", glucose: 124 },\n  { day: \"Wed\", glucose: 141 },\n  { day: \"Thu\", glucose: 118 },\n  { day: \"Fri\", glucose: 112 },\n  { day: \"Sat\", glucose: 121 },\n  { day: \"Sun\", glucose: 108 },\n]\n\nconst chartConfig = {\n  glucose: {\n    label: \"Glucose (mg/dL)\",\n    color: \"var(--chart-2)\",\n  },\n} satisfies ChartConfig\n\nconst latest = chartData.at(-1)!\n// A common fasting target; set your own patient's range.\nconst targetRange = { low: 80, high: 130 }\nconst inTarget =\n  latest.glucose >= targetRange.low && latest.glucose <= targetRange.high\n\nconst first = chartData[0]!\nconst change = Math.round(\n  ((latest.glucose - first.glucose) / first.glucose) * 100\n)\n\nexport function ChartLineGlucose() {\n  return (\n    <Card>\n      <CardHeader>\n        <CardTitle>Fasting glucose</CardTitle>\n        <CardDescription>Fingerstick readings, one week</CardDescription>\n        <CardAction className=\"flex flex-col items-end gap-1.5\">\n          <div className=\"text-2xl leading-none font-semibold\">\n            {latest.glucose}{\" \"}\n            <span className=\"text-sm font-normal text-muted-foreground\">\n              mg/dL\n            </span>\n          </div>\n          <Badge variant=\"outline\">\n            {inTarget ? (\n              <IconPlaceholder\n                lucide=\"CheckIcon\"\n                tabler=\"IconCheck\"\n                hugeicons=\"Tick02Icon\"\n                phosphor=\"CheckIcon\"\n                remixicon=\"RiCheckLine\"\n                data-icon=\"inline-start\"\n              />\n            ) : (\n              <IconPlaceholder\n                lucide=\"TriangleAlertIcon\"\n                tabler=\"IconAlertTriangle\"\n                hugeicons=\"Alert02Icon\"\n                phosphor=\"WarningIcon\"\n                remixicon=\"RiAlertLine\"\n                data-icon=\"inline-start\"\n              />\n            )}\n            {inTarget\n              ? \"At target\"\n              : latest.glucose > targetRange.high\n                ? \"Above target\"\n                : \"Below target\"}\n          </Badge>\n        </CardAction>\n      </CardHeader>\n      <CardContent>\n        <ChartContainer config={chartConfig}>\n          <LineChart\n            accessibilityLayer\n            data={chartData}\n            margin={{ left: 12, right: 12 }}\n          >\n            <CartesianGrid vertical={false} />\n            <XAxis\n              dataKey=\"day\"\n              tickLine={false}\n              axisLine={false}\n              tickMargin={8}\n              interval={0}\n            />\n            <YAxis hide domain={[60, 160]} />\n            <ReferenceArea\n              y1={targetRange.low}\n              y2={targetRange.high}\n              fill=\"var(--muted-foreground)\"\n              fillOpacity={0.08}\n            >\n              <Label\n                value={`Target ${targetRange.low}–${targetRange.high}`}\n                position=\"insideBottomRight\"\n                className=\"fill-muted-foreground\"\n                fontSize={11}\n              />\n            </ReferenceArea>\n            <ChartTooltip cursor={false} content={<ChartTooltipContent />} />\n            <Line\n              dataKey=\"glucose\"\n              type=\"monotone\"\n              stroke=\"var(--color-glucose)\"\n              strokeWidth={2}\n              dot={{ fill: \"var(--color-glucose)\" }}\n              activeDot={{ r: 6 }}\n            />\n          </LineChart>\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          {change < 0 ? \"Down\" : \"Up\"} {Math.abs(change)}% this week{\" \"}\n          {change < 0 ? (\n            <IconPlaceholder\n              lucide=\"TrendingDownIcon\"\n              tabler=\"IconTrendingDown\"\n              hugeicons=\"ChartDownIcon\"\n              phosphor=\"TrendDownIcon\"\n              remixicon=\"RiArrowDownLine\"\n              className=\"size-4\"\n            />\n          ) : (\n            <IconPlaceholder\n              lucide=\"TrendingUpIcon\"\n              tabler=\"IconTrendingUp\"\n              hugeicons=\"ChartUpIcon\"\n              phosphor=\"TrendUpIcon\"\n              remixicon=\"RiArrowUpLine\"\n              className=\"size-4\"\n            />\n          )}\n        </div>\n        <div className=\"leading-none text-muted-foreground\">\n          {first.day} to {latest.day}; a fictional patient\n        </div>\n      </CardFooter>\n    </Card>\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "docs": "Fasting glucose line chart: https://organui.com/charts/line#chart-line-glucose",
  "categories": [
    "charts",
    "charts-line"
  ],
  "type": "registry:block"
}