{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"line-charts","type":"registry:component","title":"Line charts","description":"Four hand-drawn SVG line charts — multi-series, single metric, period comparison and annotated steps — that reveal left to right, morph with springs and read out values on hover or arrow keys.","author":"GetUrUI <hello@geturui.dev>","dependencies":["motion","lucide-react"],"registryDependencies":[],"files":[{"path":"registry/geturui/examples/line-charts/multi-series.tsx","type":"registry:component","target":"components/examples/line-charts/multi-series.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useInView, useReducedMotion } from \"motion/react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface LineSeries {\n  id: string;\n  label: string;\n  /** One value per label, oldest first. */\n  values: number[];\n}\n\nexport interface MultiSeriesLineChartProps {\n  title?: string;\n  subtitle?: string;\n  /** X-axis labels, one per point. */\n  labels?: string[];\n  /** First series is the primary (volt); the rest render in neutral tones. */\n  series?: LineSeries[];\n  formatValue?: (n: number) => string;\n  /** Formats the y-axis ticks. */\n  formatTick?: (n: number) => string;\n  className?: string;\n}\n\nconst LABELS = [\"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\", \"Jan\", \"Feb\", \"Mar\"];\nconst SERIES: LineSeries[] = [\n  { id: \"web\", label: \"Web app\", values: [18.2, 19.4, 21.1, 20.6, 22.8, 24.9, 26.3, 25.8, 28.4, 30.1, 31.7, 34.2] },\n  { id: \"ios\", label: \"iOS\", values: [9.1, 9.8, 10.4, 11.9, 12.2, 13.6, 14.1, 15.8, 16.3, 17.9, 18.4, 19.6] },\n  { id: \"android\", label: \"Android\", values: [6.4, 6.9, 7.2, 7.1, 8.0, 8.6, 9.3, 9.1, 10.2, 10.8, 11.6, 12.1] },\n];\nconst STYLES = [\n  { stroke: \"var(--volt-ink)\", width: 2.25, dash: undefined },\n  { stroke: \"var(--ink-muted)\", width: 1.75, dash: undefined },\n  { stroke: \"var(--ink-subtle)\", width: 1.75, dash: \"5 4\" },\n  { stroke: \"var(--ink-subtle)\", width: 1.5, dash: \"1.5 3.5\" },\n];\n\nfunction niceTicks(max: number, count = 4) {\n  const raw = Math.max(max, 1e-6) / count;\n  const mag = 10 ** Math.floor(Math.log10(raw));\n  const step = [1, 2, 2.5, 5, 10].map((m) => m * mag).find((s) => s >= raw) ?? raw;\n  return Array.from({ length: count + 1 }, (_, i) => i * step);\n}\n\nfunction smooth(pts: [number, number][]) {\n  const f = (n: number) => n.toFixed(2);\n  return pts\n    .map((p, i) => {\n      if (i === 0) return `M${f(p[0])},${f(p[1])}`;\n      const a = pts[i - 2] ?? pts[i - 1];\n      const b = pts[i - 1];\n      const c = pts[i + 1] ?? p;\n      return `C${f(b[0] + (p[0] - a[0]) / 6)},${f(b[1] + (p[1] - a[1]) / 6)} ${f(p[0] - (c[0] - b[0]) / 6)},${f(p[1] - (c[1] - b[1]) / 6)} ${f(p[0])},${f(p[1])}`;\n    })\n    .join(\"\");\n}\n\n/** Multi-series line chart: legend toggles rescale the axis with a spring morph, and a crosshair reads every visible series on hover or arrow keys. */\nexport function MultiSeriesLineChart({\n  title = \"Weekly active users\",\n  subtitle = \"By platform, in thousands\",\n  labels = LABELS,\n  series = SERIES,\n  formatValue = (n) => `${n.toFixed(1)}k`,\n  formatTick = (n) => (n ? `${n}k` : \"0\"),\n  className,\n}: MultiSeriesLineChartProps) {\n  const reduce = useReducedMotion() ?? false;\n  const ref = React.useRef<HTMLDivElement>(null);\n  const inView = useInView(ref, { once: true, margin: \"-40px\" });\n  const uid = React.useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n  const [hidden, setHidden] = React.useState<Set<string>>(new Set());\n  const [active, setActive] = React.useState<number | null>(null);\n\n  const n = labels.length;\n  const visible = series.filter((s) => !hidden.has(s.id));\n  const ticks = niceTicks(Math.max(...visible.flatMap((s) => s.values), 0));\n  const top = ticks[ticks.length - 1] || 1;\n  const xp = (i: number) => (n > 1 ? (i / (n - 1)) * 100 : 50);\n  const yp = (v: number) => (1 - v / top) * 100;\n  const spring = reduce ? { duration: 0 } : { type: \"spring\" as const, stiffness: 200, damping: 30 };\n\n  const toggle = (id: string) =>\n    setHidden((prev) => {\n      const next = new Set(prev);\n      if (next.has(id)) next.delete(id);\n      else if (series.length - next.size > 1) next.add(id);\n      return next;\n    });\n\n  function onMove(e: React.PointerEvent<HTMLDivElement>) {\n    const r = e.currentTarget.getBoundingClientRect();\n    setActive(Math.max(0, Math.min(n - 1, Math.round(((e.clientX - r.left) / r.width) * (n - 1)))));\n  }\n  function onKey(e: React.KeyboardEvent) {\n    const map: Record<string, number> = { ArrowLeft: -1, ArrowRight: 1 };\n    if (e.key in map) {\n      e.preventDefault();\n      setActive((a) => Math.max(0, Math.min(n - 1, (a ?? n - 1) + map[e.key])));\n    } else if (e.key === \"Home\" || e.key === \"End\") {\n      e.preventDefault();\n      setActive(e.key === \"Home\" ? 0 : n - 1);\n    } else if (e.key === \"Escape\") setActive(null);\n  }\n\n  const summary = `${title}. ${series.map((s) => `${s.label} from ${formatValue(s.values[0] ?? 0)} to ${formatValue(s.values[n - 1] ?? 0)}`).join(\"; \")}.`;\n\n  return (\n    <figure className={cn(\"@container w-full rounded-xl border border-border bg-surface-raised p-4 shadow-sm sm:p-5\", className)}>\n      <div className=\"flex flex-wrap items-start justify-between gap-3\">\n        <figcaption>\n          <p className=\"text-[15px] font-semibold text-ink\">{title}</p>\n          <p className=\"text-[12.5px] text-ink-subtle\">{subtitle}</p>\n        </figcaption>\n        <ul className=\"flex flex-wrap gap-1.5\" aria-label=\"Toggle series\">\n          {series.map((s, i) => {\n            const on = !hidden.has(s.id);\n            const st = STYLES[i % STYLES.length];\n            return (\n              <li key={s.id}>\n                <motion.button\n                  type=\"button\"\n                  whileTap={{ scale: 0.96 }}\n                  aria-pressed={on}\n                  onClick={() => toggle(s.id)}\n                  className={cn(\n                    \"inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-[12px] font-medium outline-none transition-colors focus-visible:shadow-[var(--focus-ring)]\",\n                    on ? \"border-border-strong/40 bg-surface text-ink\" : \"border-dashed border-border text-ink-subtle\",\n                  )}\n                >\n                  <svg aria-hidden width=\"14\" height=\"4\" className=\"overflow-visible\">\n                    <line x1=\"0\" x2=\"14\" y1=\"2\" y2=\"2\" style={{ stroke: st.stroke, opacity: on ? 1 : 0.35 }} strokeWidth={2.5} strokeDasharray={st.dash} strokeLinecap=\"round\" />\n                  </svg>\n                  {s.label}\n                </motion.button>\n              </li>\n            );\n          })}\n        </ul>\n      </div>\n\n      <div className=\"mt-5 grid grid-cols-[2.25rem_minmax(0,1fr)] gap-x-2\">\n        <div aria-hidden className=\"relative h-52 @md:h-60\">\n          {ticks.map((t) => (\n            <motion.span key={t} layout=\"position\" className=\"absolute right-0 -translate-y-1/2 font-mono text-[10.5px] tabular-nums text-ink-subtle\" style={{ top: `${yp(t)}%` }}>\n              {formatTick(t)}\n            </motion.span>\n          ))}\n        </div>\n        <div\n          ref={ref}\n          tabIndex={0}\n          role=\"group\"\n          aria-label={`${title} chart. Use left and right arrow keys to read each month.`}\n          onPointerMove={onMove}\n          onPointerLeave={() => setActive(null)}\n          onFocus={() => setActive((a) => a ?? n - 1)}\n          onBlur={() => setActive(null)}\n          onKeyDown={onKey}\n          className=\"relative h-52 touch-none rounded-xs outline-none focus-visible:shadow-[var(--focus-ring)] @md:h-60\"\n        >\n          <svg role=\"img\" aria-label={summary} viewBox=\"0 0 100 100\" preserveAspectRatio=\"none\" className=\"absolute inset-0 size-full overflow-visible\">\n            <defs>\n              <clipPath id={`${uid}-reveal`}>\n                <motion.rect x={-2} y={-10} height={120} initial={{ width: reduce ? 104 : 0 }} animate={{ width: inView ? 104 : reduce ? 104 : 0 }} transition={{ duration: reduce ? 0 : 1.2, ease: [0.65, 0, 0.35, 1] }} />\n              </clipPath>\n            </defs>\n            {ticks.map((t, i) => (\n              <motion.line key={t} initial={false} animate={{ y1: yp(t), y2: yp(t) }} transition={spring} x1={0} x2={100} className=\"stroke-border\" strokeDasharray={i === 0 ? undefined : \"2 4\"} vectorEffect=\"non-scaling-stroke\" />\n            ))}\n            <g clipPath={`url(#${uid}-reveal)`}>\n              {series.map((s, i) => {\n                const st = STYLES[i % STYLES.length];\n                const d = smooth(s.values.map((v, k) => [xp(k), yp(v)]));\n                return (\n                  <motion.path\n                    key={s.id}\n                    initial={false}\n                    animate={{ d, opacity: hidden.has(s.id) ? 0 : 1 }}\n                    transition={{ d: spring, opacity: { duration: 0.2 } }}\n                    fill=\"none\"\n                    style={{ stroke: st.stroke }}\n                    strokeWidth={st.width}\n                    strokeDasharray={st.dash}\n                    strokeLinecap=\"round\"\n                    vectorEffect=\"non-scaling-stroke\"\n                  />\n                );\n              })}\n            </g>\n            {active !== null && <line x1={xp(active)} x2={xp(active)} y1={0} y2={100} className=\"stroke-ink-subtle\" strokeDasharray=\"3 3\" vectorEffect=\"non-scaling-stroke\" />}\n          </svg>\n\n          {active !== null &&\n            series.map((s, i) =>\n              hidden.has(s.id) ? null : (\n                <motion.span\n                  key={s.id}\n                  aria-hidden\n                  initial={false}\n                  animate={{ left: `${xp(active)}%`, top: `${yp(s.values[active] ?? 0)}%` }}\n                  transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 520, damping: 38 }}\n                  className=\"pointer-events-none absolute size-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-surface-raised\"\n                  style={{ background: STYLES[i % STYLES.length].stroke }}\n                />\n              ),\n            )}\n\n          <AnimatePresence>\n            {active !== null && (\n              <motion.div\n                key=\"tip\"\n                aria-hidden\n                initial={{ opacity: 0, scale: 0.96, left: `${xp(active)}%` }}\n                animate={{ opacity: 1, scale: 1, left: `${xp(active)}%` }}\n                exit={{ opacity: 0, transition: { duration: 0.1 } }}\n                transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 480, damping: 36 }}\n                style={{ x: xp(active) > 55 ? \"calc(-100% - 12px)\" : \"12px\" }}\n                className=\"pointer-events-none absolute top-1 z-10 min-w-36 rounded-sm border border-border bg-surface-raised px-2.5 py-2 text-xs shadow-md\"\n              >\n                <p className=\"mb-1 font-medium text-ink-muted\">{labels[active]}</p>\n                {series.map((s, i) =>\n                  hidden.has(s.id) ? null : (\n                    <p key={s.id} className=\"flex items-center justify-between gap-4\">\n                      <span className=\"flex items-center gap-1.5 text-ink-muted\">\n                        <span className=\"size-1.5 rounded-full\" style={{ background: STYLES[i % STYLES.length].stroke }} />\n                        {s.label}\n                      </span>\n                      <span className=\"font-mono font-semibold tabular-nums text-ink\">{formatValue(s.values[active] ?? 0)}</span>\n                    </p>\n                  ),\n                )}\n              </motion.div>\n            )}\n          </AnimatePresence>\n        </div>\n        <div />\n        <div aria-hidden className=\"relative mt-2 h-4\">\n          {labels.map((l, i) => (\n            <span\n              key={l + i}\n              className={cn(\"absolute font-mono text-[10.5px] text-ink-subtle\", i === 0 ? \"\" : i === n - 1 ? \"-translate-x-full\" : \"-translate-x-1/2\", (i % 2 === 1 || i === n - 2) && i !== n - 1 && \"hidden @md:block\")}\n              style={{ left: `${xp(i)}%` }}\n            >\n              {l}\n            </span>\n          ))}\n        </div>\n      </div>\n      <p className=\"sr-only\" aria-live=\"polite\">\n        {active !== null ? `${labels[active]}: ${visible.map((s) => `${s.label} ${formatValue(s.values[active] ?? 0)}`).join(\", \")}` : \"\"}\n      </p>\n    </figure>\n  );\n}\n"},{"path":"registry/geturui/examples/line-charts/gradient-metric.tsx","type":"registry:component","target":"components/examples/line-charts/gradient-metric.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useInView, useReducedMotion } from \"motion/react\";\nimport { ArrowDown, ArrowUp } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface GradientMetricChartProps {\n  title?: string;\n  /** One value per label, oldest first. */\n  values?: number[];\n  labels?: string[];\n  formatValue?: (n: number) => string;\n  /** Caption under the headline value. */\n  caption?: string;\n  className?: string;\n}\n\nconst VALUES = [212, 198, 226, 241, 233, 219, 186, 204, 247, 262, 258, 241, 275, 289, 301, 284, 268, 296, 312, 334, 327, 309, 341, 358, 412, 376, 352, 369, 388, 394];\nconst LABELS = VALUES.map((_, i) => {\n  const d = new Date(Date.UTC(2026, 8, 3 + i));\n  return d.toLocaleDateString(\"en-US\", { month: \"short\", day: \"numeric\", timeZone: \"UTC\" });\n});\n\nfunction domain(min: number, max: number, count = 4) {\n  const raw = Math.max(max - min, 1) / count;\n  const mag = 10 ** Math.floor(Math.log10(raw));\n  const step = [1, 2, 2.5, 5, 10].map((m) => m * mag).find((s) => s >= raw) ?? raw;\n  const lo = Math.floor(min / step) * step;\n  const hi = Math.ceil(max / step) * step;\n  return { lo, hi, ticks: Array.from({ length: Math.round((hi - lo) / step) + 1 }, (_, i) => lo + i * step) };\n}\n\nfunction smooth(pts: [number, number][]) {\n  const f = (n: number) => n.toFixed(2);\n  return pts\n    .map((p, i) => {\n      if (i === 0) return `M${f(p[0])},${f(p[1])}`;\n      const a = pts[i - 2] ?? pts[i - 1];\n      const b = pts[i - 1];\n      const c = pts[i + 1] ?? p;\n      return `C${f(b[0] + (p[0] - a[0]) / 6)},${f(b[1] + (p[1] - a[1]) / 6)} ${f(p[0] - (c[0] - b[0]) / 6)},${f(p[1] - (c[1] - b[1]) / 6)} ${f(p[0])},${f(p[1])}`;\n    })\n    .join(\"\");\n}\n\n/** Single-metric line with a volt gradient, labelled peak and low markers, an average guide and a crosshair readout on hover or arrow keys. */\nexport function GradientMetricChart({\n  title = \"Daily signups\",\n  values = VALUES,\n  labels = LABELS,\n  formatValue = (n) => Math.round(n).toLocaleString(\"en-US\"),\n  caption = \"Last 30 days\",\n  className,\n}: GradientMetricChartProps) {\n  const reduce = useReducedMotion() ?? false;\n  const ref = React.useRef<HTMLDivElement>(null);\n  const inView = useInView(ref, { once: true, margin: \"-40px\" });\n  const uid = React.useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n  const [active, setActive] = React.useState<number | null>(null);\n\n  const n = values.length;\n  const min = Math.min(...values);\n  const max = Math.max(...values);\n  const { lo, hi, ticks } = domain(min, max);\n  const avg = values.reduce((a, b) => a + b, 0) / Math.max(n, 1);\n  const iMin = values.indexOf(min);\n  const iMax = values.indexOf(max);\n  const xp = (i: number) => (n > 1 ? (i / (n - 1)) * 100 : 50);\n  const yp = (v: number) => (1 - (v - lo) / (hi - lo || 1)) * 100;\n  const pts = values.map((v, i) => [xp(i), yp(v)] as [number, number]);\n  const line = smooth(pts);\n  const last = values[n - 1] ?? 0;\n  const change = values[0] ? (last - values[0]) / values[0] : 0;\n\n  function onMove(e: React.PointerEvent<HTMLDivElement>) {\n    const r = e.currentTarget.getBoundingClientRect();\n    setActive(Math.max(0, Math.min(n - 1, Math.round(((e.clientX - r.left) / r.width) * (n - 1)))));\n  }\n  function onKey(e: React.KeyboardEvent) {\n    if (e.key === \"ArrowLeft\" || e.key === \"ArrowRight\") {\n      e.preventDefault();\n      setActive((a) => Math.max(0, Math.min(n - 1, (a ?? n - 1) + (e.key === \"ArrowRight\" ? 1 : -1))));\n    } else if (e.key === \"Home\" || e.key === \"End\") {\n      e.preventDefault();\n      setActive(e.key === \"Home\" ? 0 : n - 1);\n    } else if (e.key === \"Escape\") setActive(null);\n  }\n\n  const marker = (i: number, kind: \"Peak\" | \"Low\") => (\n    <motion.div\n      key={kind}\n      aria-hidden\n      initial={{ opacity: 0, y: kind === \"Peak\" ? 6 : -6 }}\n      animate={inView ? { opacity: active === null ? 1 : 0.35, y: 0 } : undefined}\n      transition={{ delay: reduce ? 0 : 1.1, type: \"spring\", stiffness: 320, damping: 26 }}\n      className=\"pointer-events-none absolute\"\n      style={{ left: `${xp(i)}%`, top: `${yp(values[i] ?? 0)}%` }}\n    >\n      <span className=\"absolute size-2 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-surface-raised bg-ink\" />\n      <span\n        className={cn(\n          \"absolute whitespace-nowrap rounded-full border border-border bg-surface-raised px-2 py-0.5 text-[11px] shadow-sm\",\n          kind === \"Peak\" ? \"bottom-2.5\" : \"top-2.5\",\n          xp(i) > 75 ? \"right-0 translate-x-3\" : xp(i) < 25 ? \"left-0 -translate-x-3\" : \"-translate-x-1/2\",\n        )}\n      >\n        <span className=\"text-ink-subtle\">{kind} </span>\n        <span className=\"font-mono font-semibold tabular-nums text-ink\">{formatValue(values[i] ?? 0)}</span>\n        <span className=\"text-ink-subtle\"> · {labels[i]}</span>\n      </span>\n    </motion.div>\n  );\n\n  return (\n    <figure className={cn(\"@container w-full rounded-xl border border-border bg-surface-raised p-4 shadow-sm sm:p-5\", className)}>\n      <figcaption className=\"flex flex-wrap items-end justify-between gap-3\">\n        <div>\n          <p className=\"text-[13px] font-medium text-ink-muted\">{title}</p>\n          <p className=\"mt-1 font-display text-[32px] font-semibold leading-none tracking-[-0.8px] tabular-nums text-ink\">{formatValue(active === null ? last : values[active] ?? 0)}</p>\n          <p className=\"mt-1.5 text-[12px] text-ink-subtle\">{active === null ? caption : labels[active]}</p>\n        </div>\n        <p className={cn(\"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[12px] font-semibold tabular-nums\", change >= 0 ? \"bg-volt-soft text-success\" : \"bg-surface text-danger\")}>\n          {change >= 0 ? <ArrowUp aria-hidden className=\"size-3.5\" /> : <ArrowDown aria-hidden className=\"size-3.5\" />}\n          {change >= 0 ? \"Up\" : \"Down\"} {Math.abs(change * 100).toFixed(1)}%\n          <span className=\"font-normal text-ink-subtle\">over period</span>\n        </p>\n      </figcaption>\n\n      <div className=\"mt-8 grid grid-cols-[2.25rem_minmax(0,1fr)] gap-x-2\">\n        <div aria-hidden className=\"relative h-48 @md:h-56\">\n          {ticks.map((t) => (\n            <span key={t} className=\"absolute right-0 -translate-y-1/2 font-mono text-[10.5px] tabular-nums text-ink-subtle\" style={{ top: `${yp(t)}%` }}>\n              {formatValue(t)}\n            </span>\n          ))}\n        </div>\n        <div\n          ref={ref}\n          tabIndex={0}\n          role=\"group\"\n          aria-label={`${title} chart. Use left and right arrow keys to read each day.`}\n          onPointerMove={onMove}\n          onPointerLeave={() => setActive(null)}\n          onFocus={() => setActive((a) => a ?? n - 1)}\n          onBlur={() => setActive(null)}\n          onKeyDown={onKey}\n          className=\"relative h-48 touch-none rounded-xs outline-none focus-visible:shadow-[var(--focus-ring)] @md:h-56\"\n        >\n          <svg\n            role=\"img\"\n            aria-label={`${title}, ${caption}: from ${formatValue(values[0] ?? 0)} to ${formatValue(last)}. Peak ${formatValue(max)} on ${labels[iMax]}, low ${formatValue(min)} on ${labels[iMin]}, average ${formatValue(avg)}.`}\n            viewBox=\"0 0 100 100\"\n            preserveAspectRatio=\"none\"\n            className=\"absolute inset-0 size-full overflow-visible\"\n          >\n            <defs>\n              <linearGradient id={`${uid}-fill`} x1=\"0\" x2=\"0\" y1=\"0\" y2=\"1\">\n                <stop offset=\"0%\" style={{ stopColor: \"var(--volt-ink)\", stopOpacity: 0.3 }} />\n                <stop offset=\"100%\" style={{ stopColor: \"var(--volt-ink)\", stopOpacity: 0 }} />\n              </linearGradient>\n              <clipPath id={`${uid}-reveal`}>\n                <motion.rect x={-2} y={-10} height={120} initial={{ width: reduce ? 104 : 0 }} animate={{ width: inView || reduce ? 104 : 0 }} transition={{ duration: reduce ? 0 : 1.3, ease: [0.65, 0, 0.35, 1] }} />\n              </clipPath>\n            </defs>\n            {ticks.map((t, i) => (\n              <line key={t} x1={0} x2={100} y1={yp(t)} y2={yp(t)} className=\"stroke-border\" strokeDasharray={i === 0 ? undefined : \"2 4\"} vectorEffect=\"non-scaling-stroke\" />\n            ))}\n            <line x1={0} x2={100} y1={yp(avg)} y2={yp(avg)} className=\"stroke-ink-subtle\" strokeDasharray=\"6 4\" vectorEffect=\"non-scaling-stroke\" />\n            <g clipPath={`url(#${uid}-reveal)`}>\n              <path d={`${line}L100,100L0,100Z`} fill={`url(#${uid}-fill)`} />\n              <path d={line} fill=\"none\" style={{ stroke: \"var(--volt-ink)\" }} strokeWidth={2.25} strokeLinecap=\"round\" vectorEffect=\"non-scaling-stroke\" />\n            </g>\n            {active !== null && <line x1={xp(active)} x2={xp(active)} y1={0} y2={100} className=\"stroke-ink-subtle\" strokeDasharray=\"3 3\" vectorEffect=\"non-scaling-stroke\" />}\n          </svg>\n\n          <span aria-hidden className=\"absolute right-1 -translate-y-full pb-0.5 font-mono text-[10.5px] text-ink-muted\" style={{ top: `${yp(avg)}%` }}>\n            Avg {formatValue(avg)}\n          </span>\n          {marker(iMax, \"Peak\")}\n          {marker(iMin, \"Low\")}\n\n          <motion.span\n            aria-hidden\n            initial={{ opacity: 0, scale: 0 }}\n            animate={inView ? { opacity: 1, scale: 1 } : undefined}\n            transition={{ delay: reduce ? 0 : 1.2, type: \"spring\", stiffness: 400, damping: 20 }}\n            className=\"pointer-events-none absolute -ml-1.5 -mt-1.5 size-3 rounded-full bg-volt-ink ring-4 ring-volt-soft\"\n            style={{ left: \"100%\", top: `${yp(last)}%` }}\n          />\n          <AnimatePresence>\n            {active !== null && (\n              <motion.span\n                key=\"dot\"\n                aria-hidden\n                initial={{ opacity: 0, left: `${xp(active)}%`, top: `${yp(values[active] ?? 0)}%` }}\n                animate={{ opacity: 1, left: `${xp(active)}%`, top: `${yp(values[active] ?? 0)}%` }}\n                exit={{ opacity: 0 }}\n                transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 520, damping: 38 }}\n                className=\"pointer-events-none absolute size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-surface-raised bg-volt-ink shadow-sm\"\n              />\n            )}\n          </AnimatePresence>\n        </div>\n        <div />\n        <div aria-hidden className=\"mt-2 flex justify-between font-mono text-[10.5px] text-ink-subtle\">\n          <span>{labels[0]}</span>\n          <span className=\"hidden @md:inline\">{labels[Math.floor((n - 1) / 2)]}</span>\n          <span>{labels[n - 1]}</span>\n        </div>\n      </div>\n      <p className=\"sr-only\" aria-live=\"polite\">\n        {active !== null ? `${labels[active]}: ${formatValue(values[active] ?? 0)}` : \"\"}\n      </p>\n    </figure>\n  );\n}\n"},{"path":"registry/geturui/examples/line-charts/period-comparison.tsx","type":"registry:component","target":"components/examples/line-charts/period-comparison.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useInView, useReducedMotion } from \"motion/react\";\nimport { TrendingDown, TrendingUp } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface ComparisonPeriod {\n  /** Tab label, e.g. \"Month\". */\n  key: string;\n  /** Point labels, same length as the series. Every period should use the same point count so lines can morph. */\n  labels: string[];\n  current: number[];\n  previous: number[];\n  /** Wording for the comparison, e.g. \"last month\". */\n  previousLabel: string;\n}\n\nexport interface PeriodComparisonChartProps {\n  title?: string;\n  periods?: ComparisonPeriod[];\n  defaultPeriod?: string;\n  formatValue?: (n: number) => string;\n  className?: string;\n}\n\nconst cum = (xs: number[]) => xs.reduce<number[]>((acc, x) => [...acc, (acc[acc.length - 1] ?? 0) + x], []);\nconst PERIODS: ComparisonPeriod[] = [\n  { key: \"Week\", previousLabel: \"last week\", labels: [\"Mon 9a\", \"Mon 6p\", \"Tue 9a\", \"Tue 6p\", \"Wed 9a\", \"Wed 6p\", \"Thu 9a\", \"Thu 6p\", \"Fri 9a\", \"Fri 6p\", \"Sat\", \"Sun\"], current: cum([1.2, 1.6, 1.4, 1.9, 1.5, 2.1, 1.7, 2.4, 1.9, 2.2, 1.1, 0.9]), previous: cum([1.1, 1.3, 1.5, 1.4, 1.6, 1.7, 1.5, 1.9, 1.8, 2.0, 1.2, 1.0]) },\n  { key: \"Month\", previousLabel: \"last month\", labels: [\"Sep 1\", \"Sep 4\", \"Sep 6\", \"Sep 9\", \"Sep 11\", \"Sep 14\", \"Sep 16\", \"Sep 19\", \"Sep 21\", \"Sep 24\", \"Sep 26\", \"Sep 29\"], current: cum([5.2, 6.1, 5.8, 7.4, 6.6, 8.1, 7.2, 7.9, 6.8, 8.6, 7.7, 6.9]), previous: cum([5.6, 5.9, 6.2, 6.4, 6.0, 6.9, 6.5, 7.0, 6.3, 7.1, 6.8, 6.1]) },\n  { key: \"Quarter\", previousLabel: \"last quarter\", labels: [\"W1\", \"W2\", \"W3\", \"W4\", \"W5\", \"W6\", \"W7\", \"W8\", \"W9\", \"W10\", \"W11\", \"W12\"], current: cum([17.4, 18.2, 16.9, 19.6, 21.3, 20.1, 22.4, 21.8, 23.5, 24.2, 22.9, 25.7]), previous: cum([18.1, 18.6, 19.0, 18.4, 19.7, 20.3, 19.9, 20.8, 21.2, 20.6, 21.9, 22.4]) },\n];\n\nfunction niceTop(max: number, count = 4) {\n  const raw = Math.max(max, 1e-6) / count;\n  const mag = 10 ** Math.floor(Math.log10(raw));\n  const step = [1, 2, 2.5, 5, 10].map((m) => m * mag).find((s) => s >= raw) ?? raw;\n  return Array.from({ length: count + 1 }, (_, i) => i * step);\n}\n\nfunction smooth(pts: [number, number][], move = true) {\n  const f = (n: number) => n.toFixed(2);\n  return pts\n    .map((p, i) => {\n      if (i === 0) return `${move ? \"M\" : \"L\"}${f(p[0])},${f(p[1])}`;\n      const a = pts[i - 2] ?? pts[i - 1];\n      const b = pts[i - 1];\n      const c = pts[i + 1] ?? p;\n      return `C${f(b[0] + (p[0] - a[0]) / 6)},${f(b[1] + (p[1] - a[1]) / 6)} ${f(p[0] - (c[0] - b[0]) / 6)},${f(p[1] - (c[1] - b[1]) / 6)} ${f(p[0])},${f(p[1])}`;\n    })\n    .join(\"\");\n}\n\n/** This period against the last: solid volt vs dashed neutral, the gap between them shaded, period tabs that morph both lines with a spring. */\nexport function PeriodComparisonChart({ title = \"Cumulative bookings\", periods = PERIODS, defaultPeriod = \"Month\", formatValue = (n) => `$${n.toFixed(1)}k`, className }: PeriodComparisonChartProps) {\n  const reduce = useReducedMotion() ?? false;\n  const ref = React.useRef<HTMLDivElement>(null);\n  const inView = useInView(ref, { once: true, margin: \"-40px\" });\n  const uid = React.useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n  const [key, setKey] = React.useState(defaultPeriod);\n  const [active, setActive] = React.useState<number | null>(null);\n  const p = periods.find((x) => x.key === key) ?? periods[0];\n  const n = p.labels.length;\n\n  const ticks = niceTop(Math.max(...p.current, ...p.previous));\n  const top = ticks[ticks.length - 1] || 1;\n  const xp = (i: number) => (n > 1 ? (i / (n - 1)) * 100 : 50);\n  const yp = (v: number) => (1 - v / top) * 100;\n  const cur = p.current.map((v, i) => [xp(i), yp(v)] as [number, number]);\n  const prev = p.previous.map((v, i) => [xp(i), yp(v)] as [number, number]);\n  const dCur = smooth(cur);\n  const dPrev = smooth(prev);\n  const dGap = `${dCur}${smooth([...prev].reverse(), false)}Z`;\n  const spring = reduce ? { duration: 0 } : { type: \"spring\" as const, stiffness: 180, damping: 28 };\n\n  const total = p.current[n - 1] ?? 0;\n  const before = p.previous[n - 1] ?? 0;\n  const delta = before ? (total - before) / before : 0;\n  const up = delta >= 0;\n\n  function onMove(e: React.PointerEvent<HTMLDivElement>) {\n    const r = e.currentTarget.getBoundingClientRect();\n    setActive(Math.max(0, Math.min(n - 1, Math.round(((e.clientX - r.left) / r.width) * (n - 1)))));\n  }\n  function onKey(e: React.KeyboardEvent) {\n    if (e.key === \"ArrowLeft\" || e.key === \"ArrowRight\") {\n      e.preventDefault();\n      setActive((a) => Math.max(0, Math.min(n - 1, (a ?? n - 1) + (e.key === \"ArrowRight\" ? 1 : -1))));\n    } else if (e.key === \"Escape\") setActive(null);\n  }\n\n  const a = active ?? null;\n  const aCur = a !== null ? p.current[a] ?? 0 : 0;\n  const aPrev = a !== null ? p.previous[a] ?? 0 : 0;\n\n  return (\n    <figure className={cn(\"@container w-full rounded-xl border border-border bg-surface-raised p-4 shadow-sm sm:p-5\", className)}>\n      <div className=\"flex flex-wrap items-start justify-between gap-3\">\n        <figcaption>\n          <p className=\"text-[13px] font-medium text-ink-muted\">{title}</p>\n          <p className=\"mt-1 font-display text-[30px] font-semibold leading-none tracking-[-0.8px] tabular-nums text-ink\">{formatValue(total)}</p>\n          <p className=\"mt-2 flex flex-wrap items-center gap-x-1.5 text-[12px]\">\n            <span className={cn(\"inline-flex items-center gap-1 font-semibold\", up ? \"text-success\" : \"text-danger\")}>\n              {up ? <TrendingUp aria-hidden className=\"size-3.5\" /> : <TrendingDown aria-hidden className=\"size-3.5\" />}\n              {up ? \"Ahead\" : \"Behind\"} {Math.abs(delta * 100).toFixed(1)}%\n            </span>\n            <span className=\"text-ink-subtle\">\n              vs {formatValue(before)} {p.previousLabel}\n            </span>\n          </p>\n        </figcaption>\n        <div role=\"group\" aria-label=\"Period\" className=\"flex rounded-full bg-surface p-0.5\">\n          {periods.map((x) => (\n            <button\n              key={x.key}\n              type=\"button\"\n              aria-pressed={x.key === p.key}\n              onClick={() => setKey(x.key)}\n              className={cn(\"relative h-7 rounded-full px-3 text-[12px] font-medium outline-none focus-visible:shadow-[var(--focus-ring)]\", x.key === p.key ? \"text-ink\" : \"text-ink-subtle hover:text-ink\")}\n            >\n              {x.key === p.key && <motion.span layoutId={`${uid}-tab`} transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 420, damping: 32 }} className=\"absolute inset-0 rounded-full bg-surface-raised shadow-sm\" />}\n              <span className=\"relative\">{x.key}</span>\n            </button>\n          ))}\n        </div>\n      </div>\n\n      <div className=\"mt-5 grid grid-cols-[2.75rem_minmax(0,1fr)] gap-x-2\">\n        <div aria-hidden className=\"relative h-48 @md:h-56\">\n          {ticks.map((t, i) => (\n            <span key={i} className=\"absolute right-0 -translate-y-1/2 font-mono text-[10.5px] tabular-nums text-ink-subtle\" style={{ top: `${(1 - i / (ticks.length - 1)) * 100}%` }}>\n              {t ? formatValue(t).replace(\".0k\", \"k\") : \"0\"}\n            </span>\n          ))}\n        </div>\n        <div\n          ref={ref}\n          tabIndex={0}\n          role=\"group\"\n          aria-label={`${title} chart. Use left and right arrow keys to compare each point.`}\n          onPointerMove={onMove}\n          onPointerLeave={() => setActive(null)}\n          onFocus={() => setActive((v) => v ?? n - 1)}\n          onBlur={() => setActive(null)}\n          onKeyDown={onKey}\n          className=\"relative h-48 touch-none rounded-xs outline-none focus-visible:shadow-[var(--focus-ring)] @md:h-56\"\n        >\n          <svg role=\"img\" aria-label={`${title} this ${p.key.toLowerCase()}: ${formatValue(total)}, ${up ? \"up\" : \"down\"} ${Math.abs(delta * 100).toFixed(1)}% on ${p.previousLabel} (${formatValue(before)}).`} viewBox=\"0 0 100 100\" preserveAspectRatio=\"none\" className=\"absolute inset-0 size-full overflow-visible\">\n            <defs>\n              <clipPath id={`${uid}-reveal`}>\n                <motion.rect x={-2} y={-10} height={120} initial={{ width: reduce ? 104 : 0 }} animate={{ width: inView || reduce ? 104 : 0 }} transition={{ duration: reduce ? 0 : 1.2, ease: [0.65, 0, 0.35, 1] }} />\n              </clipPath>\n            </defs>\n            {ticks.map((_, i) => (\n              <line key={i} x1={0} x2={100} y1={(i / (ticks.length - 1)) * 100} y2={(i / (ticks.length - 1)) * 100} className=\"stroke-border\" strokeDasharray={i === ticks.length - 1 ? undefined : \"2 4\"} vectorEffect=\"non-scaling-stroke\" />\n            ))}\n            <g clipPath={`url(#${uid}-reveal)`}>\n              <motion.path initial={false} animate={{ d: dGap }} transition={spring} style={{ fill: \"var(--volt-soft)\" }} />\n              <motion.path initial={false} animate={{ d: dPrev }} transition={spring} fill=\"none\" className=\"stroke-ink-subtle\" strokeWidth={1.75} strokeDasharray=\"5 4\" vectorEffect=\"non-scaling-stroke\" />\n              <motion.path initial={false} animate={{ d: dCur }} transition={spring} fill=\"none\" style={{ stroke: \"var(--volt-ink)\" }} strokeWidth={2.5} strokeLinecap=\"round\" vectorEffect=\"non-scaling-stroke\" />\n            </g>\n            {a !== null && <line x1={xp(a)} x2={xp(a)} y1={0} y2={100} className=\"stroke-ink-subtle\" strokeDasharray=\"3 3\" vectorEffect=\"non-scaling-stroke\" />}\n          </svg>\n\n          {a !== null && (\n            <>\n              <motion.span aria-hidden initial={false} animate={{ left: `${xp(a)}%`, top: `${yp(aPrev)}%` }} transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 520, damping: 38 }} className=\"pointer-events-none absolute size-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-ink-subtle bg-surface-raised\" />\n              <motion.span aria-hidden initial={false} animate={{ left: `${xp(a)}%`, top: `${yp(aCur)}%` }} transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 520, damping: 38 }} className=\"pointer-events-none absolute size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-surface-raised bg-volt-ink\" />\n            </>\n          )}\n          <AnimatePresence>\n            {a !== null && (\n              <motion.div\n                key=\"tip\"\n                aria-hidden\n                initial={{ opacity: 0, scale: 0.96, left: `${xp(a)}%` }}\n                animate={{ opacity: 1, scale: 1, left: `${xp(a)}%` }}\n                exit={{ opacity: 0, transition: { duration: 0.1 } }}\n                transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 480, damping: 36 }}\n                style={{ x: xp(a) > 55 ? \"calc(-100% - 12px)\" : \"12px\" }}\n                className=\"pointer-events-none absolute top-1 z-10 min-w-40 rounded-sm border border-border bg-surface-raised px-2.5 py-2 text-xs shadow-md\"\n              >\n                <p className=\"mb-1 font-medium text-ink-muted\">{p.labels[a]}</p>\n                <p className=\"flex justify-between gap-4\">\n                  <span className=\"text-ink-muted\">This {p.key.toLowerCase()}</span>\n                  <span className=\"font-mono font-semibold tabular-nums text-ink\">{formatValue(aCur)}</span>\n                </p>\n                <p className=\"flex justify-between gap-4\">\n                  <span className=\"text-ink-subtle\">Previous</span>\n                  <span className=\"font-mono tabular-nums text-ink-muted\">{formatValue(aPrev)}</span>\n                </p>\n                <p className={cn(\"mt-1 border-t border-border pt-1 text-right font-mono font-semibold tabular-nums\", aCur >= aPrev ? \"text-success\" : \"text-danger\")}>\n                  {aCur >= aPrev ? \"+\" : \"−\"}\n                  {formatValue(Math.abs(aCur - aPrev))}\n                </p>\n              </motion.div>\n            )}\n          </AnimatePresence>\n        </div>\n        <div />\n        <div aria-hidden className=\"relative mt-2 h-4\">\n          {p.labels.map((l, i) =>\n            i % 3 === 0 || i === n - 1 ? (\n              <span key={i} className={cn(\"absolute whitespace-nowrap font-mono text-[10.5px] text-ink-subtle\", i === 0 ? \"\" : i === n - 1 ? \"-translate-x-full\" : \"-translate-x-1/2\", i === n - 1 && \"hidden @md:block\")} style={{ left: `${xp(i)}%` }}>\n                {l}\n              </span>\n            ) : null,\n          )}\n        </div>\n      </div>\n      <div className=\"mt-3 flex flex-wrap gap-4 text-[12px] text-ink-muted\">\n        <span className=\"inline-flex items-center gap-1.5\">\n          <span aria-hidden className=\"h-[3px] w-4 rounded-full bg-volt-ink\" />\n          This {p.key.toLowerCase()}\n        </span>\n        <span className=\"inline-flex items-center gap-1.5\">\n          <span aria-hidden className=\"w-4 border-t-2 border-dashed border-ink-subtle\" />\n          {p.previousLabel.charAt(0).toUpperCase() + p.previousLabel.slice(1)}\n        </span>\n      </div>\n      <p className=\"sr-only\" aria-live=\"polite\">\n        {a !== null ? `${p.labels[a]}: ${formatValue(aCur)} this ${p.key.toLowerCase()}, ${formatValue(aPrev)} ${p.previousLabel}.` : \"\"}\n      </p>\n    </figure>\n  );\n}\n"},{"path":"registry/geturui/examples/line-charts/step-annotations.tsx","type":"registry:component","target":"components/examples/line-charts/step-annotations.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useInView, useReducedMotion } from \"motion/react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface StepAnnotation {\n  /** Index of the point the note belongs to. */\n  index: number;\n  title: string;\n  body: string;\n}\n\nexport interface StepAnnotationsChartProps {\n  title?: string;\n  subtitle?: string;\n  labels?: string[];\n  /** Value held from each label until the next. */\n  values?: number[];\n  annotations?: StepAnnotation[];\n  /** Optional plan limit drawn as a dashed ceiling. */\n  limit?: number;\n  unit?: string;\n  className?: string;\n}\n\nconst LABELS = [\"Oct\", \"Nov\", \"Dec\", \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\"];\nconst VALUES = [14, 14, 18, 18, 18, 31, 31, 34, 34, 27, 29, 38];\nconst NOTES: StepAnnotation[] = [\n  { index: 2, title: \"Support team onboarded\", body: \"Four agents added for the holiday queue.\" },\n  { index: 5, title: \"Design moved to the workspace\", body: \"Thirteen seats migrated from the old tool.\" },\n  { index: 9, title: \"Contractors offboarded\", body: \"Seven guest seats released after the launch.\" },\n  { index: 11, title: \"Annual plan renewed\", body: \"Limit raised to 40 seats at the new rate.\" },\n];\n\n/** Step line for values that change in jumps, with numbered annotations you can hover, focus or step through to read what moved the line. */\nexport function StepAnnotationsChart({\n  title = \"Active seats\",\n  subtitle = \"Workspace members billed each month\",\n  labels = LABELS,\n  values = VALUES,\n  annotations = NOTES,\n  limit = 40,\n  unit = \"seats\",\n  className,\n}: StepAnnotationsChartProps) {\n  const reduce = useReducedMotion() ?? false;\n  const ref = React.useRef<HTMLDivElement>(null);\n  const inView = useInView(ref, { once: true, margin: \"-40px\" });\n  const uid = React.useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n  const [active, setActive] = React.useState<number | null>(null);\n  const btns = React.useRef<(HTMLButtonElement | null)[]>([]);\n\n  const n = values.length;\n  const top = Math.ceil((Math.max(...values, limit) * 1.1) / 10) * 10;\n  const ticks = [0, top / 2, top];\n  const xp = (i: number) => (i / n) * 100;\n  const yp = (v: number) => (1 - v / top) * 100;\n  const d = values.map((v, i) => `${i ? `H${xp(i).toFixed(2)}V` : `M0,`}${yp(v).toFixed(2)}`).join(\"\") + `H100`;\n  const note = active !== null ? annotations[active] : null;\n\n  function onKey(e: React.KeyboardEvent, i: number) {\n    if (e.key !== \"ArrowLeft\" && e.key !== \"ArrowRight\") return;\n    e.preventDefault();\n    const next = (i + (e.key === \"ArrowRight\" ? 1 : -1) + annotations.length) % annotations.length;\n    btns.current[next]?.focus();\n  }\n\n  return (\n    <figure className={cn(\"@container w-full rounded-xl border border-border bg-surface-raised p-4 shadow-sm sm:p-5\", className)}>\n      <figcaption className=\"flex flex-wrap items-end justify-between gap-2\">\n        <div>\n          <p className=\"text-[15px] font-semibold text-ink\">{title}</p>\n          <p className=\"text-[12.5px] text-ink-subtle\">{subtitle}</p>\n        </div>\n        <p className=\"text-[12px] text-ink-muted\">\n          <span className=\"font-mono text-[18px] font-semibold tabular-nums text-ink\">{values[n - 1]}</span> of {limit} {unit}\n        </p>\n      </figcaption>\n\n      <div className=\"mt-6 grid grid-cols-[1.75rem_minmax(0,1fr)] gap-x-2\">\n        <div aria-hidden className=\"relative h-44 @md:h-52\">\n          {ticks.map((t) => (\n            <span key={t} className=\"absolute right-0 -translate-y-1/2 font-mono text-[10.5px] tabular-nums text-ink-subtle\" style={{ top: `${yp(t)}%` }}>\n              {t}\n            </span>\n          ))}\n        </div>\n        <div ref={ref} className=\"relative h-44 @md:h-52\" onPointerLeave={() => setActive(null)}>\n          <svg\n            role=\"img\"\n            aria-label={`${title}: ${values[0]} in ${labels[0]} to ${values[n - 1]} in ${labels[n - 1]}, against a limit of ${limit}. ${annotations.length} annotated changes listed below.`}\n            viewBox=\"0 0 100 100\"\n            preserveAspectRatio=\"none\"\n            className=\"absolute inset-0 size-full overflow-visible\"\n          >\n            <defs>\n              <linearGradient id={`${uid}-fill`} x1=\"0\" x2=\"0\" y1=\"0\" y2=\"1\">\n                <stop offset=\"0%\" style={{ stopColor: \"var(--volt-ink)\", stopOpacity: 0.18 }} />\n                <stop offset=\"100%\" style={{ stopColor: \"var(--volt-ink)\", stopOpacity: 0 }} />\n              </linearGradient>\n              <clipPath id={`${uid}-reveal`}>\n                <motion.rect x={-2} y={-10} height={120} initial={{ width: reduce ? 104 : 0 }} animate={{ width: inView || reduce ? 104 : 0 }} transition={{ duration: reduce ? 0 : 1.3, ease: [0.65, 0, 0.35, 1] }} />\n              </clipPath>\n            </defs>\n            {ticks.map((t) => (\n              <line key={t} x1={0} x2={100} y1={yp(t)} y2={yp(t)} className=\"stroke-border\" strokeDasharray={t ? \"2 4\" : undefined} vectorEffect=\"non-scaling-stroke\" />\n            ))}\n            <line x1={0} x2={100} y1={yp(limit)} y2={yp(limit)} className=\"stroke-ink-muted\" strokeDasharray=\"6 4\" vectorEffect=\"non-scaling-stroke\" />\n            <g clipPath={`url(#${uid}-reveal)`}>\n              <path d={`${d}V100H0Z`} fill={`url(#${uid}-fill)`} />\n              <path d={d} fill=\"none\" style={{ stroke: \"var(--volt-ink)\" }} strokeWidth={2.25} strokeLinejoin=\"round\" vectorEffect=\"non-scaling-stroke\" />\n            </g>\n            {note && <line x1={xp(note.index)} x2={xp(note.index)} y1={0} y2={100} className=\"stroke-ink-subtle\" strokeDasharray=\"3 3\" vectorEffect=\"non-scaling-stroke\" />}\n          </svg>\n          <span aria-hidden className=\"absolute left-1 -translate-y-full pb-0.5 text-[10.5px] font-medium text-ink-muted\" style={{ top: `${yp(limit)}%` }}>\n            Plan limit · {limit}\n          </span>\n\n          {annotations.map((a, i) => (\n            <motion.button\n              key={a.index}\n              ref={(el) => {\n                btns.current[i] = el;\n              }}\n              type=\"button\"\n              aria-label={`${labels[a.index]}: ${a.title}. ${a.body}`}\n              aria-describedby={active === i ? `${uid}-note` : undefined}\n              initial={{ opacity: 0, scale: 0.4 }}\n              animate={inView || reduce ? { opacity: 1, scale: active === i ? 1.15 : 1 } : undefined}\n              transition={{ type: \"spring\", stiffness: 420, damping: 22, delay: reduce || active !== null ? 0 : 1 + i * 0.12 }}\n              onPointerEnter={() => setActive(i)}\n              onFocus={() => setActive(i)}\n              onBlur={() => setActive(null)}\n              onKeyDown={(e) => onKey(e, i)}\n              className={cn(\n                \"absolute -ml-3 -mt-3 grid size-6 place-items-center rounded-full border-2 font-mono text-[11px] font-semibold outline-none focus-visible:shadow-[var(--focus-ring)]\",\n                active === i ? \"border-volt-ink bg-volt text-on-volt\" : \"border-volt-ink bg-surface-raised text-ink\",\n              )}\n              style={{ left: `${xp(a.index)}%`, top: `${yp(values[a.index] ?? 0)}%` }}\n            >\n              {i + 1}\n            </motion.button>\n          ))}\n\n          <AnimatePresence>\n            {note && active !== null && (\n              <motion.div\n                key={active}\n                id={`${uid}-note`}\n                role=\"note\"\n                initial={{ opacity: 0, y: 6, filter: \"blur(6px)\" }}\n                animate={{ opacity: 1, y: 0, filter: \"blur(0px)\" }}\n                exit={{ opacity: 0, filter: \"blur(6px)\", transition: { duration: 0.12 } }}\n                transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 380, damping: 30 }}\n                className={cn(\"pointer-events-none absolute bottom-2 z-10 w-56 rounded-sm border border-border bg-surface-raised p-2.5 shadow-md\", xp(note.index) > 50 ? \"-translate-x-[calc(100%+16px)]\" : \"translate-x-4\")}\n                style={{ left: `${xp(note.index)}%` }}\n              >\n                <p className=\"font-mono text-[10.5px] uppercase tracking-wide text-ink-subtle\">\n                  {labels[note.index]} · {values[note.index]} {unit}\n                </p>\n                <p className=\"mt-0.5 text-[13px] font-semibold text-ink\">{note.title}</p>\n                <p className=\"mt-0.5 text-[12px] leading-[17px] text-ink-muted\">{note.body}</p>\n              </motion.div>\n            )}\n          </AnimatePresence>\n        </div>\n        <div />\n        <div aria-hidden className=\"relative mt-2 h-4\">\n          {labels.map((l, i) => (\n            <span key={l + i} className={cn(\"absolute -translate-x-1/2 font-mono text-[10.5px] text-ink-subtle\", i % 2 === 1 && \"hidden @md:block\")} style={{ left: `${xp(i + 0.5)}%` }}>\n              {l}\n            </span>\n          ))}\n        </div>\n      </div>\n\n      <ol className=\"mt-4 grid gap-1 @md:grid-cols-2\">\n        {annotations.map((a, i) => (\n          <li key={a.index} onPointerEnter={() => setActive(i)} onPointerLeave={() => setActive(null)} className={cn(\"flex items-start gap-2 rounded-sm px-2 py-1.5 transition-colors\", active === i ? \"bg-surface-hover\" : \"\")}>\n            <span aria-hidden className={cn(\"mt-px grid size-5 shrink-0 place-items-center rounded-full font-mono text-[10.5px] font-semibold transition-colors\", active === i ? \"bg-volt text-on-volt\" : \"bg-surface text-ink-muted\")}>\n              {i + 1}\n            </span>\n            <span className=\"min-w-0 text-[12.5px] leading-[18px]\">\n              <span className=\"font-medium text-ink\">{a.title}</span>\n              <span className=\"text-ink-subtle\"> · {labels[a.index]}</span>\n            </span>\n          </li>\n        ))}\n      </ol>\n    </figure>\n  );\n}\n"},{"path":"LICENSE-geturui.md","type":"registry:file","target":"LICENSE-geturui.md","content":"MIT License\n\nCopyright (c) 2026 geturui.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"}],"categories":["examples","chart","line chart","time series","comparison","annotations","tooltip","crosshair","svg"],"meta":{"tier":"free","license":"MIT","docs":"https://geturui.com/docs/line-charts"}}