{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ridgeline",
  "type": "registry:component",
  "title": "Ridgeline",
  "description": "The shape of each group's spread, stacked. Sample data: response length of five models, Atlas 3 to Nova, from 0 to 2K tokens.",
  "registryDependencies": [
    "@chartory/core",
    "@chartory/plot-ridgeline"
  ],
  "files": [
    {
      "path": "registry/chartory/components/ridgeline.tsx",
      "type": "registry:component",
      "target": "components/chartory/ridgeline.tsx",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// Ridgeline (Chartory chart 055): sizes xs | s | m | l, laid out again from the data at each\n// size; collection \"hearth\" (default) or \"signal\" (with @chartory/signal, Code and Complete). Data in the type's shape (default: the sample). Docs:\n// https://usechartory.com/docs/charts/ridgeline\nimport { ChartView, type ChartViewProps } from \"@/lib/chartory/charts/chart-view\"\nimport { registerChart } from \"@/lib/chartory/charts/defs\"\nimport { data as sample } from \"@/lib/chartory/charts/types/055-ridgeline/data\"\nimport { def } from \"@/lib/chartory/charts/types/055-ridgeline/layout\"\n\nregisterChart(def, sample)\n\nexport type RidgelineData = typeof sample\nexport type RidgelineProps = Omit<ChartViewProps, \"def\" | \"data\" | \"states\"> & {\n  /** the data to draw (default: the sample) */\n  data?: RidgelineData\n  /** further data states: the chart morphs to them (update) or ticks through them (live, with interval) */\n  states?: RidgelineData[]\n}\n\nexport function Ridgeline(props: RidgelineProps) {\n  return <ChartView def={def} {...props} />\n}\n"
    },
    {
      "path": "registry/chartory/charts/types/055-ridgeline/data.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/055-ridgeline/data.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 055 Response length by model · sample data (Figma chart/055, from the Figma definition, seeded values expanded).\nimport type { RidgelineData } from \"../../plots/ridgeline\";\n\nexport const data: RidgelineData = {\n  max: 2000,\n  xt: [\n    [0, \"0\"],\n    [500, \"500\"],\n    [1000, \"1K\"],\n    [1500, \"1.5K\"],\n    [2000, \"2K TOKENS\"]\n  ],\n  rows: [\n    {\n      label: \"ATLAS 3\",\n      tok: \"data/primary\",\n      peaks: [\n        [540, 180, 1],\n        [1250, 220, 0.35]\n      ]\n    },\n    {\n      label: \"KITE 2\",\n      tok: \"data/cat-2\",\n      peaks: [\n        [380, 140, 1]\n      ]\n    },\n    {\n      label: \"ORION\",\n      tok: \"data/cat-3\",\n      peaks: [\n        [900, 300, 1],\n        [1600, 200, 0.4]\n      ]\n    },\n    {\n      label: \"VEGA\",\n      tok: \"data/cat-4\",\n      peaks: [\n        [260, 90, 1],\n        [700, 160, 0.25]\n      ]\n    },\n    {\n      label: \"NOVA\",\n      tok: \"data/cat-5\",\n      peaks: [\n        [620, 240, 1]\n      ]\n    }\n  ]\n};\n"
    },
    {
      "path": "registry/chartory/charts/types/055-ridgeline/layout.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/055-ridgeline/layout.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 055 Ridgeline (Figma chart/055, \"Response length by model\"): C.ridgeline, one density per model, 0–2K tokens.\nimport type { ChartDef, TooltipSpec } from \"../../core/shell\";\nimport { ridgeline } from \"../../plots/ridgeline\";\nimport { data } from \"./data\";\n\n// tooltip: one model's density (group = row): main peak, its spread and the second peak when there is one\nconst tip = (o: typeof data, g: number): TooltipSpec | null => {\n  const r = o.rows[g];\n  if (!r || !r.peaks.length) return null;\n  const tk = (v: number) => v.toLocaleString(\"en-US\") + \" tokens\";\n  const [m, s] = r.peaks[0];\n  return {\n    kind: \"range\",\n    caps: r.label.toUpperCase() + \" · RESPONSE LENGTH\",\n    rows: [\n      { label: \"Peak\", value: tk(m), swatch: r.tok },\n      { label: \"Spread\", value: \"±\" + tk(s), swatch: r.tok },\n      ...r.peaks.slice(1, 2).map(([m2]) => ({ label: \"Second peak\", value: tk(m2), swatch: r.tok })),\n    ],\n  };\n};\n\nexport const def: ChartDef = {\n  no: 55,\n  slug: \"ridgeline\",\n  legend: null,\n  plot: (K, p, w, d) => ridgeline(K, p, w, (d as typeof data | undefined) ?? data),\n  tip: (d, g) => tip(d as typeof data, g),\n  // the next release: each peak moves up to ±6 % in length and ±10 % in spread\n  update: (d, step) => {\n    const o = d as typeof data;\n    return {\n      ...o,\n      rows: o.rows.map((r, k) => ({ ...r, peaks: r.peaks.map(([m, s, wt], j) => [Math.round(m * (1 + 0.06 * Math.sin(k * 1.4 + j * 2.2 + step * 2.1))), Math.round(s * (1 + 0.1 * Math.sin(k * 0.8 + j * 1.3 + step * 1.7))), wt] as [number, number, number]) })),\n    };\n  },\n  describe: {\n    title: \"Response length by model\",\n    summary: `Distribution of response length in tokens for ${data.rows.length} models: ${data.rows.map((r) => `${r.label} peaks near ${r.peaks[0][0]}`).join(\", \")}; ATLAS 3, ORION and VEGA have a second, smaller peak.`,\n    table: {\n      head: [\"Model\", \"Peak (tokens)\", \"Spread (tokens)\", \"Weight\"],\n      rows: data.rows.flatMap((r) => r.peaks.map(([m, s, wt]) => [r.label, m, s, wt])),\n    },\n  },\n};\n"
    }
  ],
  "categories": [
    "charts",
    "distribution"
  ],
  "meta": {
    "access": "free",
    "no": 55,
    "family": "Distribution"
  }
}
