{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dot-plot-with-intervals",
  "type": "registry:component",
  "title": "Dot plot with intervals",
  "description": "Estimates with how sure they are. Sample data: on-time delivery of six carriers with confidence intervals, against a 95% SLA.",
  "registryDependencies": [
    "@chartory/core",
    "@chartory/plot-ci-dots"
  ],
  "files": [
    {
      "path": "registry/chartory/components/dot-plot-with-intervals.tsx",
      "type": "registry:component",
      "target": "components/chartory/dot-plot-with-intervals.tsx",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// Dot plot with intervals (Chartory chart 050): 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/dot-plot-with-intervals\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/050-dot-plot-with-intervals/data\"\nimport { def } from \"@/lib/chartory/charts/types/050-dot-plot-with-intervals/layout\"\n\nregisterChart(def, sample)\n\nexport type DotPlotWithIntervalsData = typeof sample\nexport type DotPlotWithIntervalsProps = Omit<ChartViewProps, \"def\" | \"data\" | \"states\"> & {\n  /** the data to draw (default: the sample) */\n  data?: DotPlotWithIntervalsData\n  /** further data states: the chart morphs to them (update) or ticks through them (live, with interval) */\n  states?: DotPlotWithIntervalsData[]\n}\n\nexport function DotPlotWithIntervals(props: DotPlotWithIntervalsProps) {\n  return <ChartView def={def} {...props} />\n}\n"
    },
    {
      "path": "registry/chartory/charts/types/050-dot-plot-with-intervals/data.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/050-dot-plot-with-intervals/data.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 050 Dot plot with intervals · sample data (Figma chart/050, logistics: on-time rate by carrier, 95 % confidence, SLA 95 %).\nimport type { CiDotsData } from \"../../plots/ci-dots\";\n\nexport const data: CiDotsData = {\n  min: 85,\n  max: 100,\n  target: 95,\n  ticks: [[85, \"85%\"], [90, \"90%\"], [95, \"SLA 95%\"], [100, \"100%\"]],\n  rows: [\n    { label: \"Nordline\", v: 97.2, lo: 96.4, hi: 98.0 },\n    { label: \"Rapida\", v: 96.4, lo: 95.7, hi: 97.1 },\n    { label: \"Parcelo\", v: 95.8, lo: 94.1, hi: 97.5 },\n    { label: \"Swift EU\", v: 94.1, lo: 92.8, hi: 95.4 },\n    { label: \"Cargo One\", v: 92.6, lo: 90.2, hi: 95.0 },\n    { label: \"Lumen Post\", v: 89.8, lo: 86.5, hi: 93.1 },\n  ],\n};\n"
    },
    {
      "path": "registry/chartory/charts/types/050-dot-plot-with-intervals/layout.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/050-dot-plot-with-intervals/layout.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 050 Dot plot with intervals (Figma chart/050): C.ciDots on the carrier on-time sample.\nimport type { ChartDef, TooltipSpec } from \"../../core/shell\";\nimport { ciDots } from \"../../plots/ci-dots\";\nimport { data } from \"./data\";\n\nconst above = data.rows.filter((r) => r.lo >= data.target), below = data.rows.filter((r) => r.hi < data.target);\n\n/** Tooltip for one carrier (group = its interval, caps and estimate): the 95% interval around its on-time rate. */\nfunction tipOf(o: typeof data, g: number): TooltipSpec | null {\n  const r = o.rows[g];\n  if (!r) return null;\n  const t = r.lo >= o.target ? \"status/success\" : r.hi < o.target ? \"status/danger\" : \"status/warning\";\n  const st = t === \"status/success\" ? \"ABOVE SLA\" : t === \"status/danger\" ? \"BELOW SLA\" : \"UNCERTAIN\";\n  return { kind: \"range\", caps: `${r.label.toUpperCase()} · ${st}`, rows: [{ label: \"High (95%)\", value: r.hi + \"%\", swatch: t }, { label: \"On-time\", value: r.v + \"%\", swatch: t }, { label: \"Low (95%)\", value: r.lo + \"%\", swatch: t }] };\n}\n\nexport const def: ChartDef = {\n  no: 50,\n  slug: \"dot-plot-with-intervals\",\n  legend: [[\"status/success\", \"Above SLA\"], [\"status/warning\", \"Uncertain\"], [\"status/danger\", \"Below SLA\"]],\n  // update: the next 30 days; each carrier's on-time rate moves up to ±1 point and its interval half-width ±20 %\n  // (one decimal, inside the axis); colours follow where the new interval sits against the SLA\n  update: (d, step) => {\n    const o = d as typeof data;\n    const r1 = (v: number) => Math.round(v * 10) / 10;\n    return {\n      ...o,\n      rows: o.rows.map((r, i) => {\n        const half = ((r.hi - r.lo) / 2) * (1 + 0.2 * Math.sin(step * 2.3 + i * 1.1));\n        const v = r1(Math.max(o.min + half + 0.2, Math.min(o.max - half - 0.2, r.v + Math.sin(step * 1.7 + i * 1.4))));\n        return { ...r, v, lo: r1(v - half), hi: r1(v + half) };\n      }),\n    };\n  },\n  plot: (K, p, w, d) => ciDots(K, p, w, (d as typeof data | undefined) ?? data),\n  tip: (d, g) => tipOf(d as typeof data, g),\n  describe: {\n    title: \"On-time rate by carrier\",\n    summary: `On-time delivery over 30 days with 95% confidence intervals against the ${data.target}% SLA: ${above.length} of ${data.rows.length} carriers are above it (${above.map((r) => r.label).join(\", \")}), ${below.length} below (${below.map((r) => `${r.label} ${r.v}%`).join(\", \")}), the rest uncertain.`,\n    table: { head: [\"Carrier\", \"On-time\", \"Low (95%)\", \"High (95%)\"], rows: data.rows.map((r) => [r.label, r.v + \"%\", r.lo + \"%\", r.hi + \"%\"]) },\n  },\n};\n"
    }
  ],
  "categories": [
    "charts",
    "distribution"
  ],
  "meta": {
    "access": "free",
    "no": 50,
    "family": "Distribution"
  }
}
