{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "venn",
  "type": "registry:component",
  "title": "Venn",
  "description": "Who uses one, two or all three. Sample data: active accounts using dashboards (2,550, 71%), alerts (1,540, 43%) and the API (1,360, 38%).",
  "registryDependencies": [
    "@chartory/core",
    "@chartory/plot-venn"
  ],
  "files": [
    {
      "path": "registry/chartory/components/venn.tsx",
      "type": "registry:component",
      "target": "components/chartory/venn.tsx",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// Venn (Chartory chart 069): 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/venn\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/069-venn/data\"\nimport { def } from \"@/lib/chartory/charts/types/069-venn/layout\"\n\nregisterChart(def, sample)\n\nexport type VennData = typeof sample\nexport type VennProps = Omit<ChartViewProps, \"def\" | \"data\" | \"states\"> & {\n  /** the data to draw (default: the sample) */\n  data?: VennData\n  /** further data states: the chart morphs to them (update) or ticks through them (live, with interval) */\n  states?: VennData[]\n}\n\nexport function Venn(props: VennProps) {\n  return <ChartView def={def} {...props} />\n}\n"
    },
    {
      "path": "registry/chartory/charts/types/069-venn/data.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/069-venn/data.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 069 Venn · sample data (Figma chart/069, accounts using dashboards, alerts and the API; region counts and set totals).\nimport type { VennData } from \"../../plots/venn\";\n\nexport const data: VennData = {\n  sets: [{ label: \"Dashboards\", tok: \"data/cat-2\" }, { label: \"Alerts\", tok: \"data/primary\" }, { label: \"API\", tok: \"data/cat-3\" }],\n  regions: { a: \"1,240\", b: \"380\", c: \"520\", ab: \"610\", ac: \"290\", bc: \"140\", abc: \"410\" },\n  rows: [\n    { label: \"Dashboards\", tok: \"data/cat-2\", text: \"2,550\", pct: \"71%\" },\n    { label: \"Alerts\", tok: \"data/primary\", text: \"1,540\", pct: \"43%\" },\n    { label: \"API\", tok: \"data/cat-3\", text: \"1,360\", pct: \"38%\" },\n  ],\n};\n"
    },
    {
      "path": "registry/chartory/charts/types/069-venn/layout.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/069-venn/layout.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 069 Venn (Figma chart/069, \"Feature overlap\"): C.venn, accounts by the features they use.\nimport type { ChartDef, TooltipSpec } from \"../../core/shell\";\nimport { venn } from \"../../plots/venn\";\nimport { data } from \"./data\";\n\nconst R = data.regions;\n\nconst num = (s: string) => +s.replace(/,/g, \"\");\nconst fmt = (v: number) => v.toLocaleString(\"en-US\");\n\n// tooltip: one feature's circle (group = set): its accounts by region (only this feature, with each other one, all\n// three), adding up to the set's total\nconst tip = (o: typeof data, g: number): TooltipSpec | null => {\n  const s = o.sets[g], row = o.rows[g];\n  if (!s || !row) return null;\n  const k = \"abc\"[g], [i, j] = [0, 1, 2].filter((x) => x !== g);\n  const pair = (x: number) => ([g, x].sort().map((y) => \"abc\"[y]).join(\"\")) as keyof typeof o.regions;\n  return {\n    kind: \"series\",\n    caps: s.label.toUpperCase() + (row.pct ? \" · \" + row.pct + \" OF ACCOUNTS\" : \"\"),\n    rows: [\n      { label: s.label + \" only\", value: o.regions[k as keyof typeof o.regions], swatch: s.tok },\n      { label: \"With \" + o.sets[i].label, value: o.regions[pair(i)], swatch: o.sets[i].tok },\n      { label: \"With \" + o.sets[j].label, value: o.regions[pair(j)], swatch: o.sets[j].tok },\n      { label: \"All three\", value: o.regions.abc, swatch: \"text/strong\" },\n    ],\n    total: { label: \"Accounts\", value: row.text },\n  };\n};\n\nexport const def: ChartDef = {\n  no: 69,\n  slug: \"venn\",\n  legend: null,\n  plot: (K, p, w, d) => venn(K, p, w, (d as typeof data | undefined) ?? data),\n  tip: (d, g) => tip(d as typeof data, g),\n  // the next month: every region's count moves up to ±8 % (to the nearest 10); set totals and shares are recomputed\n  update: (d, step) => {\n    const o = d as typeof data;\n    const keys = [\"a\", \"b\", \"c\", \"ab\", \"ac\", \"bc\", \"abc\"] as const;\n    const v = Object.fromEntries(keys.map((k, i) => [k, Math.round((num(o.regions[k]) * (1 + 0.08 * Math.sin(i * 1.6 + step * 2.1))) / 10) * 10])) as Record<(typeof keys)[number], number>;\n    const all = keys.reduce((a, k) => a + v[k], 0);\n    const tot = [v.a + v.ab + v.ac + v.abc, v.b + v.ab + v.bc + v.abc, v.c + v.ac + v.bc + v.abc];\n    return {\n      ...o,\n      regions: Object.fromEntries(keys.map((k) => [k, fmt(v[k])])) as typeof o.regions,\n      rows: o.rows.map((r, i) => ({ ...r, text: fmt(tot[i]), pct: Math.round((tot[i] / all) * 100) + \"%\" })),\n    };\n  },\n  describe: {\n    title: \"Feature adoption\",\n    summary: `3,590 accounts by feature: Dashboards 2,550 (71%), Alerts 1,540 (43%), API 1,360 (38%); ${R.abc} use all three.`,\n    table: {\n      head: [\"Features used\", \"Accounts\"],\n      rows: [\n        [\"Dashboards only\", R.a], [\"Alerts only\", R.b], [\"API only\", R.c], [\"Dashboards and Alerts\", R.ab],\n        [\"Dashboards and API\", R.ac], [\"Alerts and API\", R.bc], [\"All three\", R.abc],\n      ],\n    },\n  },\n};\n"
    }
  ],
  "categories": [
    "charts",
    "part-of-a-whole"
  ],
  "meta": {
    "access": "free",
    "no": 69,
    "family": "Part of a whole"
  }
}
