{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "lorenz-curve",
  "type": "registry:component",
  "title": "Lorenz curve",
  "description": "How evenly something is shared. Sample data: stake across holders, the top 10% hold 30%.",
  "registryDependencies": [
    "@chartory/core",
    "@chartory/plot-curve-ref"
  ],
  "files": [
    {
      "path": "registry/chartory/components/lorenz-curve.tsx",
      "type": "registry:component",
      "target": "components/chartory/lorenz-curve.tsx",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// Lorenz curve (Chartory chart 077): 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/lorenz-curve\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/077-lorenz-curve/data\"\nimport { def } from \"@/lib/chartory/charts/types/077-lorenz-curve/layout\"\n\nregisterChart(def, sample)\n\nexport type LorenzCurveData = typeof sample\nexport type LorenzCurveProps = Omit<ChartViewProps, \"def\" | \"data\" | \"states\"> & {\n  /** the data to draw (default: the sample) */\n  data?: LorenzCurveData\n  /** further data states: the chart morphs to them (update) or ticks through them (live, with interval) */\n  states?: LorenzCurveData[]\n}\n\nexport function LorenzCurve(props: LorenzCurveProps) {\n  return <ChartView def={def} {...props} />\n}\n"
    },
    {
      "path": "registry/chartory/charts/types/077-lorenz-curve/data.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/077-lorenz-curve/data.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 077 Lorenz curve · sample data (Figma chart/077, crypto: stake concentration across validators, curve t^3.4).\nimport type { CurveRefData } from \"../../plots/curve-ref\";\n\nexport const data: CurveRefData = {\n  mode: \"lorenz\",\n  k: 3.4,\n  mark: { x: 0.9, text: \"TOP 10% HOLD 30%\" },\n  ticks: [\"100%\", \"75%\", \"50%\", \"25%\", \"0\"],\n  xt: [[0, \"0\"], [0.25, \"25%\"], [0.5, \"50%\"], [0.75, \"75%\"], [1, \"100%\"]],\n};\n"
    },
    {
      "path": "registry/chartory/charts/types/077-lorenz-curve/layout.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/077-lorenz-curve/layout.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 077 Lorenz curve (Figma chart/077, \"Stake concentration\"): C.curveRef in lorenz mode against the equal-stake diagonal.\nimport type { ChartDef } from \"../../core/shell\";\nimport { curveRef } from \"../../plots/curve-ref\";\nimport { data } from \"./data\";\n\nconst share = (t: number) => Math.pow(t, data.k);\nconst pct = (v: number) => Math.round(v * 100) + \"%\";\n\n/** A later epoch: stake concentrates a little more each step (k up), the chip recomputed from the curve. */\nfunction update(d0: unknown, step: number): typeof data {\n  const d = d0 as typeof data;\n  const k = +(d.k + 0.22 * step).toFixed(2);\n  return { ...d, k, mark: { ...d.mark, text: `TOP ${pct(1 - d.mark.x)} HOLD ${pct(1 - Math.pow(d.mark.x, k))}` } };\n}\n\nexport const def: ChartDef = {\n  no: 77,\n  slug: \"lorenz-curve\",\n  legend: [[\"status/warning\", \"Stake curve\"], [\"text/action\", \"Equal stake\"]],\n  plot: (K, p, w, d) => curveRef(K, p, w, (d as typeof data | undefined) ?? data),\n  update,\n  describe: {\n    title: \"Stake concentration\",\n    summary: `Cumulative share of stake against the share of holders, smallest first: the bottom 90% hold ${pct(share(0.9))}, so the top 10% hold ${pct(1 - share(0.9))}.`,\n    table: { head: [\"Holders (smallest first)\", \"Stake held\", \"Equal stake\"], rows: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1].map((t) => [pct(t), pct(share(t)), pct(t)]) },\n  },\n};\n"
    }
  ],
  "categories": [
    "charts",
    "distribution"
  ],
  "meta": {
    "access": "free",
    "no": 77,
    "family": "Distribution"
  }
}
