{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "bar-and-line-combo",
  "type": "registry:component",
  "title": "Bar and line combo",
  "description": "An amount and a rate on one card. Sample data: new MRR by month, January to October, with monthly churn.",
  "registryDependencies": [
    "@chartory/core",
    "@chartory/plot-combo"
  ],
  "files": [
    {
      "path": "registry/chartory/components/bar-and-line-combo.tsx",
      "type": "registry:component",
      "target": "components/chartory/bar-and-line-combo.tsx",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// Bar and line combo (Chartory chart 046): 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/bar-and-line-combo\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/046-bar-and-line-combo/data\"\nimport { def } from \"@/lib/chartory/charts/types/046-bar-and-line-combo/layout\"\n\nregisterChart(def, sample)\n\nexport type BarAndLineComboData = typeof sample\nexport type BarAndLineComboProps = Omit<ChartViewProps, \"def\" | \"data\" | \"states\"> & {\n  /** the data to draw (default: the sample) */\n  data?: BarAndLineComboData\n  /** further data states: the chart morphs to them (update) or ticks through them (live, with interval) */\n  states?: BarAndLineComboData[]\n}\n\nexport function BarAndLineCombo(props: BarAndLineComboProps) {\n  return <ChartView def={def} {...props} />\n}\n"
    },
    {
      "path": "registry/chartory/charts/types/046-bar-and-line-combo/data.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/046-bar-and-line-combo/data.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 046 Bar and line combo · sample data (Figma chart/046, SaaS: new MRR in $K and monthly churn rate in %, 2026).\nimport type { ComboData } from \"../../plots/combo\";\n\nexport const data: ComboData = {\n  cats: [\"JAN\", \"FEB\", \"MAR\", \"APR\", \"MAY\", \"JUN\", \"JUL\", \"AUG\", \"SEP\", \"OCT\"],\n  xl: [0, 3, 6, 9],\n  bars: { tok: \"data/primary\", max: 60, ticks: [\"60K\", \"40K\", \"20K\", \"0\"], vals: [28, 31, 30, 35, 38, 36, 41, 44, 42, 47] },\n  line: { tok: \"data/cat-2\", max: 3, ticks: [\"3%\", \"2%\", \"1%\", \"0\"], vals: [2.4, 2.2, 2.3, 2.0, 1.9, 1.8, 1.7, 1.6, 1.7, 1.5] },\n};\n"
    },
    {
      "path": "registry/chartory/charts/types/046-bar-and-line-combo/layout.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/046-bar-and-line-combo/layout.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 046 Bar and line combo (Figma chart/046): C.combo on the new MRR and churn sample.\nimport type { ChartDef, TooltipSpec } from \"../../core/shell\";\nimport { combo } from \"../../plots/combo\";\nimport { data } from \"./data\";\n\nconst month = (s: string) => s.charAt(0) + s.slice(1).toLowerCase();\nconst last = data.cats.length - 1;\n\n/** Tooltip for one month (group = its bar and its churn point): new MRR and churn rate. */\nfunction tipOf(o: typeof data, g: number): TooltipSpec | null {\n  if (g < 0 || g >= o.cats.length) return null;\n  return {\n    kind: \"series\", caps: o.cats[g],\n    rows: [{ label: \"New MRR\", value: \"$\" + o.bars.vals[g] + \"K\", swatch: o.bars.tok }, { label: \"Churn rate\", value: o.line.vals[g] + \"%\", swatch: o.line.tok }],\n  };\n}\n\nexport const def: ChartDef = {\n  no: 46,\n  slug: \"bar-and-line-combo\",\n  legend: [[\"data/primary\", \"New MRR\"], [\"data/cat-2\", \"Churn rate\"]],\n  // update: revised months; new MRR moves ±12 % (whole $K, under the 60K top) and churn ±0.3 points (one decimal,\n  // under 3 %)\n  update: (d, step) => {\n    const o = d as typeof data;\n    return {\n      ...o,\n      bars: { ...o.bars, vals: o.bars.vals.map((v, i) => Math.min(o.bars.max - 2, Math.round(v * (1 + 0.12 * Math.sin(step * 1.9 + i * 0.8))))) },\n      line: { ...o.line, vals: o.line.vals.map((v, i) => Math.max(0.2, Math.min(o.line.max - 0.1, Math.round((v + 0.3 * Math.sin(step * 2.4 + i * 1.1)) * 10) / 10))) },\n    };\n  },\n  plot: (K, p, w, d) => combo(K, p, w, (d as typeof data | undefined) ?? data),\n  tip: (d, g) => tipOf(d as typeof data, g),\n  describe: {\n    title: \"New MRR and churn, 2026\",\n    summary: `New MRR from $${data.bars.vals[0]}K in ${month(data.cats[0])} to $${data.bars.vals[last]}K in ${month(data.cats[last])}; monthly churn from ${data.line.vals[0]}% to ${data.line.vals[last]}%.`,\n    table: { head: [\"Month\", \"New MRR\", \"Churn rate\"], rows: data.cats.map((c, i) => [month(c), \"$\" + data.bars.vals[i] + \"K\", data.line.vals[i] + \"%\"]) },\n  },\n};\n"
    }
  ],
  "categories": [
    "charts",
    "change-over-time"
  ],
  "meta": {
    "access": "free",
    "no": 46,
    "family": "Change over time"
  }
}
