@motionscript/charts 0.1.1-alpha.2 → 0.1.1-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +7 -9
  3. package/dist/bar-chart/bar-chart.d.ts +48 -48
  4. package/dist/bar-chart/bar-chart.js +2 -2
  5. package/dist/bar-chart/bar-chart.js.map +1 -1
  6. package/dist/bar-chart/shared.d.ts +2 -1
  7. package/dist/bar-chart/shared.d.ts.map +1 -1
  8. package/dist/bar-chart/shared.js +2 -0
  9. package/dist/bar-chart/shared.js.map +1 -1
  10. package/dist/browser/chunks/chunk-FJHNBNPQ.js +2 -0
  11. package/dist/browser/chunks/chunk-FJHNBNPQ.js.map +7 -0
  12. package/dist/browser/index.js +1 -1
  13. package/dist/browser/index.js.map +3 -3
  14. package/dist/browser/kit.js +1 -1
  15. package/dist/browser/manifest.json +1 -1
  16. package/dist/kit/style.d.ts +25 -20
  17. package/dist/kit/style.d.ts.map +1 -1
  18. package/dist/kit/style.js +20 -18
  19. package/dist/kit/style.js.map +1 -1
  20. package/dist/line-chart/line-chart.d.ts +48 -48
  21. package/dist/line-chart/line-chart.js +2 -2
  22. package/dist/line-chart/line-chart.js.map +1 -1
  23. package/dist/line-chart/shared.d.ts +2 -1
  24. package/dist/line-chart/shared.d.ts.map +1 -1
  25. package/dist/line-chart/shared.js +2 -0
  26. package/dist/line-chart/shared.js.map +1 -1
  27. package/dist/pie-chart/pie-chart.d.ts +18 -24
  28. package/dist/pie-chart/pie-chart.d.ts.map +1 -1
  29. package/dist/pie-chart/shared.d.ts +7 -9
  30. package/dist/pie-chart/shared.d.ts.map +1 -1
  31. package/dist/pie-chart/shared.js +7 -10
  32. package/dist/pie-chart/shared.js.map +1 -1
  33. package/dist/radar-chart/index.d.ts +1 -1
  34. package/dist/radar-chart/index.d.ts.map +1 -1
  35. package/dist/radar-chart/index.js +1 -1
  36. package/dist/radar-chart/index.js.map +1 -1
  37. package/dist/radar-chart/radar-chart.d.ts +6 -12
  38. package/dist/radar-chart/radar-chart.d.ts.map +1 -1
  39. package/dist/radar-chart/radar-chart.js +1 -2
  40. package/dist/radar-chart/radar-chart.js.map +1 -1
  41. package/dist/radar-chart/shared.d.ts +2 -5
  42. package/dist/radar-chart/shared.d.ts.map +1 -1
  43. package/dist/radar-chart/shared.js +3 -6
  44. package/dist/radar-chart/shared.js.map +1 -1
  45. package/dist/radial-chart/radial-chart.d.ts +12 -18
  46. package/dist/radial-chart/radial-chart.d.ts.map +1 -1
  47. package/dist/radial-chart/shared.d.ts +5 -7
  48. package/dist/radial-chart/shared.d.ts.map +1 -1
  49. package/dist/radial-chart/shared.js +5 -8
  50. package/dist/radial-chart/shared.js.map +1 -1
  51. package/package.json +4 -4
  52. package/src/bar-chart/bar-chart.ts +2 -2
  53. package/src/bar-chart/shared.ts +3 -0
  54. package/src/kit/style.ts +21 -19
  55. package/src/line-chart/line-chart.ts +2 -2
  56. package/src/line-chart/shared.ts +3 -1
  57. package/src/pie-chart/shared.ts +6 -10
  58. package/src/radar-chart/index.ts +1 -1
  59. package/src/radar-chart/radar-chart.ts +0 -2
  60. package/src/radar-chart/shared.ts +3 -7
  61. package/src/radial-chart/shared.ts +4 -8
  62. package/dist/browser/chunks/chunk-7XCRX6GE.js +0 -2
  63. package/dist/browser/chunks/chunk-7XCRX6GE.js.map +0 -7
@@ -1,5 +1,6 @@
1
1
  import { Types } from "@motionscript/sdk";
2
2
  import { niceRange, num } from "../kit/shared.js";
3
+ import { VALUE_TEXT } from "../kit/style.js";
3
4
  /** The "no region" resting value. */
4
5
  export const EMPTY_REGION_BOX = {
5
6
  left: 0,
@@ -320,5 +321,6 @@ export const LINE_MARKS = {
320
321
  export const LINE_LABELS = {
321
322
  /** Read as the chart is built: each point's value printed above or below it, or none. */
322
323
  values: Types.oneOf(["none", "above", "below"], { animatable: false }),
324
+ ...VALUE_TEXT,
323
325
  };
324
326
  //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EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;IACzD,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;IAC1B,2BAA2B;IAC3B,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACnE,sGAAsG;IACtG,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;IACzD,sCAAsC;IACtC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;CAC/D,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,yFAAyF;IACzF,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAU,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;CAChF,CAAA","sourcesContent":["import { Types, type DataRecord, type Vector2 } from \"@motionscript/sdk\"\n\nimport { niceRange, num, type ChartSeries, type Range } from \"../kit/shared\"\nimport type { XScale } from \"./x-scale\"\n\n/** One polyline of a {@link LineChart}: {@link ChartSeries} under the name for what it draws here. */\nexport type LineSeries = ChartSeries\n\n/**\n * A rectangular slice of the plot in data units, the input to `spotlightRegion`\n * and `zoomTo`. Either axis may be omitted: `{ x: [60, 100] }` is a full-height\n * band. A reversed range reads the same as a forward one.\n */\nexport interface PlotRegion {\n /** Omit to span the full plot width. */\n x?: Range\n /** Omit to span the full plot height. */\n y?: Range\n}\n\n/**\n * A {@link PlotRegion} in the plot's centred pixel space (origin at the centre,\n * y-up), the frame the series points live in. An axis the author left unbounded\n * has its edges pinned to the plot's own and draws no rule.\n */\nexport interface RegionBox {\n left: number\n right: number\n bottom: number\n top: number\n xBounded: boolean\n yBounded: boolean\n}\n\n/** The \"no region\" resting value. */\nexport const EMPTY_REGION_BOX: RegionBox = {\n left: 0,\n right: 0,\n bottom: 0,\n top: 0,\n xBounded: false,\n yBounded: false,\n}\n\n/** Whether `box` is non-degenerate, so there is something to spotlight. */\nexport function hasRegion(box: RegionBox): boolean {\n return box.right > box.left && box.top > box.bottom\n}\n\n/**\n * Resolve a {@link PlotRegion} against the plot rectangle (centred pixel space)\n * and the data ranges its edges span. An omitted axis takes the plot's own\n * edges; a given one is clamped to the plot.\n */\nexport function resolveRegionBox(\n region: PlotRegion | null | undefined,\n plot: { left: number; right: number; bottom: number; top: number },\n xScale: Range,\n yScale: Range\n): RegionBox {\n if (!region || (region.x === undefined && region.y === undefined)) {\n return EMPTY_REGION_BOX\n }\n\n const span = (\n range: Range | undefined,\n [min, max]: Range,\n lo: number,\n hi: number\n ): [number, number, boolean] => {\n if (range === undefined || max <= min) return [lo, hi, false]\n const a = Math.min(range[0], range[1])\n const b = Math.max(range[0], range[1])\n const toPx = (v: number) => lo + ((v - min) / (max - min)) * (hi - lo)\n return [\n Math.max(lo, Math.min(hi, toPx(a))),\n Math.max(lo, Math.min(hi, toPx(b))),\n true,\n ]\n }\n\n const [left, right, xBounded] = span(region.x, xScale, plot.left, plot.right)\n const [bottom, top, yBounded] = span(region.y, yScale, plot.bottom, plot.top)\n return { left, right, bottom, top, xBounded, yBounded }\n}\n\n/**\n * The parts of `points` inside `box`, as contiguous sub-polylines: a series is\n * drawn dimmed in full, then these runs are re-drawn at full strength. Segments\n * are clipped, not filtered by endpoint, so a line entering mid-segment is cut\n * exactly on the boundary.\n */\nexport function clipPolylineToBox(\n points: Vector2[],\n box: RegionBox\n): Vector2[][] {\n if (points.length < 2 || !hasRegion(box)) return []\n\n const runs: Vector2[][] = []\n let run: Vector2[] = []\n\n for (let i = 1; i < points.length; i++) {\n const seg = clipSegment(points[i - 1], points[i], box)\n if (!seg) {\n // Misses the box: close the open run.\n if (run.length >= 2) runs.push(run)\n run = []\n continue\n }\n const [a, b] = seg\n // Continues the open run if it starts where the last ended; otherwise the line left and came back.\n if (run.length > 0 && samePoint(run[run.length - 1], a)) run.push(b)\n else {\n if (run.length >= 2) runs.push(run)\n run = [a, b]\n }\n }\n if (run.length >= 2) runs.push(run)\n return runs\n}\n\n/** Points within half a pixel are the same point, for run-joining purposes. */\nfunction samePoint(a: Vector2, b: Vector2): boolean {\n return Math.abs(a.x - b.x) < 0.5 && Math.abs(a.y - b.y) < 0.5\n}\n\n/** Liang-Barsky clip of one segment against `box`: the surviving `[start, end]`, or `null` when wholly outside. */\nfunction clipSegment(\n a: Vector2,\n b: Vector2,\n box: RegionBox\n): [Vector2, Vector2] | null {\n const dx = b.x - a.x\n const dy = b.y - a.y\n let t0 = 0\n let t1 = 1\n\n // Each edge as (p, q): the segment survives where p*t <= q.\n const edges: [number, number][] = [\n [-dx, a.x - box.left],\n [dx, box.right - a.x],\n [-dy, a.y - box.bottom],\n [dy, box.top - a.y],\n ]\n for (const [p, q] of edges) {\n if (p === 0) {\n // Parallel to this edge: outside it, the whole segment is out.\n if (q < 0) return null\n continue\n }\n const r = q / p\n if (p < 0) {\n if (r > t1) return null\n if (r > t0) t0 = r\n } else {\n if (r < t0) return null\n if (r < t1) t1 = r\n }\n }\n return [\n { x: a.x + t0 * dx, y: a.y + t0 * dy },\n { x: a.x + t1 * dx, y: a.y + t1 * dy },\n ]\n}\n\n/**\n * One series' `[x, y]` points, sorted along x so the polyline traces left to\n * right. A row missing its y contributes 0 rather than a gap, since dropping it\n * would silently bridge the hole.\n */\nexport function seriesPoints(\n data: DataRecord[],\n x: XScale,\n series: LineSeries\n): [x: number, y: number][] {\n return data\n .map((row, i): [number, number] => [x.at(i), num(row, series.field)])\n .sort((a, b) => a[0] - b[0])\n}\n\nexport function yExtent(data: DataRecord[], series: LineSeries[]): Range {\n let lo = Infinity\n let hi = -Infinity\n for (const row of data)\n for (const s of series) {\n const v = num(row, s.field)\n if (v < lo) lo = v\n if (v > hi) hi = v\n }\n return lo <= hi ? [lo, hi] : [0, 1]\n}\n\n/**\n * The explicit `range`, else the data's y extent nudged out to tidy step bounds.\n * `divisions` (one fewer than the marker count) only shapes the step when\n * `range` is omitted.\n */\nexport function resolveYScale(\n data: DataRecord[],\n series: LineSeries[],\n range: Range | undefined,\n divisions: number\n): Range {\n return range ?? niceRange(yExtent(data, series), divisions)\n}\n\n/** How the series sit on one another: apart, each on the sum of those before it, or as shares of the row's total. */\nexport type LineStack = \"none\" | \"stacked\" | \"percent\"\n\n/** One series as drawn: its `[x, y]` points along x, and the line its area fills down to (`null`: the baseline). */\nexport interface StackedSeries {\n readonly points: [x: number, y: number][]\n readonly base: [x: number, y: number][] | null\n}\n\n/**\n * Every series' points under `stack`, rows in x order. A series contributes its\n * values times its weight (`1` when missing), so a series sinking out of a stack\n * lowers the ones above it. `percent` reads each row as shares of its total\n * magnitude, so the top of a full stack is 100.\n */\nexport function stackSeries(\n data: DataRecord[],\n x: XScale,\n series: readonly LineSeries[],\n stack: LineStack,\n weights: readonly number[] = []\n): StackedSeries[] {\n const order = data.map((_, i) => i).sort((a, b) => x.at(a) - x.at(b))\n if (stack !== \"stacked\" && stack !== \"percent\") {\n return series.map((s) => ({ points: order.map((r): [number, number] => [x.at(r), num(data[r], s.field)]), base: null }))\n }\n const weight = (i: number) => Math.max(0, weights[i] ?? 1)\n const totals = order.map((r) => series.reduce((sum, s, i) => sum + Math.abs(num(data[r], s.field) * weight(i)), 0))\n const running = order.map(() => 0)\n return series.map((s, i) => {\n const base = order.map((r, k): [number, number] => [x.at(r), running[k]])\n const points = order.map((r, k): [number, number] => {\n const value = num(data[r], s.field) * weight(i)\n running[k] += stack === \"percent\" ? (totals[k] > 0 ? (value / totals[k]) * 100 : 0) : value\n return [x.at(r), running[k]]\n })\n return { points, base }\n })\n}\n\n/** The lowest and highest y anything in `stacks` reaches, its bases included. */\nexport function stackExtent(stacks: readonly StackedSeries[]): Range {\n let lo = Infinity\n let hi = -Infinity\n for (const { points, base } of stacks)\n for (const [, y] of [...points, ...(base ?? [])]) {\n if (y < lo) lo = y\n if (y > hi) hi = y\n }\n return lo <= hi ? [lo, hi] : [0, 1]\n}\n\n/** How a series' line runs between its points. */\nexport type LineCurve = \"smooth\" | \"linear\" | \"step\"\n\n/** Points along a cubic Bezier segment, its start left out. */\nconst SAMPLES = 16\n\n/**\n * The drawn path through `points` (ordered along x) as a polyline: the points\n * themselves for `linear`; for `step`, level runs that change at the midpoint\n * between neighbours; for `smooth`, a monotone cubic (Fritsch-Carlson, as d3's\n * `curveMonotoneX`), which never overshoots the data between two points.\n */\nexport function curvePoints(points: readonly Vector2[], curve: LineCurve): Vector2[] {\n if (curve === \"step\") {\n const out: Vector2[] = points.length > 0 ? [points[0]] : []\n for (let i = 1; i < points.length; i++) {\n const mid = (points[i - 1].x + points[i].x) / 2\n out.push({ x: mid, y: points[i - 1].y }, { x: mid, y: points[i].y }, points[i])\n }\n return out\n }\n if (curve !== \"smooth\" || points.length < 3) return [...points]\n const tangents = monotoneTangents(points)\n const out: Vector2[] = [points[0]]\n for (let i = 1; i < points.length; i++) {\n const a = points[i - 1]\n const b = points[i]\n const dx = (b.x - a.x) / 3\n const c1 = { x: a.x + dx, y: a.y + dx * tangents[i - 1] }\n const c2 = { x: b.x - dx, y: b.y - dx * tangents[i] }\n for (let k = 1; k <= SAMPLES; k++) {\n const t = k / SAMPLES\n const u = 1 - t\n out.push({\n x: u * u * u * a.x + 3 * u * u * t * c1.x + 3 * u * t * t * c2.x + t * t * t * b.x,\n y: u * u * u * a.y + 3 * u * u * t * c1.y + 3 * u * t * t * c2.y + t * t * t * b.y,\n })\n }\n }\n return out\n}\n\nfunction monotoneTangents(points: readonly Vector2[]): number[] {\n const n = points.length\n const slope = (i: number) => {\n const h = points[i + 1].x - points[i].x\n return h === 0 ? 0 : (points[i + 1].y - points[i].y) / h\n }\n const m = new Array<number>(n).fill(0)\n for (let i = 1; i < n - 1; i++) {\n const h0 = points[i].x - points[i - 1].x\n const h1 = points[i + 1].x - points[i].x\n const s0 = slope(i - 1)\n const s1 = slope(i)\n const p = h0 + h1 === 0 ? 0 : (s0 * h1 + s1 * h0) / (h0 + h1)\n m[i] = (Math.sign(s0) + Math.sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0\n }\n m[0] = endTangent(slope(0), m[1])\n m[n - 1] = endTangent(slope(n - 2), m[n - 2])\n return m\n}\n\n/** d3's one-sided end tangent, held to the end segment's own direction and to three times its slope, past which it would overshoot. */\nfunction endTangent(secant: number, inner: number): number {\n const t = (3 * secant - inner) / 2\n if (secant === 0 || Math.sign(t) !== Math.sign(secant)) return 0\n return Math.abs(t) > 3 * Math.abs(secant) ? 3 * secant : t\n}\n\n/** The part of `points` (ordered along x) left of `x`, ending on the point where it crosses `x`. */\nexport function cutAt(points: readonly Vector2[], x: number): Vector2[] {\n if (points.length === 0 || x < points[0].x) return []\n const out: Vector2[] = []\n for (let i = 0; i < points.length; i++) {\n const p = points[i]\n if (p.x <= x) {\n out.push(p)\n continue\n }\n const a = points[i - 1]\n if (a && p.x > a.x) out.push({ x, y: a.y + ((p.y - a.y) * (x - a.x)) / (p.x - a.x) })\n break\n }\n return out\n}\n\n/**\n * `polygon` clipped to `box` (Sutherland-Hodgman against each edge in turn).\n * The box is convex, so the result is the part inside, possibly with seams of\n * no width where a concave outline leaves and re-enters, which fill as nothing.\n */\nexport function clipPolygonToBox(polygon: readonly Vector2[], box: RegionBox): Vector2[] {\n if (polygon.length < 3 || !hasRegion(box)) return []\n const edges: ((p: Vector2) => number)[] = [\n (p) => p.x - box.left,\n (p) => box.right - p.x,\n (p) => p.y - box.bottom,\n (p) => box.top - p.y,\n ]\n let out: Vector2[] = [...polygon]\n for (const inside of edges) {\n const input = out\n out = []\n for (let i = 0; i < input.length; i++) {\n const cur = input[i]\n const prev = input[(i + input.length - 1) % input.length]\n const dc = inside(cur)\n const dp = inside(prev)\n if (dc >= 0) {\n if (dp < 0) out.push(crossing(prev, cur, dp, dc))\n out.push(cur)\n } else if (dp >= 0) out.push(crossing(prev, cur, dp, dc))\n }\n if (out.length === 0) return []\n }\n return out\n}\n\nfunction crossing(a: Vector2, b: Vector2, da: number, db: number): Vector2 {\n const t = da / (da - db)\n return { x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t }\n}\n\n/** A line chart's own look: how each series is stroked, dotted and filled. */\nexport const LINE_MARKS = {\n strokeWidth: Types.number(4, { min: 0, max: 24, step: 0.5, unit: \"px\" }),\n curve: Types.oneOf([\"smooth\", \"linear\", \"step\"] as const),\n dots: Types.boolean(false),\n /** Each dot's diameter. */\n dotSize: Types.number(12, { min: 0, max: 48, step: 1, unit: \"px\" }),\n /** Fill under each line: none, the series colour, or the colour fading to nothing at the baseline. */\n area: Types.oneOf([\"none\", \"solid\", \"gradient\"] as const),\n /** The fill's opacity at the line. */\n areaOpacity: Types.number(0.4, { min: 0, max: 1, step: 0.05 }),\n}\n\nexport const LINE_LABELS = {\n /** Read as the chart is built: each point's value printed above or below it, or none. */\n values: Types.oneOf([\"none\", \"above\", \"below\"] as const, { animatable: false }),\n}\n"]}
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/line-chart/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAA+D,MAAM,mBAAmB,CAAA;AAEtG,OAAO,EAAE,SAAS,EAAE,GAAG,EAAgC,MAAM,eAAe,CAAA;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAgCzC,qCAAqC;AACrC,MAAM,CAAC,MAAM,gBAAgB,GAAc;IACzC,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC;IACN,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,KAAK;CAChB,CAA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,sCAAsC;IACtC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;CAC/D,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,yFAAyF;IACzF,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAU,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IAC/E,GAAG,UAAU;CACd,CAAA","sourcesContent":["import { Types, type DataRecord, type Vector2, type TextStyle as _TextStyle } from \"@motionscript/sdk\"\n\nimport { niceRange, num, type ChartSeries, type Range } from \"../kit/shared\"\nimport { VALUE_TEXT } from \"../kit/style\"\nimport type { XScale } from \"./x-scale\"\n\n/** One polyline of a {@link LineChart}: {@link ChartSeries} under the name for what it draws here. */\nexport type LineSeries = ChartSeries\n\n/**\n * A rectangular slice of the plot in data units, the input to `spotlightRegion`\n * and `zoomTo`. Either axis may be omitted: `{ x: [60, 100] }` is a full-height\n * band. A reversed range reads the same as a forward one.\n */\nexport interface PlotRegion {\n /** Omit to span the full plot width. */\n x?: Range\n /** Omit to span the full plot height. */\n y?: Range\n}\n\n/**\n * A {@link PlotRegion} in the plot's centred pixel space (origin at the centre,\n * y-up), the frame the series points live in. An axis the author left unbounded\n * has its edges pinned to the plot's own and draws no rule.\n */\nexport interface RegionBox {\n left: number\n right: number\n bottom: number\n top: number\n xBounded: boolean\n yBounded: boolean\n}\n\n/** The \"no region\" resting value. */\nexport const EMPTY_REGION_BOX: RegionBox = {\n left: 0,\n right: 0,\n bottom: 0,\n top: 0,\n xBounded: false,\n yBounded: false,\n}\n\n/** Whether `box` is non-degenerate, so there is something to spotlight. */\nexport function hasRegion(box: RegionBox): boolean {\n return box.right > box.left && box.top > box.bottom\n}\n\n/**\n * Resolve a {@link PlotRegion} against the plot rectangle (centred pixel space)\n * and the data ranges its edges span. An omitted axis takes the plot's own\n * edges; a given one is clamped to the plot.\n */\nexport function resolveRegionBox(\n region: PlotRegion | null | undefined,\n plot: { left: number; right: number; bottom: number; top: number },\n xScale: Range,\n yScale: Range\n): RegionBox {\n if (!region || (region.x === undefined && region.y === undefined)) {\n return EMPTY_REGION_BOX\n }\n\n const span = (\n range: Range | undefined,\n [min, max]: Range,\n lo: number,\n hi: number\n ): [number, number, boolean] => {\n if (range === undefined || max <= min) return [lo, hi, false]\n const a = Math.min(range[0], range[1])\n const b = Math.max(range[0], range[1])\n const toPx = (v: number) => lo + ((v - min) / (max - min)) * (hi - lo)\n return [\n Math.max(lo, Math.min(hi, toPx(a))),\n Math.max(lo, Math.min(hi, toPx(b))),\n true,\n ]\n }\n\n const [left, right, xBounded] = span(region.x, xScale, plot.left, plot.right)\n const [bottom, top, yBounded] = span(region.y, yScale, plot.bottom, plot.top)\n return { left, right, bottom, top, xBounded, yBounded }\n}\n\n/**\n * The parts of `points` inside `box`, as contiguous sub-polylines: a series is\n * drawn dimmed in full, then these runs are re-drawn at full strength. Segments\n * are clipped, not filtered by endpoint, so a line entering mid-segment is cut\n * exactly on the boundary.\n */\nexport function clipPolylineToBox(\n points: Vector2[],\n box: RegionBox\n): Vector2[][] {\n if (points.length < 2 || !hasRegion(box)) return []\n\n const runs: Vector2[][] = []\n let run: Vector2[] = []\n\n for (let i = 1; i < points.length; i++) {\n const seg = clipSegment(points[i - 1], points[i], box)\n if (!seg) {\n // Misses the box: close the open run.\n if (run.length >= 2) runs.push(run)\n run = []\n continue\n }\n const [a, b] = seg\n // Continues the open run if it starts where the last ended; otherwise the line left and came back.\n if (run.length > 0 && samePoint(run[run.length - 1], a)) run.push(b)\n else {\n if (run.length >= 2) runs.push(run)\n run = [a, b]\n }\n }\n if (run.length >= 2) runs.push(run)\n return runs\n}\n\n/** Points within half a pixel are the same point, for run-joining purposes. */\nfunction samePoint(a: Vector2, b: Vector2): boolean {\n return Math.abs(a.x - b.x) < 0.5 && Math.abs(a.y - b.y) < 0.5\n}\n\n/** Liang-Barsky clip of one segment against `box`: the surviving `[start, end]`, or `null` when wholly outside. */\nfunction clipSegment(\n a: Vector2,\n b: Vector2,\n box: RegionBox\n): [Vector2, Vector2] | null {\n const dx = b.x - a.x\n const dy = b.y - a.y\n let t0 = 0\n let t1 = 1\n\n // Each edge as (p, q): the segment survives where p*t <= q.\n const edges: [number, number][] = [\n [-dx, a.x - box.left],\n [dx, box.right - a.x],\n [-dy, a.y - box.bottom],\n [dy, box.top - a.y],\n ]\n for (const [p, q] of edges) {\n if (p === 0) {\n // Parallel to this edge: outside it, the whole segment is out.\n if (q < 0) return null\n continue\n }\n const r = q / p\n if (p < 0) {\n if (r > t1) return null\n if (r > t0) t0 = r\n } else {\n if (r < t0) return null\n if (r < t1) t1 = r\n }\n }\n return [\n { x: a.x + t0 * dx, y: a.y + t0 * dy },\n { x: a.x + t1 * dx, y: a.y + t1 * dy },\n ]\n}\n\n/**\n * One series' `[x, y]` points, sorted along x so the polyline traces left to\n * right. A row missing its y contributes 0 rather than a gap, since dropping it\n * would silently bridge the hole.\n */\nexport function seriesPoints(\n data: DataRecord[],\n x: XScale,\n series: LineSeries\n): [x: number, y: number][] {\n return data\n .map((row, i): [number, number] => [x.at(i), num(row, series.field)])\n .sort((a, b) => a[0] - b[0])\n}\n\nexport function yExtent(data: DataRecord[], series: LineSeries[]): Range {\n let lo = Infinity\n let hi = -Infinity\n for (const row of data)\n for (const s of series) {\n const v = num(row, s.field)\n if (v < lo) lo = v\n if (v > hi) hi = v\n }\n return lo <= hi ? [lo, hi] : [0, 1]\n}\n\n/**\n * The explicit `range`, else the data's y extent nudged out to tidy step bounds.\n * `divisions` (one fewer than the marker count) only shapes the step when\n * `range` is omitted.\n */\nexport function resolveYScale(\n data: DataRecord[],\n series: LineSeries[],\n range: Range | undefined,\n divisions: number\n): Range {\n return range ?? niceRange(yExtent(data, series), divisions)\n}\n\n/** How the series sit on one another: apart, each on the sum of those before it, or as shares of the row's total. */\nexport type LineStack = \"none\" | \"stacked\" | \"percent\"\n\n/** One series as drawn: its `[x, y]` points along x, and the line its area fills down to (`null`: the baseline). */\nexport interface StackedSeries {\n readonly points: [x: number, y: number][]\n readonly base: [x: number, y: number][] | null\n}\n\n/**\n * Every series' points under `stack`, rows in x order. A series contributes its\n * values times its weight (`1` when missing), so a series sinking out of a stack\n * lowers the ones above it. `percent` reads each row as shares of its total\n * magnitude, so the top of a full stack is 100.\n */\nexport function stackSeries(\n data: DataRecord[],\n x: XScale,\n series: readonly LineSeries[],\n stack: LineStack,\n weights: readonly number[] = []\n): StackedSeries[] {\n const order = data.map((_, i) => i).sort((a, b) => x.at(a) - x.at(b))\n if (stack !== \"stacked\" && stack !== \"percent\") {\n return series.map((s) => ({ points: order.map((r): [number, number] => [x.at(r), num(data[r], s.field)]), base: null }))\n }\n const weight = (i: number) => Math.max(0, weights[i] ?? 1)\n const totals = order.map((r) => series.reduce((sum, s, i) => sum + Math.abs(num(data[r], s.field) * weight(i)), 0))\n const running = order.map(() => 0)\n return series.map((s, i) => {\n const base = order.map((r, k): [number, number] => [x.at(r), running[k]])\n const points = order.map((r, k): [number, number] => {\n const value = num(data[r], s.field) * weight(i)\n running[k] += stack === \"percent\" ? (totals[k] > 0 ? (value / totals[k]) * 100 : 0) : value\n return [x.at(r), running[k]]\n })\n return { points, base }\n })\n}\n\n/** The lowest and highest y anything in `stacks` reaches, its bases included. */\nexport function stackExtent(stacks: readonly StackedSeries[]): Range {\n let lo = Infinity\n let hi = -Infinity\n for (const { points, base } of stacks)\n for (const [, y] of [...points, ...(base ?? [])]) {\n if (y < lo) lo = y\n if (y > hi) hi = y\n }\n return lo <= hi ? [lo, hi] : [0, 1]\n}\n\n/** How a series' line runs between its points. */\nexport type LineCurve = \"smooth\" | \"linear\" | \"step\"\n\n/** Points along a cubic Bezier segment, its start left out. */\nconst SAMPLES = 16\n\n/**\n * The drawn path through `points` (ordered along x) as a polyline: the points\n * themselves for `linear`; for `step`, level runs that change at the midpoint\n * between neighbours; for `smooth`, a monotone cubic (Fritsch-Carlson, as d3's\n * `curveMonotoneX`), which never overshoots the data between two points.\n */\nexport function curvePoints(points: readonly Vector2[], curve: LineCurve): Vector2[] {\n if (curve === \"step\") {\n const out: Vector2[] = points.length > 0 ? [points[0]] : []\n for (let i = 1; i < points.length; i++) {\n const mid = (points[i - 1].x + points[i].x) / 2\n out.push({ x: mid, y: points[i - 1].y }, { x: mid, y: points[i].y }, points[i])\n }\n return out\n }\n if (curve !== \"smooth\" || points.length < 3) return [...points]\n const tangents = monotoneTangents(points)\n const out: Vector2[] = [points[0]]\n for (let i = 1; i < points.length; i++) {\n const a = points[i - 1]\n const b = points[i]\n const dx = (b.x - a.x) / 3\n const c1 = { x: a.x + dx, y: a.y + dx * tangents[i - 1] }\n const c2 = { x: b.x - dx, y: b.y - dx * tangents[i] }\n for (let k = 1; k <= SAMPLES; k++) {\n const t = k / SAMPLES\n const u = 1 - t\n out.push({\n x: u * u * u * a.x + 3 * u * u * t * c1.x + 3 * u * t * t * c2.x + t * t * t * b.x,\n y: u * u * u * a.y + 3 * u * u * t * c1.y + 3 * u * t * t * c2.y + t * t * t * b.y,\n })\n }\n }\n return out\n}\n\nfunction monotoneTangents(points: readonly Vector2[]): number[] {\n const n = points.length\n const slope = (i: number) => {\n const h = points[i + 1].x - points[i].x\n return h === 0 ? 0 : (points[i + 1].y - points[i].y) / h\n }\n const m = new Array<number>(n).fill(0)\n for (let i = 1; i < n - 1; i++) {\n const h0 = points[i].x - points[i - 1].x\n const h1 = points[i + 1].x - points[i].x\n const s0 = slope(i - 1)\n const s1 = slope(i)\n const p = h0 + h1 === 0 ? 0 : (s0 * h1 + s1 * h0) / (h0 + h1)\n m[i] = (Math.sign(s0) + Math.sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0\n }\n m[0] = endTangent(slope(0), m[1])\n m[n - 1] = endTangent(slope(n - 2), m[n - 2])\n return m\n}\n\n/** d3's one-sided end tangent, held to the end segment's own direction and to three times its slope, past which it would overshoot. */\nfunction endTangent(secant: number, inner: number): number {\n const t = (3 * secant - inner) / 2\n if (secant === 0 || Math.sign(t) !== Math.sign(secant)) return 0\n return Math.abs(t) > 3 * Math.abs(secant) ? 3 * secant : t\n}\n\n/** The part of `points` (ordered along x) left of `x`, ending on the point where it crosses `x`. */\nexport function cutAt(points: readonly Vector2[], x: number): Vector2[] {\n if (points.length === 0 || x < points[0].x) return []\n const out: Vector2[] = []\n for (let i = 0; i < points.length; i++) {\n const p = points[i]\n if (p.x <= x) {\n out.push(p)\n continue\n }\n const a = points[i - 1]\n if (a && p.x > a.x) out.push({ x, y: a.y + ((p.y - a.y) * (x - a.x)) / (p.x - a.x) })\n break\n }\n return out\n}\n\n/**\n * `polygon` clipped to `box` (Sutherland-Hodgman against each edge in turn).\n * The box is convex, so the result is the part inside, possibly with seams of\n * no width where a concave outline leaves and re-enters, which fill as nothing.\n */\nexport function clipPolygonToBox(polygon: readonly Vector2[], box: RegionBox): Vector2[] {\n if (polygon.length < 3 || !hasRegion(box)) return []\n const edges: ((p: Vector2) => number)[] = [\n (p) => p.x - box.left,\n (p) => box.right - p.x,\n (p) => p.y - box.bottom,\n (p) => box.top - p.y,\n ]\n let out: Vector2[] = [...polygon]\n for (const inside of edges) {\n const input = out\n out = []\n for (let i = 0; i < input.length; i++) {\n const cur = input[i]\n const prev = input[(i + input.length - 1) % input.length]\n const dc = inside(cur)\n const dp = inside(prev)\n if (dc >= 0) {\n if (dp < 0) out.push(crossing(prev, cur, dp, dc))\n out.push(cur)\n } else if (dp >= 0) out.push(crossing(prev, cur, dp, dc))\n }\n if (out.length === 0) return []\n }\n return out\n}\n\nfunction crossing(a: Vector2, b: Vector2, da: number, db: number): Vector2 {\n const t = da / (da - db)\n return { x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t }\n}\n\n/** A line chart's own look: how each series is stroked, dotted and filled. */\nexport const LINE_MARKS = {\n strokeWidth: Types.number(4, { min: 0, max: 24, step: 0.5, unit: \"px\" }),\n curve: Types.oneOf([\"smooth\", \"linear\", \"step\"] as const),\n dots: Types.boolean(false),\n /** Each dot's diameter. */\n dotSize: Types.number(12, { min: 0, max: 48, step: 1, unit: \"px\" }),\n /** Fill under each line: none, the series colour, or the colour fading to nothing at the baseline. */\n area: Types.oneOf([\"none\", \"solid\", \"gradient\"] as const),\n /** The fill's opacity at the line. */\n areaOpacity: Types.number(0.4, { min: 0, max: 1, step: 0.05 }),\n}\n\nexport const LINE_LABELS = {\n /** Read as the chart is built: each point's value printed above or below it, or none. */\n values: Types.oneOf([\"none\", \"above\", \"below\"] as const, { animatable: false }),\n ...VALUE_TEXT,\n}\n"]}
@@ -29,11 +29,7 @@ export declare const PieChart: import("@motionscript/sdk").Component<"pieChart",
29
29
  } & {
30
30
  legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
31
31
  swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
32
- } & {
33
32
  legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
34
- labelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
35
- valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
36
- centerText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
37
33
  } & {
38
34
  seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
39
35
  } & {
@@ -42,16 +38,15 @@ export declare const PieChart: import("@motionscript/sdk").Component<"pieChart",
42
38
  sliceRadius: import("@motionscript/sdk").Type<number, number, false>;
43
39
  } & {
44
40
  labelPlacement: import("@motionscript/sdk").Type<"inside" | "outside" | "none", "inside" | "outside" | "none", false>;
41
+ labelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
42
+ valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
43
+ centerText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
45
44
  }>, import("@motionscript/sdk").StyleValues<{
46
45
  background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
47
46
  } & {
48
47
  legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
49
48
  swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
50
- } & {
51
49
  legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
52
- labelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
53
- valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
54
- centerText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
55
50
  } & {
56
51
  seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
57
52
  } & {
@@ -60,6 +55,9 @@ export declare const PieChart: import("@motionscript/sdk").Component<"pieChart",
60
55
  sliceRadius: import("@motionscript/sdk").Type<number, number, false>;
61
56
  } & {
62
57
  labelPlacement: import("@motionscript/sdk").Type<"inside" | "outside" | "none", "inside" | "outside" | "none", false>;
58
+ labelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
59
+ valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
60
+ centerText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
63
61
  }>, false>;
64
62
  /** What the ring's labels say. */
65
63
  readonly labelMode: import("@motionscript/sdk").Type<PieLabelMode, PieLabelMode, false>;
@@ -97,11 +95,7 @@ export declare const PieChart: import("@motionscript/sdk").Component<"pieChart",
97
95
  } & {
98
96
  legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
99
97
  swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
100
- } & {
101
98
  legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
102
- labelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
103
- valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
104
- centerText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
105
99
  } & {
106
100
  seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
107
101
  } & {
@@ -110,16 +104,15 @@ export declare const PieChart: import("@motionscript/sdk").Component<"pieChart",
110
104
  sliceRadius: import("@motionscript/sdk").Type<number, number, false>;
111
105
  } & {
112
106
  labelPlacement: import("@motionscript/sdk").Type<"inside" | "outside" | "none", "inside" | "outside" | "none", false>;
107
+ labelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
108
+ valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
109
+ centerText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
113
110
  }>, import("@motionscript/sdk").StyleValues<{
114
111
  background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
115
112
  } & {
116
113
  legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
117
114
  swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
118
- } & {
119
115
  legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
120
- labelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
121
- valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
122
- centerText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
123
116
  } & {
124
117
  seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
125
118
  } & {
@@ -128,6 +121,9 @@ export declare const PieChart: import("@motionscript/sdk").Component<"pieChart",
128
121
  sliceRadius: import("@motionscript/sdk").Type<number, number, false>;
129
122
  } & {
130
123
  labelPlacement: import("@motionscript/sdk").Type<"inside" | "outside" | "none", "inside" | "outside" | "none", false>;
124
+ labelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
125
+ valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
126
+ centerText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
131
127
  }>, false>;
132
128
  /** What the ring's labels say. */
133
129
  readonly labelMode: import("@motionscript/sdk").Type<PieLabelMode, PieLabelMode, false>;
@@ -152,11 +148,7 @@ export declare const PieChart: import("@motionscript/sdk").Component<"pieChart",
152
148
  } & {
153
149
  legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
154
150
  swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
155
- } & {
156
151
  legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
157
- labelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
158
- valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
159
- centerText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
160
152
  } & {
161
153
  seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
162
154
  } & {
@@ -165,16 +157,15 @@ export declare const PieChart: import("@motionscript/sdk").Component<"pieChart",
165
157
  sliceRadius: import("@motionscript/sdk").Type<number, number, false>;
166
158
  } & {
167
159
  labelPlacement: import("@motionscript/sdk").Type<"inside" | "outside" | "none", "inside" | "outside" | "none", false>;
160
+ labelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
161
+ valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
162
+ centerText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
168
163
  }>, import("@motionscript/sdk").StyleValues<{
169
164
  background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
170
165
  } & {
171
166
  legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
172
167
  swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
173
- } & {
174
168
  legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
175
- labelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
176
- valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
177
- centerText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
178
169
  } & {
179
170
  seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
180
171
  } & {
@@ -183,6 +174,9 @@ export declare const PieChart: import("@motionscript/sdk").Component<"pieChart",
183
174
  sliceRadius: import("@motionscript/sdk").Type<number, number, false>;
184
175
  } & {
185
176
  labelPlacement: import("@motionscript/sdk").Type<"inside" | "outside" | "none", "inside" | "outside" | "none", false>;
177
+ labelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
178
+ valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
179
+ centerText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
186
180
  }>, false>;
187
181
  /** What the ring's labels say. */
188
182
  readonly labelMode: import("@motionscript/sdk").Type<PieLabelMode, PieLabelMode, false>;
@@ -1 +1 @@
1
- {"version":3,"file":"pie-chart.d.ts","sourceRoot":"","sources":["../../src/pie-chart/pie-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,UAAU,EACf,KAAK,MAAM,EAEX,KAAK,MAAM,EACX,KAAK,WAAW,IAAI,YAAY,EAChC,KAAK,SAAS,IAAI,UAAU,EAC5B,KAAK,IAAI,IAAI,KAAK,EAClB,KAAK,YAAY,IAAI,aAAa,EACnC,MAAM,mBAAmB,CAAA;AAO1B,OAAO,EASL,KAAK,YAAY,EAEjB,KAAK,QAAQ,EACd,MAAM,UAAU,CAAA;AAEjB,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,CAAA;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9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illResolved[], false>;
98
98
  };
99
- text: {
100
- legendText: import("@motionscript/sdk").Type<TextStyle, TextStyle, false>;
101
- /** Each slice's name. */
102
- labelText: import("@motionscript/sdk").Type<TextStyle, TextStyle, false>;
103
- /** Each slice's share or value, beside its name; inside a wedge both are set larger, inked for contrast. */
104
- valueText: import("@motionscript/sdk").Type<TextStyle, TextStyle, false>;
105
- /** The summary in the hole; its caption is set smaller, in the slice names' ink. */
106
- centerText: import("@motionscript/sdk").Type<TextStyle, TextStyle, false>;
107
- };
108
99
  marks: {
109
100
  /** Hole radius as a fraction of the outer radius: 0 is a pie, about 0.6 a donut. */
110
101
  innerRadius: import("@motionscript/sdk").Type<number, number, false>;
@@ -116,10 +107,17 @@ export declare const PIE_STYLE_GROUPS: {
116
107
  labels: {
117
108
  /** Read as the chart is built: inside the wedge, outside on a leader, or none. */
118
109
  labelPlacement: import("@motionscript/sdk").Type<"inside" | "outside" | "none", "inside" | "outside" | "none", false>;
110
+ /** Each slice's name. */
111
+ labelText: import("@motionscript/sdk").Type<TextStyle, TextStyle, false>;
112
+ /** Each slice's share or value, beside its name; inside a wedge both are set larger, inked for contrast. */
113
+ valueText: import("@motionscript/sdk").Type<TextStyle, TextStyle, false>;
114
+ /** The summary in the hole; its caption is set smaller, in the slice names' ink. */
115
+ centerText: import("@motionscript/sdk").Type<TextStyle, TextStyle, false>;
119
116
  };
120
117
  legend: {
121
118
  legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
122
119
  swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
120
+ legendText: import("@motionscript/sdk").Type<TextStyle, TextStyle, false>;
123
121
  };
124
122
  };
125
123
  export declare function legendOf(style: PieStyle): LegendConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/pie-chart/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,IAAI,EAAE,KAAK,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ND, CHART_FOREGROUND, CHART_LEGEND, CHART_MUTED, CHART_SERIES, LEGEND_TEXT, legendConfigOf, placedText, sizeOf, } from "../kit/style.js";
2
+ import { CHART_BACKGROUND, CHART_FOREGROUND, CHART_LEGEND, CHART_MUTED, CHART_SERIES, legendConfigOf, placedText, sizeOf, } from "../kit/style.js";
3
3
  import { num, text } from "../kit/shared.js";
4
4
  import { DEG, PIE_SPOTLIGHT_DIM, ringPoint, selectionFade } from "../kit/polar.js";
5
5
  export { DEG, PIE_SPOTLIGHT_DIM, ringPoint, selectionFade };
@@ -75,15 +75,6 @@ export function relaxLabels(slots, minGap, top, bottom) {
75
75
  export const PIE_STYLE_GROUPS = {
76
76
  series: CHART_SERIES,
77
77
  background: CHART_BACKGROUND,
78
- text: {
79
- /** Each slice's name. */
80
- labelText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_MUTED }),
81
- /** Each slice's share or value, beside its name; inside a wedge both are set larger, inked for contrast. */
82
- valueText: Types.typography({ fontSize: 28, fontWeight: 700, fill: CHART_FOREGROUND }),
83
- /** The summary in the hole; its caption is set smaller, in the slice names' ink. */
84
- centerText: Types.typography({ fontSize: 50, fontWeight: 800, fill: CHART_FOREGROUND }),
85
- ...LEGEND_TEXT,
86
- },
87
78
  marks: {
88
79
  /** Hole radius as a fraction of the outer radius: 0 is a pie, about 0.6 a donut. */
89
80
  innerRadius: Types.number(0, { min: 0, max: 0.9, step: 0.05 }),
@@ -95,6 +86,12 @@ export const PIE_STYLE_GROUPS = {
95
86
  labels: {
96
87
  /** Read as the chart is built: inside the wedge, outside on a leader, or none. */
97
88
  labelPlacement: Types.oneOf(["inside", "outside", "none"], { animatable: false }),
89
+ /** Each slice's name. */
90
+ labelText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_MUTED }),
91
+ /** Each slice's share or value, beside its name; inside a wedge both are set larger, inked for contrast. */
92
+ valueText: Types.typography({ fontSize: 28, fontWeight: 700, fill: CHART_FOREGROUND }),
93
+ /** The summary in the hole; its caption is set smaller, in the slice names' ink. */
94
+ centerText: Types.typography({ fontSize: 50, fontWeight: 800, fill: CHART_FOREGROUND }),
98
95
  },
99
96
  legend: CHART_LEGEND,
100
97
  };
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/pie-chart/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAA8E,MAAM,mBAAmB,CAAA;AAErH,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,EACX,cAAc,EACd,UAAU,EACV,MAAM,GAEP,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,GAAG,EAAE,IAAI,EAAqB,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,aAAa,EAAoC,MAAM,cAAc,CAAA;AAEjH,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,aAAa,EAAoC,CAAA;AAE7F;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAwC,EAAE,QAAgB,EAAE,KAAa,EAAE,OAAwB;IAClI,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC3B,QAAQ,EAAE,IAAI,CAAC,GAAY,EAAE,QAAQ,CAAC;QACtC,KAAK,EAAE,GAAG,CAAC,GAAY,EAAE,KAAK,CAAC;QAC/B,IAAI,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,OAAgB;KAC3E,CAAC,CAAC,CAAA;AACL,CAAC;AAeD,2EAA2E;AAC3E,MAAM,UAAU,UAAU,CAAC,KAAe;IACxC,OAAO,KAAK,CAAC,KAAK,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK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M,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACxC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACzC,OAAO;QACL,SAAS,EAAE,IAAI;QACf,YAAY,EAAE,KAAK;QACnB,WAAW,EAAE,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE;QAC/F,YAAY,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,IAAI,OAAO,EAAE;KACnE,CAAA;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAe;IAC5C,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;IACzC,OAAO;QACL,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC;QACxC,YAAY,EAAE,UAAU,CAAC,KAAK,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;KAC3F,CAAA;AACH,CAAC","sourcesContent":["import { Types, type Fill, type TextStyle, type Stroke, type FillResolved as _FillResolved } from \"@motionscript/sdk\"\n\nimport {\n CHART_BACKGROUND,\n CHART_FOREGROUND,\n CHART_LEGEND,\n CHART_MUTED,\n CHART_SERIES,\n LEGEND_TEXT,\n legendConfigOf,\n placedText,\n sizeOf,\n type ChartStyleBase,\n} from \"../kit/style\"\nimport { num, text, type LegendConfig } from \"../kit/shared\"\nimport { DEG, PIE_SPOTLIGHT_DIM, ringPoint, selectionFade, type CenterConfig, type PieSlice } from \"../kit/polar\"\n\nexport { DEG, PIE_SPOTLIGHT_DIM, ringPoint, selectionFade, type CenterConfig, type PieSlice }\n\n/**\n * One slice per row, painted from `seriesFills` by row order (cycling). Paint comes\n * from the palette, not the rows, because a pie's mark is a row where a line's\n * colour belongs to a column; that lets a pie be fed a CSV of plain numbers.\n */\nexport function resolvePieSlices(data: readonly Record<string, unknown>[], category: string, value: string, palette: readonly Fill[]): PieSlice[] {\n return data.map((row, i) => ({\n category: text(row as never, category),\n value: num(row as never, value),\n fill: palette.length > 0 ? palette[i % palette.length] : (\"white\" as Fill),\n }))\n}\n\n/** What a {@link PieChart}'s labels say. */\nexport type PieLabelMode =\n /** Two lines, whose order flips with placement: an outside label reads category over percentage, an inside label reads the percentage big over a small category. */\n | \"both\"\n | \"category\"\n | \"percent\"\n /** No labels and no leader lines. */\n | \"none\"\n\n/** `\"inside\"` centres the label in the wedge's band with no leader or gutter, so the ring draws bigger; `\"outside\"` sets it on a leader, which a sliver too narrow for text needs. */\nexport type PieLabelPlacement = \"inside\" | \"outside\" | \"none\"\n\n\n/** A slice's plotted value: negatives and non-finite values count as 0. */\nexport function sliceValue(slice: PieSlice): number {\n return slice.value > 0 && Number.isFinite(slice.value) ? slice.value : 0\n}\n\n/** Sum of every slice's plotted value, the denominator of every share. */\nexport function sliceTotal(slices: PieSlice[]): number {\n let sum = 0\n for (const slice of slices) sum += sliceValue(slice)\n return sum\n}\n\n/** One slice's resolved angular span on the ring. */\nexport interface PieArc {\n /** Index of the slice in the source list. */\n index: number\n /** Radians clockwise from 12 o'clock. */\n a0: number\n a1: number\n /** Where the slice's label and pop-out point. */\n mid: number\n /** Share of the total, `[0, 1]`. */\n fraction: number\n}\n\n/**\n * One arc per positive slice, walking clockwise from `startDegrees` and abutting.\n * Arcs are the undivided shares: a fixed angular gap would pinch shut at the\n * hole, so the gap is applied when the wedge is drawn, as a constant-width inset\n * off both ends.\n */\nexport function pieArcs(slices: PieSlice[], startDegrees: number): PieArc[] {\n const total = sliceTotal(slices)\n if (total <= 0) return []\n\n const arcs: PieArc[] = []\n let cursor = startDegrees * DEG\n slices.forEach((slice, index) => {\n const value = sliceValue(slice)\n if (value <= 0) return\n const fraction = value / total\n const a0 = cursor\n const a1 = a0 + fraction * Math.PI * 2\n cursor = a1\n arcs.push({ index, a0, a1, mid: (a0 + a1) / 2, fraction })\n })\n return arcs\n}\n\ninterface LabelSlot {\n /** Where the label would sit if nothing else were in the way. */\n ideal: number\n /** Written by {@link relaxLabels}. */\n y: number\n}\n\n/**\n * Spread one column of labels so none overlap, each near its `ideal` y and all\n * inside `[bottom, top]`. A top-down pass clears each label from the one above\n * by `minGap`; a reverse pass lifts a tail pushed past `bottom`. When the column\n * cannot hold them all, the reverse pass wins and the crowding is shared evenly.\n * Mutates each `y` and returns `slots` ordered top to bottom.\n */\nexport function relaxLabels<T extends LabelSlot>(slots: T[], minGap: number, top: number, bottom: number): T[] {\n slots.sort((a, b) => b.ideal - a.ideal)\n\n let ceiling = top\n for (const slot of slots) {\n slot.y = Math.min(slot.ideal, ceiling)\n ceiling = slot.y - minGap\n }\n\n let floor = bottom\n for (let i = slots.length - 1; i >= 0; i--) {\n slots[i].y = Math.max(slots[i].y, floor)\n floor = slots[i].y + minGap\n }\n\n return slots\n}\n\n/** The ring's geometry: everything about the wedges but their colour. */\nexport interface RingConfig {\n /** Channel between adjacent slices in px, constant across the band (an angular gap would splay open toward the rim). */\n gap: number\n /** Below 1 a fraction of the outer radius (`0.6` leaves a band 40% thick); 1 and up a pixel radius; `0` draws solid wedges. */\n holeRadius: number\n /** Degrees clockwise from 12 o'clock where the first slice begins. */\n startAngle: number\n /** How far a selected slice's rim reaches, as a multiple of the outer radius so the emphasis scales with the chart. Clamped to `[1, 1.6]`. */\n selectedGrow: number\n /** Rounding of each wedge corner, px. */\n cornerRadius: number\n}\n\n/** How the ring's labels are set, and the leader lines that point at them. */\nexport interface LabelConfig {\n /** The category caption outside the ring. */\n textStyle: TextStyle\n /** The percentage outside the ring. */\n percentStyle: TextStyle\n /** Both lines of a label inside its wedge; its fill is set per wedge, for contrast against the paint. */\n insideStyle: TextStyle\n /** Runs from a wedge out to its label. */\n leaderStroke: Stroke\n}\n\n/** What a pie's `style` resolves to. */\nexport interface PieStyle extends ChartStyleBase {\n readonly labelText: TextStyle\n readonly valueText: TextStyle\n readonly centerText: TextStyle\n readonly innerRadius: number\n readonly sliceGap: number\n readonly sliceRadius: number\n readonly labelPlacement: PieLabelPlacement\n}\n\n/** The groups of a pie's `style`: no grid, as nothing is ruled. */\nexport const PIE_STYLE_GROUPS = {\n series: CHART_SERIES,\n background: CHART_BACKGROUND,\n text: {\n /** Each slice's name. */\n labelText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_MUTED }),\n /** Each slice's share or value, beside its name; inside a wedge both are set larger, inked for contrast. */\n valueText: Types.typography({ fontSize: 28, fontWeight: 700, fill: CHART_FOREGROUND }),\n /** The summary in the hole; its caption is set smaller, in the slice names' ink. */\n centerText: Types.typography({ fontSize: 50, fontWeight: 800, fill: CHART_FOREGROUND }),\n ...LEGEND_TEXT,\n },\n marks: {\n /** Hole radius as a fraction of the outer radius: 0 is a pie, about 0.6 a donut. */\n innerRadius: Types.number(0, { min: 0, max: 0.9, step: 0.05 }),\n /** Channel between neighbouring wedges, px. */\n sliceGap: Types.number(3, { min: 0, max: 40, step: 1, unit: \"px\" }),\n /** Rounding of each wedge corner, px. */\n sliceRadius: Types.number(4, { min: 0, max: 60, step: 1, unit: \"px\" }),\n },\n labels: {\n /** Read as the chart is built: inside the wedge, outside on a leader, or none. */\n labelPlacement: Types.oneOf([\"inside\", \"outside\", \"none\"] as const, { animatable: false }),\n },\n legend: CHART_LEGEND,\n}\n\nexport function legendOf(style: PieStyle): LegendConfig {\n return legendConfigOf(style)\n}\n\nexport function ringConfigOf(style: PieStyle): RingConfig {\n return { gap: style.sliceGap, holeRadius: style.innerRadius, startAngle: 0, selectedGrow: 1.08, cornerRadius: style.sliceRadius }\n}\n\nexport function labelConfigOf(style: PieStyle): LabelConfig {\n const base = placedText(style.labelText)\n const value = placedText(style.valueText)\n return {\n textStyle: base,\n percentStyle: value,\n insideStyle: { ...value, fontSize: Math.round(sizeOf(style.valueText) * 1.9), fill: \"#111113\" },\n leaderStroke: { weight: 2, fill: style.labelText.fill ?? \"white\" },\n }\n}\n\nexport function centerConfigOf(style: PieStyle): CenterConfig {\n const size = sizeOf(style.centerText, 50)\n return {\n labelStyle: placedText(style.centerText),\n captionStyle: placedText(style.labelText, \"center\", { fontSize: Math.round(size * 0.45) }),\n }\n}\n"]}
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/pie-chart/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAA8E,MAAM,mBAAmB,CAAA;AAErH,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,EACd,UAAU,EACV,MAAM,GAEP,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,GAAG,EAAE,IAAI,EAAqB,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,aAAa,EAAoC,MAAM,cAAc,CAAA;AAEjH,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,aAAa,EAAoC,CAAA;AAE7F;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAwC,EAAE,QAAgB,EAAE,KAAa,EAAE,OAAwB;IAClI,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC3B,QAAQ,EAAE,IAAI,CAAC,GAAY,EAAE,QAAQ,CAAC;QACtC,KAAK,EAAE,GAAG,CAAC,GAAY,EAAE,KAAK,CAAC;QAC/B,IAAI,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,OAAgB;KAC3E,CAAC,CAAC,CAAA;AACL,CAAC;AAe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AAK,CAAC,WAAW,EAAE,CAAA;AACnI,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAe;IAC3C,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACxC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACzC,OAAO;QACL,SAAS,EAAE,IAAI;QACf,YAAY,EAAE,KAAK;QACnB,WAAW,EAAE,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE;QAC/F,YAAY,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,IAAI,OAAO,EAAE;KACnE,CAAA;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAe;IAC5C,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;IACzC,OAAO;QACL,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC;QACxC,YAAY,EAAE,UAAU,CAAC,KAAK,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;KAC3F,CAAA;AACH,CAAC","sourcesContent":["import { Types, type Fill, type TextStyle, type Stroke, type FillResolved as _FillResolved } from \"@motionscript/sdk\"\n\nimport {\n CHART_BACKGROUND,\n CHART_FOREGROUND,\n CHART_LEGEND,\n CHART_MUTED,\n CHART_SERIES,\n legendConfigOf,\n placedText,\n sizeOf,\n type ChartStyleBase,\n} from \"../kit/style\"\nimport { num, text, type LegendConfig } from \"../kit/shared\"\nimport { DEG, PIE_SPOTLIGHT_DIM, ringPoint, selectionFade, type CenterConfig, type PieSlice } from \"../kit/polar\"\n\nexport { DEG, PIE_SPOTLIGHT_DIM, ringPoint, selectionFade, type CenterConfig, type PieSlice }\n\n/**\n * One slice per row, painted from `seriesFills` by row order (cycling). Paint comes\n * from the palette, not the rows, because a pie's mark is a row where a line's\n * colour belongs to a column; that lets a pie be fed a CSV of plain numbers.\n */\nexport function resolvePieSlices(data: readonly Record<string, unknown>[], category: string, value: string, palette: readonly Fill[]): PieSlice[] {\n return data.map((row, i) => ({\n category: text(row as never, category),\n value: num(row as never, value),\n fill: palette.length > 0 ? palette[i % palette.length] : (\"white\" as Fill),\n }))\n}\n\n/** What a {@link PieChart}'s labels say. */\nexport type PieLabelMode =\n /** Two lines, whose order flips with placement: an outside label reads category over percentage, an inside label reads the percentage big over a small category. */\n | \"both\"\n | \"category\"\n | \"percent\"\n /** No labels and no leader lines. */\n | \"none\"\n\n/** `\"inside\"` centres the label in the wedge's band with no leader or gutter, so the ring draws bigger; `\"outside\"` sets it on a leader, which a sliver too narrow for text needs. */\nexport type PieLabelPlacement = \"inside\" | \"outside\" | \"none\"\n\n\n/** A slice's plotted value: negatives and non-finite values count as 0. */\nexport function sliceValue(slice: PieSlice): number {\n return slice.value > 0 && Number.isFinite(slice.value) ? slice.value : 0\n}\n\n/** Sum of every slice's plotted value, the denominator of every share. */\nexport function sliceTotal(slices: PieSlice[]): number {\n let sum = 0\n for (const slice of slices) sum += sliceValue(slice)\n return sum\n}\n\n/** One slice's resolved angular span on the ring. */\nexport interface PieArc {\n /** Index of the slice in the source list. */\n index: number\n /** Radians clockwise from 12 o'clock. */\n a0: number\n a1: number\n /** Where the slice's label and pop-out point. */\n mid: number\n /** Share of the total, `[0, 1]`. */\n fraction: number\n}\n\n/**\n * One arc per positive slice, walking clockwise from `startDegrees` and abutting.\n * Arcs are the undivided shares: a fixed angular gap would pinch shut at the\n * hole, so the gap is applied when the wedge is drawn, as a constant-width inset\n * off both ends.\n */\nexport function pieArcs(slices: PieSlice[], startDegrees: number): PieArc[] {\n const total = sliceTotal(slices)\n if (total <= 0) return []\n\n const arcs: PieArc[] = []\n let cursor = startDegrees * DEG\n slices.forEach((slice, index) => {\n const value = sliceValue(slice)\n if (value <= 0) return\n const fraction = value / total\n const a0 = cursor\n const a1 = a0 + fraction * Math.PI * 2\n cursor = a1\n arcs.push({ index, a0, a1, mid: (a0 + a1) / 2, fraction })\n })\n return arcs\n}\n\ninterface LabelSlot {\n /** Where the label would sit if nothing else were in the way. */\n ideal: number\n /** Written by {@link relaxLabels}. */\n y: number\n}\n\n/**\n * Spread one column of labels so none overlap, each near its `ideal` y and all\n * inside `[bottom, top]`. A top-down pass clears each label from the one above\n * by `minGap`; a reverse pass lifts a tail pushed past `bottom`. When the column\n * cannot hold them all, the reverse pass wins and the crowding is shared evenly.\n * Mutates each `y` and returns `slots` ordered top to bottom.\n */\nexport function relaxLabels<T extends LabelSlot>(slots: T[], minGap: number, top: number, bottom: number): T[] {\n slots.sort((a, b) => b.ideal - a.ideal)\n\n let ceiling = top\n for (const slot of slots) {\n slot.y = Math.min(slot.ideal, ceiling)\n ceiling = slot.y - minGap\n }\n\n let floor = bottom\n for (let i = slots.length - 1; i >= 0; i--) {\n slots[i].y = Math.max(slots[i].y, floor)\n floor = slots[i].y + minGap\n }\n\n return slots\n}\n\n/** The ring's geometry: everything about the wedges but their colour. */\nexport interface RingConfig {\n /** Channel between adjacent slices in px, constant across the band (an angular gap would splay open toward the rim). */\n gap: number\n /** Below 1 a fraction of the outer radius (`0.6` leaves a band 40% thick); 1 and up a pixel radius; `0` draws solid wedges. */\n holeRadius: number\n /** Degrees clockwise from 12 o'clock where the first slice begins. */\n startAngle: number\n /** How far a selected slice's rim reaches, as a multiple of the outer radius so the emphasis scales with the chart. Clamped to `[1, 1.6]`. */\n selectedGrow: number\n /** Rounding of each wedge corner, px. */\n cornerRadius: number\n}\n\n/** How the ring's labels are set, and the leader lines that point at them. */\nexport interface LabelConfig {\n /** The category caption outside the ring. */\n textStyle: TextStyle\n /** The percentage outside the ring. */\n percentStyle: TextStyle\n /** Both lines of a label inside its wedge; its fill is set per wedge, for contrast against the paint. */\n insideStyle: TextStyle\n /** Runs from a wedge out to its label. */\n leaderStroke: Stroke\n}\n\n/** What a pie's `style` resolves to. */\nexport interface PieStyle extends ChartStyleBase {\n readonly labelText: TextStyle\n readonly valueText: TextStyle\n readonly centerText: TextStyle\n readonly innerRadius: number\n readonly sliceGap: number\n readonly sliceRadius: number\n readonly labelPlacement: PieLabelPlacement\n}\n\n/** The groups of a pie's `style`: no grid, as nothing is ruled. */\nexport const PIE_STYLE_GROUPS = {\n series: CHART_SERIES,\n background: CHART_BACKGROUND,\n marks: {\n /** Hole radius as a fraction of the outer radius: 0 is a pie, about 0.6 a donut. */\n innerRadius: Types.number(0, { min: 0, max: 0.9, step: 0.05 }),\n /** Channel between neighbouring wedges, px. */\n sliceGap: Types.number(3, { min: 0, max: 40, step: 1, unit: \"px\" }),\n /** Rounding of each wedge corner, px. */\n sliceRadius: Types.number(4, { min: 0, max: 60, step: 1, unit: \"px\" }),\n },\n labels: {\n /** Read as the chart is built: inside the wedge, outside on a leader, or none. */\n labelPlacement: Types.oneOf([\"inside\", \"outside\", \"none\"] as const, { animatable: false }),\n /** Each slice's name. */\n labelText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_MUTED }),\n /** Each slice's share or value, beside its name; inside a wedge both are set larger, inked for contrast. */\n valueText: Types.typography({ fontSize: 28, fontWeight: 700, fill: CHART_FOREGROUND }),\n /** The summary in the hole; its caption is set smaller, in the slice names' ink. */\n centerText: Types.typography({ fontSize: 50, fontWeight: 800, fill: CHART_FOREGROUND }),\n },\n legend: CHART_LEGEND,\n}\n\nexport function legendOf(style: PieStyle): LegendConfig {\n return legendConfigOf(style)\n}\n\nexport function ringConfigOf(style: PieStyle): RingConfig {\n return { gap: style.sliceGap, holeRadius: style.innerRadius, startAngle: 0, selectedGrow: 1.08, cornerRadius: style.sliceRadius }\n}\n\nexport function labelConfigOf(style: PieStyle): LabelConfig {\n const base = placedText(style.labelText)\n const value = placedText(style.valueText)\n return {\n textStyle: base,\n percentStyle: value,\n insideStyle: { ...value, fontSize: Math.round(sizeOf(style.valueText) * 1.9), fill: \"#111113\" },\n leaderStroke: { weight: 2, fill: style.labelText.fill ?? \"white\" },\n }\n}\n\nexport function centerConfigOf(style: PieStyle): CenterConfig {\n const size = sizeOf(style.centerText, 50)\n return {\n labelStyle: placedText(style.centerText),\n captionStyle: placedText(style.labelText, \"center\", { fontSize: Math.round(size * 0.45) }),\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  export { RadarChart, radarFractions, radarScale, type RadarValues } from "./radar-chart.js";
2
2
  export { RadarGrid } from "./radar-grid.js";
3
3
  export { RadarSeries, seriesVertices } from "./radar-series.js";
4
- export { RADAR_GRID, RADAR_MARKS, RADAR_TEXT, fitRadius, niceCeil, spokeDirection } from "./shared.js";
4
+ export { RADAR_GRID, RADAR_MARKS, fitRadius, niceCeil, spokeDirection } from "./shared.js";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/radar-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AACxF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/radar-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AACxF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA"}
@@ -1,5 +1,5 @@
1
1
  export { RadarChart, radarFractions, radarScale } from "./radar-chart.js";
2
2
  export { RadarGrid } from "./radar-grid.js";
3
3
  export { RadarSeries, seriesVertices } from "./radar-series.js";
4
- export { RADAR_GRID, RADAR_MARKS, RADAR_TEXT, fitRadius, niceCeil, spokeDirection } from "./shared.js";
4
+ export { RADAR_GRID, RADAR_MARKS, fitRadius, niceCeil, spokeDirection } from "./shared.js";
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/radar-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAoB,MAAM,eAAe,CAAA;AACxF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA","sourcesContent":["export { RadarChart, radarFractions, radarScale, type RadarValues } from \"./radar-chart\"\nexport { RadarGrid } from \"./radar-grid\"\nexport { RadarSeries, seriesVertices } from \"./radar-series\"\nexport { RADAR_GRID, RADAR_MARKS, RADAR_TEXT, fitRadius, niceCeil, spokeDirection } from \"./shared\"\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/radar-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAoB,MAAM,eAAe,CAAA;AACxF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA","sourcesContent":["export { RadarChart, radarFractions, radarScale, type RadarValues } from \"./radar-chart\"\nexport { RadarGrid } from \"./radar-grid\"\nexport { RadarSeries, seriesVertices } from \"./radar-series\"\nexport { RADAR_GRID, RADAR_MARKS, fitRadius, niceCeil, spokeDirection } from \"./shared\"\n"]}
@@ -38,14 +38,13 @@ export declare const RadarChart: import("@motionscript/sdk").Component<"radarCha
38
38
  } & {
39
39
  legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
40
40
  swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
41
+ legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
41
42
  } & {
42
43
  gridShape: import("@motionscript/sdk").Type<"circle" | "polygon", "circle" | "polygon", false>;
43
44
  gridLevels: import("@motionscript/sdk").Type<number, number, false>;
44
45
  gridStroke: import("@motionscript/sdk").Type<_Stroke, _StrokeResolved[], false>;
45
46
  spokeStroke: import("@motionscript/sdk").Type<_Stroke, _StrokeResolved[], false>;
46
47
  spokeLabels: import("@motionscript/sdk").Type<boolean, boolean, false>;
47
- } & {
48
- legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
49
48
  spokeText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
50
49
  } & {
51
50
  seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
@@ -60,14 +59,13 @@ export declare const RadarChart: import("@motionscript/sdk").Component<"radarCha
60
59
  } & {
61
60
  legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
62
61
  swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
62
+ legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
63
63
  } & {
64
64
  gridShape: import("@motionscript/sdk").Type<"circle" | "polygon", "circle" | "polygon", false>;
65
65
  gridLevels: import("@motionscript/sdk").Type<number, number, false>;
66
66
  gridStroke: import("@motionscript/sdk").Type<_Stroke, _StrokeResolved[], false>;
67
67
  spokeStroke: import("@motionscript/sdk").Type<_Stroke, _StrokeResolved[], false>;
68
68
  spokeLabels: import("@motionscript/sdk").Type<boolean, boolean, false>;
69
- } & {
70
- legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
71
69
  spokeText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
72
70
  } & {
73
71
  seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
@@ -103,14 +101,13 @@ export declare const RadarChart: import("@motionscript/sdk").Component<"radarCha
103
101
  } & {
104
102
  legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
105
103
  swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
104
+ legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
106
105
  } & {
107
106
  gridShape: import("@motionscript/sdk").Type<"circle" | "polygon", "circle" | "polygon", false>;
108
107
  gridLevels: import("@motionscript/sdk").Type<number, number, false>;
109
108
  gridStroke: import("@motionscript/sdk").Type<_Stroke, _StrokeResolved[], false>;
110
109
  spokeStroke: import("@motionscript/sdk").Type<_Stroke, _StrokeResolved[], false>;
111
110
  spokeLabels: import("@motionscript/sdk").Type<boolean, boolean, false>;
112
- } & {
113
- legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
114
111
  spokeText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
115
112
  } & {
116
113
  seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
@@ -125,14 +122,13 @@ export declare const RadarChart: import("@motionscript/sdk").Component<"radarCha
125
122
  } & {
126
123
  legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
127
124
  swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
125
+ legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
128
126
  } & {
129
127
  gridShape: import("@motionscript/sdk").Type<"circle" | "polygon", "circle" | "polygon", false>;
130
128
  gridLevels: import("@motionscript/sdk").Type<number, number, false>;
131
129
  gridStroke: import("@motionscript/sdk").Type<_Stroke, _StrokeResolved[], false>;
132
130
  spokeStroke: import("@motionscript/sdk").Type<_Stroke, _StrokeResolved[], false>;
133
131
  spokeLabels: import("@motionscript/sdk").Type<boolean, boolean, false>;
134
- } & {
135
- legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
136
132
  spokeText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
137
133
  } & {
138
134
  seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
@@ -157,14 +153,13 @@ export declare const RadarChart: import("@motionscript/sdk").Component<"radarCha
157
153
  } & {
158
154
  legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
159
155
  swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
156
+ legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
160
157
  } & {
161
158
  gridShape: import("@motionscript/sdk").Type<"circle" | "polygon", "circle" | "polygon", false>;
162
159
  gridLevels: import("@motionscript/sdk").Type<number, number, false>;
163
160
  gridStroke: import("@motionscript/sdk").Type<_Stroke, _StrokeResolved[], false>;
164
161
  spokeStroke: import("@motionscript/sdk").Type<_Stroke, _StrokeResolved[], false>;
165
162
  spokeLabels: import("@motionscript/sdk").Type<boolean, boolean, false>;
166
- } & {
167
- legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
168
163
  spokeText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
169
164
  } & {
170
165
  seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
@@ -179,14 +174,13 @@ export declare const RadarChart: import("@motionscript/sdk").Component<"radarCha
179
174
  } & {
180
175
  legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
181
176
  swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
177
+ legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
182
178
  } & {
183
179
  gridShape: import("@motionscript/sdk").Type<"circle" | "polygon", "circle" | "polygon", false>;
184
180
  gridLevels: import("@motionscript/sdk").Type<number, number, false>;
185
181
  gridStroke: import("@motionscript/sdk").Type<_Stroke, _StrokeResolved[], false>;
186
182
  spokeStroke: import("@motionscript/sdk").Type<_Stroke, _StrokeResolved[], false>;
187
183
  spokeLabels: import("@motionscript/sdk").Type<boolean, boolean, false>;
188
- } & {
189
- legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
190
184
  spokeText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
191
185
  } & {
192
186
  seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
@@ -1 +1 @@
1
- {"version":3,"file":"radar-chart.d.ts","sourceRoot":"","sources":["../../src/radar-chart/radar-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,UAAU,EACf,KAAK,MAAM,EAEX,KAAK,MAAM,EACX,KAAK,WAAW,IAAI,YAAY,EAChC,KAAK,SAAS,IAAI,UAAU,EAC5B,KAAK,IAAI,IAAI,KAAK,EAClB,KAAK,YAAY,IAAI,aAAa,EAClC,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,cAAc,IAAI,eAAe,EAGvC,MAAM,mBAAmB,CAAA;AAM1B,OAAO,EAAiB,KAAK,WAAW,E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T_DIM } from "../kit/shared.js";
7
7
  import { CHART_LEGEND, CHART_SERIES, CHART_STYLE_FAMILY, CHART_STYLE_PRESETS, GRID_BACKGROUND, legendConfigOf, migrateChartStyle, placedText, seriesFill, sizeOf, } from "../kit/style.js";
8
8
  import { RadarGrid } from "./radar-grid.js";
9
9
  import { RadarSeries } from "./radar-series.js";
10
- import { RADAR_GRID, RADAR_TEXT, RADAR_MARKS, categoriesOf, fitRadius, fractionOf, labelAnchor, labelPoint, scaleOf, valuesOf, } from "./shared.js";
10
+ import { RADAR_GRID, RADAR_MARKS, categoriesOf, fitRadius, fractionOf, labelAnchor, labelPoint, scaleOf, valuesOf, } from "./shared.js";
11
11
  /** The scale the web is drawn to, whether `max` was given or left to the data. */
12
12
  export function radarScale(state) {
13
13
  return scaleOf(valuesOf(state.data, state.series), state.min, state.max);
@@ -75,7 +75,6 @@ export const RadarChart = component2d({
75
75
  style: Types.style(CHART_STYLE_FAMILY, {
76
76
  series: CHART_SERIES,
77
77
  background: GRID_BACKGROUND,
78
- text: RADAR_TEXT,
79
78
  grid: RADAR_GRID,
80
79
  marks: RADAR_MARKS,
81
80
  legend: CHART_LEGEND,