{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "bump",
  "type": "registry:component",
  "title": "Bump",
  "description": "Who leads, week by week. Sample data: weekly trading-volume rank of five tokens, weeks 33 to 40.",
  "registryDependencies": [
    "@chartory/core",
    "@chartory/plot-bump"
  ],
  "files": [
    {
      "path": "registry/chartory/components/bump.tsx",
      "type": "registry:component",
      "target": "components/chartory/bump.tsx",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// Bump (Chartory chart 045): 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/bump\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/045-bump/data\"\nimport { def } from \"@/lib/chartory/charts/types/045-bump/layout\"\n\nregisterChart(def, sample)\n\nexport type BumpData = typeof sample\nexport type BumpProps = Omit<ChartViewProps, \"def\" | \"data\" | \"states\"> & {\n  /** the data to draw (default: the sample) */\n  data?: BumpData\n  /** further data states: the chart morphs to them (update) or ticks through them (live, with interval) */\n  states?: BumpData[]\n}\n\nexport function Bump(props: BumpProps) {\n  return <ChartView def={def} {...props} />\n}\n"
    },
    {
      "path": "registry/chartory/charts/types/045-bump/data.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/045-bump/data.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 045 Bump · sample data (Figma chart/045-bump-volume-rank, crypto: weekly trading-volume rank, Solana in focus).\nimport type { BumpData } from \"../../plots/bump\";\n\nexport const data: BumpData = {\n  focus: \"Solana\",\n  cols: [\"W33\", \"W34\", \"W35\", \"W36\", \"W37\", \"W38\", \"W39\", \"W40\"],\n  rows: [\n    {  label: \"Ethereum\", tok: \"data/cat-2\", ranks: [1, 1, 2, 1, 1, 1, 2, 1]  },\n    {  label: \"Solana\", tok: \"data/primary\", ranks: [2, 2, 1, 2, 3, 2, 1, 2]  },\n    {  label: \"XRP\", tok: \"data/cat-3\", ranks: [3, 4, 3, 3, 2, 3, 3, 4]  },\n    {  label: \"Toncoin\", tok: \"data/cat-4\", ranks: [4, 5, 5, 4, 5, 4, 4, 5]  },\n    {  label: \"Dogecoin\", tok: \"data/cat-5\", ranks: [5, 3, 4, 5, 4, 5, 5, 3]  },\n  ],\n};\n"
    },
    {
      "path": "registry/chartory/charts/types/045-bump/layout.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/045-bump/layout.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 045 Bump (Figma chart/045-bump-volume-rank): C.bump; no legend (names at the line ends).\nimport type { ChartDef, TooltipSpec } from \"../../core/shell\";\nimport { bump } from \"../../plots/bump\";\nimport { data } from \"./data\";\n\nconst top = data.rows.map((r) => [r.label, r.ranks.filter((x) => x === 1).length] as const).sort((a, b) => b[1] - a[1])[0];\nconst focus = data.rows.find((r) => r.label === data.focus)!;\n\n/** Tooltip for one asset (group = its line, dots and name): its rank in the last week against the first. */\nfunction tipOf(o: typeof data, g: number): TooltipSpec | null {\n  const r = o.rows[g];\n  if (!r) return null;\n  const a = r.ranks[0], b = r.ranks[r.ranks.length - 1], d = a - b;\n  return {\n    kind: \"compare\", caps: `${r.label.toUpperCase()} · ${o.cols[o.cols.length - 1]}`, value: \"#\" + b,\n    delta: { text: d > 0 ? `Up ${d}` : d < 0 ? `Down ${-d}` : \"Level\", tone: d > 0 ? \"success\" : d < 0 ? \"danger\" : \"neutral\" }, comparison: `VS ${o.cols[0]} #${a}`,\n  };\n}\n\nexport const def: ChartDef = {\n  no: 45,\n  slug: \"bump\",\n  legend: null,\n  // update: revised weekly volumes; in some weeks two neighbouring ranks trade places (deterministic per step), so\n  // every week is still a permutation of 1…n\n  update: (d, step) => {\n    const o = d as typeof data;\n    const n = o.rows.length;\n    const ranks = o.rows.map((r) => [...r.ranks]);\n    o.cols.forEach((_, c) => {\n      if ((c + step) % 3 === 0) return;\n      const a = 1 + ((c * 2 + step) % (n - 1));\n      const i = ranks.findIndex((r) => r[c] === a), j = ranks.findIndex((r) => r[c] === a + 1);\n      ranks[i][c] = a + 1; ranks[j][c] = a;\n    });\n    return { ...o, rows: o.rows.map((r, i) => ({ ...r, ranks: ranks[i] })) };\n  },\n  plot: (K, p, w, d) => bump(K, p, w, (d as typeof data | undefined) ?? data),\n  tip: (d, g) => tipOf(d as typeof data, g),\n  describe: {\n    title: \"Weekly trading volume rank\",\n    summary: `Rank by weekly volume, ${data.cols[0]} to ${data.cols[data.cols.length - 1]}: ${top[0]} ranked first in ${top[1]} of ${data.cols.length} weeks; ${focus.label} ends at #${focus.ranks[focus.ranks.length - 1]}.`,\n    table: { head: [\"Asset\", ...data.cols], rows: data.rows.map((r) => [r.label, ...r.ranks.map((x) => \"#\" + x)]) },\n  },\n};\n"
    }
  ],
  "categories": [
    "charts",
    "compare-items"
  ],
  "meta": {
    "access": "free",
    "no": 45,
    "family": "Compare items"
  }
}
