{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ternary",
  "type": "registry:component",
  "title": "Ternary",
  "description": "Items placed by three measures that trade off. Sample data: five models placed by quality, speed and low cost.",
  "registryDependencies": [
    "@chartory/core",
    "@chartory/plot-ternary"
  ],
  "files": [
    {
      "path": "registry/chartory/components/ternary.tsx",
      "type": "registry:component",
      "target": "components/chartory/ternary.tsx",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// Ternary (Chartory chart 095): 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/ternary\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/095-ternary/data\"\nimport { def } from \"@/lib/chartory/charts/types/095-ternary/layout\"\n\nregisterChart(def, sample)\n\nexport type TernaryData = typeof sample\nexport type TernaryProps = Omit<ChartViewProps, \"def\" | \"data\" | \"states\"> & {\n  /** the data to draw (default: the sample) */\n  data?: TernaryData\n  /** further data states: the chart morphs to them (update) or ticks through them (live, with interval) */\n  states?: TernaryData[]\n}\n\nexport function Ternary(props: TernaryProps) {\n  return <ChartView def={def} {...props} />\n}\n"
    },
    {
      "path": "registry/chartory/charts/types/095-ternary/data.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/095-ternary/data.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 095 Ternary · sample data (Figma chart/095, AI: production models placed by their quality / speed / low-cost mix).\nimport type { TernaryData } from \"../../plots/ternary\";\n\nexport const data: TernaryData = {\n  corners: [\"QUALITY\", \"SPEED\", \"LOW COST\"],\n  pts: [\n    { label: \"Atlas 3\", a: 0.5, b: 0.2, c: 0.3, r: 9, tok: \"data/primary\" },\n    { label: \"Kite 2 Pro\", a: 0.3, b: 0.42, c: 0.28, r: 7, tok: \"data/cat-2\" },\n    { label: \"Orion XL\", a: 0.72, b: 0.1, c: 0.18, r: 6, tok: \"data/cat-3\" },\n    { label: \"Vega 1.5\", a: 0.14, b: 0.5, c: 0.36, r: 8, tok: \"data/cat-4\" },\n    { label: \"Nova\", a: 0.22, b: 0.22, c: 0.56, r: 5, tok: \"data/cat-5\" },\n  ],\n};\n"
    },
    {
      "path": "registry/chartory/charts/types/095-ternary/layout.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/095-ternary/layout.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 095 Ternary (Figma chart/095): C.ternary; no legend (every model is named beside its dot).\nimport type { ChartDef, TooltipSpec } from \"../../core/shell\";\nimport { ternary } from \"../../plots/ternary\";\nimport { data } from \"./data\";\n\nconst pct = (v: number) => Math.round(v * 100) + \"%\";\n\n/** After a release cycle: each model's mix shifts by a few points (shares still sum to 1). */\nfunction update(d0: unknown, step: number): typeof data {\n  const d = d0 as typeof data;\n  return {\n    ...d,\n    pts: d.pts.map((q, i) => {\n      const a = +Math.max(0.04, q.a + 0.05 * Math.sin(i * 2.1 + step * 1.7)).toFixed(2);\n      const b = +Math.max(0.04, q.b + 0.05 * Math.sin(i * 1.3 + step * 2.3 + 1)).toFixed(2);\n      return { ...q, a, b, c: +(1 - a - b).toFixed(2) };\n    }),\n  };\n}\n\n/** Hover: one model (dot and name): its quality / speed / low-cost mix. */\nfunction tip(d0: unknown, g: number): TooltipSpec | null {\n  const q = (d0 as typeof data).pts[g];\n  return q ? { kind: \"value\", text: `${q.label} · quality ${pct(q.a)} · speed ${pct(q.b)} · cost ${pct(q.c)}` } : null;\n}\n\nexport const def: ChartDef = {\n  no: 95,\n  slug: \"ternary\",\n  legend: null,\n  plot: (K, p, w, d) => ternary(K, p, w, (d as typeof data | undefined) ?? data),\n  tip,\n  update,\n  describe: {\n    title: \"Model trade space\",\n    summary: `${data.pts.length} production models by their mix of quality, speed and low cost: ${data.pts.map((q) => `${q.label} ${pct(q.a)} / ${pct(q.b)} / ${pct(q.c)}`).join(\", \")}.`,\n    table: { head: [\"Model\", \"Quality\", \"Speed\", \"Low cost\"], rows: data.pts.map((q) => [q.label, pct(q.a), pct(q.b), pct(q.c)]) },\n  },\n};\n"
    }
  ],
  "categories": [
    "charts",
    "relationship"
  ],
  "meta": {
    "access": "free",
    "no": 95,
    "family": "Relationship"
  }
}
