{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "load-plan",
  "type": "registry:component",
  "title": "Load plan",
  "description": "How full each truck is, and with what. Sample data: three trucks, Hamburg 92%, Bremen 88%, Kiel 81% full.",
  "registryDependencies": [
    "@chartory/core",
    "@chartory/plot-load-plan"
  ],
  "files": [
    {
      "path": "registry/chartory/components/load-plan.tsx",
      "type": "registry:component",
      "target": "components/chartory/load-plan.tsx",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// Load plan (Chartory chart 076): 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/load-plan\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/076-load-plan/data\"\nimport { def } from \"@/lib/chartory/charts/types/076-load-plan/layout\"\n\nregisterChart(def, sample)\n\nexport type LoadPlanData = typeof sample\nexport type LoadPlanProps = Omit<ChartViewProps, \"def\" | \"data\" | \"states\"> & {\n  /** the data to draw (default: the sample) */\n  data?: LoadPlanData\n  /** further data states: the chart morphs to them (update) or ticks through them (live, with interval) */\n  states?: LoadPlanData[]\n}\n\nexport function LoadPlan(props: LoadPlanProps) {\n  return <ChartView def={def} {...props} />\n}\n"
    },
    {
      "path": "registry/chartory/charts/types/076-load-plan/data.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/076-load-plan/data.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 076 Load plan · sample data (Figma chart/076, logistics: wave 3 outbound trucks, pallet columns [width, stack]).\nimport type { LoadPlanData } from \"../../plots/load-plan\";\n\nconst A = \"data/cat-2\", Ch = \"data/cat-3\", F = \"data/cat-5\", R = \"data/cat-9\";\n\nexport const data: LoadPlanData = {\n  trucks: [\n    { label: \"T1 · HAMBURG\", pct: 92, cols: [[40, [Ch, Ch]], [40, [Ch, Ch]], [36, [A, A]], [52, [A]], [36, [A, F]], [44, [A, A]], [30, [F]], [36, [A, A]], [26, [R]]] },\n    { label: \"T2 · BREMEN\", pct: 88, cols: [[40, [Ch, Ch]], [44, [A, A]], [52, [A]], [36, [F, F]], [40, [A, A]], [36, [A]], [44, [A, R]], [30, [R]]] },\n    { label: \"T3 · KIEL\", pct: 81, cols: [[40, [Ch, Ch]], [40, [A, A]], [52, [A]], [36, [F, A]], [40, [A, A]], [36, [R]], [30, [A]]] },\n  ],\n};\n"
    },
    {
      "path": "registry/chartory/charts/types/076-load-plan/layout.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/076-load-plan/layout.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 076 Load plan (Figma chart/076): C.loadPlan on three outbound trucks; the legend names the goods.\nimport type { ChartDef, TooltipSpec } from \"../../core/shell\";\nimport { loadPlan } from \"../../plots/load-plan\";\nimport { data } from \"./data\";\n\nconst legend: [string, string][] = [[\"data/cat-2\", \"Ambient\"], [\"data/cat-3\", \"Chilled\"], [\"data/cat-5\", \"Fragile\"], [\"data/cat-9\", \"Returns\"]];\nconst count = (cols: [number, string[]][], tok: string) => cols.reduce((a, c) => a + c[1].filter((t) => t === tok).length, 0);\nconst city = (s: string) => s.split(\" · \")[1].charAt(0) + s.split(\" · \")[1].slice(1).toLowerCase();\nconst avg = Math.round(data.trucks.reduce((a, t) => a + t.pct, 0) / data.trucks.length);\n\nconst wob = (i: number, step: number) => Math.sin(i * 2.1 + step * 1.7 + 0.4);\n/** A later wave: pallet footprints shift a few cm, the load factor follows the floor used (same side of 85 %). */\nfunction update(d0: unknown, step: number): typeof data {\n  const d = d0 as typeof data;\n  let k = 0;\n  return {\n    trucks: d.trucks.map((t) => {\n      const cols = t.cols.map(([bw, st]): [number, string[]] => [Math.max(20, bw + Math.round(5 * wob(k++, step))), [...st]]);\n      const r = cols.reduce((a, c) => a + c[0], 0) / t.cols.reduce((a, c) => a + c[0], 0);\n      const raw = Math.round(t.pct * r + 3 * wob(k, step));\n      return { ...t, cols, pct: t.pct >= 85 ? Math.min(99, Math.max(86, raw)) : Math.min(84, Math.max(70, raw)) };\n    }),\n  };\n}\n\n/** Hover: one truck (its pallets and load factor): pallets per kind of goods, the truck's pallet total. */\nfunction tip(d0: unknown, g: number): TooltipSpec | null {\n  const t = (d0 as typeof data).trucks[g];\n  if (!t) return null;\n  const rows = legend.map(([tok, label]) => ({ label, value: String(count(t.cols, tok)), swatch: tok })).filter((r) => r.value !== \"0\");\n  return { kind: \"series\", caps: `${t.label} · ${t.pct}% LOADED`, rows, total: { label: \"Pallets\", value: String(rows.reduce((a, r) => a + +r.value, 0)) } };\n}\n\nexport const def: ChartDef = {\n  no: 76,\n  slug: \"load-plan\",\n  legend,\n  plot: (K, p, w, d) => loadPlan(K, p, w, (d as typeof data | undefined) ?? data),\n  tip,\n  update,\n  describe: {\n    title: \"Outbound loads\",\n    summary: `${data.trucks.length} trucks loaded at ${data.trucks.map((t) => t.pct + \"%\").join(\", \")} (average ${avg}%).`,\n    table: {\n      head: [\"Truck\", \"Destination\", \"Load\", ...legend.map((l) => l[1] + \" pallets\")],\n      rows: data.trucks.map((t) => [t.label.split(\" · \")[0], city(t.label), t.pct + \"%\", ...legend.map((l) => count(t.cols, l[0]))]),\n    },\n  },\n};\n"
    }
  ],
  "categories": [
    "charts",
    "space-and-place"
  ],
  "meta": {
    "access": "free",
    "no": 76,
    "family": "Space and place"
  }
}
