{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "line-chart",
  "title": "Line chart",
  "description": "Series across days or months, smooth, straight or in steps, with gaps, bridges and a dashed forecast. The day under the pointer stays bright in a window that glides with the axis, while the rest of each line steps back, and a new range or new values move every point from where it is.",
  "dependencies": [],
  "registryDependencies": [
    "https://kinoui.com/r/chart-line-marks.json",
    "https://kinoui.com/r/chart.json",
    "https://kinoui.com/r/chart-core.json",
    "https://kinoui.com/r/chart-line.json",
    "https://kinoui.com/r/chart-math.json",
    "https://kinoui.com/r/line-path.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/line-chart.tsx",
      "content": "'use client'\n\nimport { figureProps, seriesWords, useDeclared } from '@/registry/lib/chart-base'\nimport {\n  type CartesianChartProps,\n  cartesianChartKeys,\n  cartesianSignature,\n  cartesianWords,\n  type ChartPartDeclaration,\n  type LiveChartProps,\n  useCartesianChart,\n} from '@/registry/lib/chart-cartesian'\nimport {\n  framePoints,\n  frameRest,\n  frameTop,\n  LineFamilyFrame,\n  LinePlaceholder,\n  LineSeries,\n  type LineSeriesProps,\n} from '@/registry/lib/chart-line'\nimport { lineMarks } from '@/registry/lib/chart-line-marks'\nimport { plotPoint } from '@/registry/lib/chart-math'\nimport type { LineCurve, LinePoint } from '@/registry/lib/line-path'\n\n/*\n * The Line chart: one or more series across categories that run in order,\n * such as days. Its lines, their moves and the window that keeps the lit\n * category bright come from the chart line lib, which the Area chart shares.\n * When the data changes, points that stay glide to their new place, points\n * that arrive grow out of the old line and points that leave fold into the\n * new one, so a new range reads as the same line stretching rather than a\n * new one.\n */\n\ninterface LineChartProps extends CartesianChartProps, LiveChartProps {\n  /**\n   * How the lines arrive the first time the chart comes into view: rising\n   * from zero, drawn along from the reading start, or simply there, the\n   * default, since a page that loads doesn't animate into place.\n   */\n  entrance?: 'rise' | 'draw' | 'none'\n  /** Keeps zero on the value axis, so a line's rise and fall read in proportion; off fits the axis to the data. */\n  zero?: boolean\n}\n\nconst lineChartKeys = [...cartesianChartKeys, 'entrance', 'zero']\n\n/** Every series at a stop, read along x. */\nconst X_BROWSE = { kind: 'x' } as const\n\n/** The legend's keys are plain swatches. */\nfunction noMarker() {\n  return null\n}\n\n/**\n * The chart's root: it lays out the frame its parts draw in, places each\n * category along the plot from edge to edge, and fits the value axis to the\n * lines.\n */\nfunction LineChart(props: LineChartProps) {\n  const {\n    entrance = 'none',\n    zero = true,\n    description,\n    empty,\n    className,\n    children,\n    ref,\n  } = props\n  const made = useCartesianChart(props, {\n    kinds: [lineMarks],\n    orientation: 'vertical',\n    stack: 'none',\n    entrance: entrance !== 'none',\n    y: { zero },\n  })\n  const { model, placeholder, phase } = made\n  // A line has no fill to pattern, so its key in the legend and the tooltip stays solid too.\n  const chart = { ...made.chart, patternOf: () => 'solid' as const }\n  const cartesian = { ...made, chart }\n  return (\n    <LineFamilyFrame\n      chart={cartesian}\n      markerOf={noMarker}\n      // The tooltip sits over the highest of the stop's points.\n      anchor={(stop) => {\n        const along = chart.entered ? model.reach(stop.index) : null\n        return plotPoint(\n          stop.band,\n          along ?? model.baselines.value,\n          'vertical',\n          chart.direction,\n        )\n      }}\n      words={seriesWords(chart, cartesianWords(chart, null))}\n      browse={X_BROWSE}\n      family={{\n        name: 'line-chart',\n        phase,\n        entrance,\n        // Hidden, or waiting to rise, a line lies flat along its baseline.\n        pointsOf: (key, rising) =>\n          framePoints(chart, model, key, rising || chart.hidden.includes(key), false),\n        topOf: (key, stop) => frameTop(model, key, stop),\n        restOf: (key) => frameRest(model, key),\n      }}\n      description={description}\n      empty={empty}\n      placeholder={placeholder && <LinePlaceholder name='line-chart' fill={false} />}\n      className={className}\n      ref={ref}\n      {...figureProps(props, lineChartKeys)}\n    >\n      {children}\n    </LineFamilyFrame>\n  )\n}\n\ntype LineProps = LineSeriesProps\n\n/**\n * One series' line, in the series' colour: a layer of the plot holding the\n * line, a dashed bridge over each missing value, and a dot on each point.\n * When a category is lit, the line steps back, leaving it bright around the\n * category, a window that glides with the axis's pill.\n */\nfunction Line(props: LineProps) {\n  useDeclared('Line', Line.declare(props), cartesianSignature)\n  return <LineSeries {...props} />\n}\n\n// A line is its series, drawn as one; the tooltip, the slider and the table say which values\n// are projected.\nLine.declare = ({ dataKey, data, forecastFrom }: LineProps): ChartPartDeclaration => ({\n  series: { key: dataKey, mark: 'line' },\n  ...(data === undefined ? {} : { rows: data }),\n  ...(forecastFrom === undefined\n    ? {}\n    : { forecast: { series: dataKey, from: forecastFrom } }),\n})\n\nexport {\n  Line,\n  LineChart,\n  type LineChartProps,\n  type LineCurve,\n  type LinePoint,\n  type LineProps,\n}\n",
      "type": "registry:component",
      "target": "@components/kino/line-chart.tsx"
    }
  ],
  "type": "registry:component"
}