{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chart-line-navigator",
  "title": "Line Chart with Navigator",
  "description": "A year of daily closes with a navigator strip to pick the visible window.",
  "dependencies": [
    "@wick-charts/react@^0.9.2"
  ],
  "registryDependencies": [
    "card",
    "https://wick-charts.eeff.io/r/wick-chart.json"
  ],
  "files": [
    {
      "path": "blocks/chart-line-navigator.tsx",
      "content": "\"use client\"\n\nimport {\n  Crosshair,\n  LineSeries,\n  Navigator,\n  TimeAxis,\n  type TimePoint,\n  Tooltip,\n  YAxis,\n} from \"@wick-charts/react\"\n\nimport {\n  Card,\n  CardAction,\n  CardContent,\n  CardDescription,\n  CardHeader,\n  CardTitle,\n} from \"@/components/ui/card\"\nimport { WickChart } from \"@/components/ui/wick-chart\"\n\nconst DAY_MS = 86_400_000\nconst DAYS = 365\n\nconst formatUsd = (value: number) =>\n  value.toLocaleString(\"en-US\", { style: \"currency\", currency: \"USD\" })\n\nconst viewport = { initialRange: 90 }\nconst lineOptions = { pulse: false }\n\n// Seeded, so the server render and the browser show the same close.\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 year of daily closes. Replace with your own series.\nfunction makePrices(): TimePoint[] {\n  const random = seededRandom(17)\n  const start = Math.floor(Date.now() / DAY_MS) * DAY_MS - DAYS * DAY_MS\n  const points: TimePoint[] = []\n  let price = 180\n\n  for (let day = 0; day < DAYS; day++) {\n    price = Math.max(20, price * (1 + (random() - 0.48) * 0.04))\n    points.push({ time: start + day * DAY_MS, value: price })\n  }\n\n  return points\n}\n\nconst prices = makePrices()\nconst navigatorData = { type: \"line\" as const, points: prices }\nconst latest = prices[prices.length - 1]?.value ?? 0\n\nexport function ChartLineNavigator() {\n  return (\n    <Card>\n      <CardHeader>\n        <CardTitle>ACME</CardTitle>\n        <CardDescription>\n          Daily close, drag the window below to move through the year\n        </CardDescription>\n        <CardAction className=\"text-right\">\n          <div className=\"text-2xl font-semibold tabular-nums\">\n            {formatUsd(latest)}\n          </div>\n          <div className=\"text-xs text-muted-foreground\">last close</div>\n        </CardAction>\n      </CardHeader>\n      <CardContent>\n        <WickChart className=\"aspect-auto h-[320px]\" viewport={viewport}>\n          <LineSeries\n            data={{ label: \"ACME\", data: prices }}\n            options={lineOptions}\n          />\n          <YAxis format={formatUsd} />\n          <TimeAxis />\n          <Crosshair />\n          <Tooltip format={formatUsd} />\n          <Navigator data={navigatorData} height={48} />\n        </WickChart>\n      </CardContent>\n    </Card>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "charts",
    "finance"
  ],
  "type": "registry:block"
}