@motionscript/charts 0.0.0-stage → 0.1.0-alpha.0
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.
- package/CHANGELOG.md +5 -0
- package/LICENSE +201 -0
- package/dist/bar-chart/bar-chart.d.ts +286 -0
- package/dist/bar-chart/bar-chart.d.ts.map +1 -0
- package/dist/bar-chart/bar-chart.js +610 -0
- package/dist/bar-chart/bar-chart.js.map +1 -0
- package/dist/bar-chart/category-axis.d.ts +77 -0
- package/dist/bar-chart/category-axis.d.ts.map +1 -0
- package/dist/bar-chart/category-axis.js +141 -0
- package/dist/bar-chart/category-axis.js.map +1 -0
- package/dist/bar-chart/chart-bars.d.ts +149 -0
- package/dist/bar-chart/chart-bars.d.ts.map +1 -0
- package/dist/bar-chart/chart-bars.js +236 -0
- package/dist/bar-chart/chart-bars.js.map +1 -0
- package/dist/bar-chart/index.d.ts +16 -0
- package/dist/bar-chart/index.d.ts.map +1 -0
- package/dist/bar-chart/index.js +12 -0
- package/dist/bar-chart/index.js.map +1 -0
- package/dist/bar-chart/shared.d.ts +146 -0
- package/dist/bar-chart/shared.d.ts.map +1 -0
- package/dist/bar-chart/shared.js +182 -0
- package/dist/bar-chart/shared.js.map +1 -0
- package/dist/browser/chunks/chunk-ZMBOBHYL.js +2 -0
- package/dist/browser/chunks/chunk-ZMBOBHYL.js.map +7 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/browser/kit.js +2 -0
- package/dist/browser/kit.js.map +7 -0
- package/dist/browser/manifest.json +12 -0
- package/dist/engine.d.ts +27 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +27 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/kit/chart-border.d.ts +28 -0
- package/dist/kit/chart-border.d.ts.map +1 -0
- package/dist/kit/chart-border.js +45 -0
- package/dist/kit/chart-border.js.map +1 -0
- package/dist/kit/chart-canvas.d.ts +56 -0
- package/dist/kit/chart-canvas.d.ts.map +1 -0
- package/dist/kit/chart-canvas.js +125 -0
- package/dist/kit/chart-canvas.js.map +1 -0
- package/dist/kit/chart-legend.d.ts +126 -0
- package/dist/kit/chart-legend.d.ts.map +1 -0
- package/dist/kit/chart-legend.js +212 -0
- package/dist/kit/chart-legend.js.map +1 -0
- package/dist/kit/shared.d.ts +251 -0
- package/dist/kit/shared.d.ts.map +1 -0
- package/dist/kit/shared.js +401 -0
- package/dist/kit/shared.js.map +1 -0
- package/dist/kit/vertical-axis.d.ts +99 -0
- package/dist/kit/vertical-axis.d.ts.map +1 -0
- package/dist/kit/vertical-axis.js +176 -0
- package/dist/kit/vertical-axis.js.map +1 -0
- package/dist/line-chart/chart-line.d.ts +91 -0
- package/dist/line-chart/chart-line.d.ts.map +1 -0
- package/dist/line-chart/chart-line.js +156 -0
- package/dist/line-chart/chart-line.js.map +1 -0
- package/dist/line-chart/chart-region.d.ts +47 -0
- package/dist/line-chart/chart-region.d.ts.map +1 -0
- package/dist/line-chart/chart-region.js +101 -0
- package/dist/line-chart/chart-region.js.map +1 -0
- package/dist/line-chart/horizontal-axis.d.ts +85 -0
- package/dist/line-chart/horizontal-axis.d.ts.map +1 -0
- package/dist/line-chart/horizontal-axis.js +158 -0
- package/dist/line-chart/horizontal-axis.js.map +1 -0
- package/dist/line-chart/index.d.ts +22 -0
- package/dist/line-chart/index.d.ts.map +1 -0
- package/dist/line-chart/index.js +19 -0
- package/dist/line-chart/index.js.map +1 -0
- package/dist/line-chart/line-chart.d.ts +347 -0
- package/dist/line-chart/line-chart.d.ts.map +1 -0
- package/dist/line-chart/line-chart.js +701 -0
- package/dist/line-chart/line-chart.js.map +1 -0
- package/dist/line-chart/shared.d.ts +171 -0
- package/dist/line-chart/shared.d.ts.map +1 -0
- package/dist/line-chart/shared.js +270 -0
- package/dist/line-chart/shared.js.map +1 -0
- package/dist/line-chart/x-scale.d.ts +84 -0
- package/dist/line-chart/x-scale.d.ts.map +1 -0
- package/dist/line-chart/x-scale.js +302 -0
- package/dist/line-chart/x-scale.js.map +1 -0
- package/dist/nodes.d.ts +20 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +20 -0
- package/dist/nodes.js.map +1 -0
- package/dist/pie-chart/index.d.ts +18 -0
- package/dist/pie-chart/index.d.ts.map +1 -0
- package/dist/pie-chart/index.js +14 -0
- package/dist/pie-chart/index.js.map +1 -0
- package/dist/pie-chart/pie-chart.d.ts +170 -0
- package/dist/pie-chart/pie-chart.d.ts.map +1 -0
- package/dist/pie-chart/pie-chart.js +291 -0
- package/dist/pie-chart/pie-chart.js.map +1 -0
- package/dist/pie-chart/pie-legend.d.ts +60 -0
- package/dist/pie-chart/pie-legend.d.ts.map +1 -0
- package/dist/pie-chart/pie-legend.js +131 -0
- package/dist/pie-chart/pie-legend.js.map +1 -0
- package/dist/pie-chart/pie-ring.d.ts +266 -0
- package/dist/pie-chart/pie-ring.d.ts.map +1 -0
- package/dist/pie-chart/pie-ring.js +708 -0
- package/dist/pie-chart/pie-ring.js.map +1 -0
- package/dist/pie-chart/shared.d.ts +210 -0
- package/dist/pie-chart/shared.d.ts.map +1 -0
- package/dist/pie-chart/shared.js +240 -0
- package/dist/pie-chart/shared.js.map +1 -0
- package/package.json +69 -3
- package/registry.json +23 -0
- package/src/bar-chart/bar-chart.ts +804 -0
- package/src/bar-chart/category-axis.ts +177 -0
- package/src/bar-chart/chart-bars.ts +310 -0
- package/src/bar-chart/index.ts +31 -0
- package/src/bar-chart/shared.ts +354 -0
- package/src/engine.ts +26 -0
- package/src/index.ts +5 -0
- package/src/kit/chart-border.ts +61 -0
- package/src/kit/chart-canvas.ts +157 -0
- package/src/kit/chart-legend.ts +250 -0
- package/src/kit/shared.ts +675 -0
- package/src/kit/vertical-axis.ts +224 -0
- package/src/line-chart/chart-line.ts +208 -0
- package/src/line-chart/chart-region.ts +135 -0
- package/src/line-chart/horizontal-axis.ts +202 -0
- package/src/line-chart/index.ts +39 -0
- package/src/line-chart/line-chart.ts +894 -0
- package/src/line-chart/shared.ts +459 -0
- package/src/line-chart/x-scale.ts +367 -0
- package/src/nodes.ts +20 -0
- package/src/pie-chart/index.ts +37 -0
- package/src/pie-chart/pie-chart.ts +374 -0
- package/src/pie-chart/pie-legend.ts +159 -0
- package/src/pie-chart/pie-ring.ts +903 -0
- package/src/pie-chart/shared.ts +490 -0
- package/README.md +0 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie-ring.js","sourceRoot":"","sources":["../../src/pie-chart/pie-ring.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,IAAI,EACJ,OAAO,EAEP,UAAU,EACV,MAAM,EACN,WAAW,EACX,IAAI,EACJ,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,OAAO,GASR,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,EACL,uBAAuB,EACvB,OAAO,EACP,WAAW,EACX,SAAS,GAQV,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAuD5D,2EAA2E;AAC3E,MAAM,SAAS,GAAG,EAAE,CAAA;AACpB,2FAA2F;AAC3F,MAAM,SAAS,GAAG,EAAE,CAAA;AACpB,kFAAkF;AAClF,MAAM,WAAW,GAAG,IAAI,CAAA;AACxB,8EAA8E;AAC9E,MAAM,cAAc,GAAG,CAAC,CAAA;AACxB,gFAAgF;AAChF,MAAM,aAAa,GAAG,EAAE,CAAA;AACxB,yDAAyD;AACzD,MAAM,UAAU,GAAG,EAAE,CAAA;AACrB,yEAAyE;AACzE,MAAM,UAAU,GAAG,CAAC,CAAA;AACpB;;;;GAIG;AACH,MAAM,SAAS,GAAG,IAAI,CAAA;AACtB,+EAA+E;AAC/E,MAAM,SAAS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Q,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;+CAA0C;AACxC;IAAjC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;uCAAuB;AACd;IAAjC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;4CAA4B;AACA;IAApD,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAc,EAAE,CAAC;qCAAuB;AAE3D;IADP,QAAQ,CAAC,EAAE,OAAO,EAAE,uBAAuB,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;2CAC1C;AACS;IAAlC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;4CAA4B;AACnB;IAAlC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;8CAA8B;AACtB;IAAjC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;6CAA6B;AA+kBtD;IADC,OAAO,EAAE;oCAOT;AAID;IADC,OAAO,EAAE;2CAKT;AAQD;IADC,OAAO,EAAE;2CAUT","sourcesContent":["import {\n Rect,\n command,\n type AssetScope,\n Graphics2D,\n Node2D,\n PathBuilder,\n Text,\n easeOut,\n fillOps,\n property,\n strokeOps,\n textOps,\n type Command,\n type CommandArgs,\n type FillResolved,\n type NodeConfig,\n type Node2DProps,\n type RenderContext2D,\n type TextStyle,\n type Vector2,\n} from \"@motionscript/core\"\n\nimport { clampUnit, formatPercent } from \"../kit/shared\"\nimport {\n DEFAULT_PIE_CHART_THEME,\n pieArcs,\n relaxLabels,\n ringPoint,\n type CenterConfig,\n type LabelConfig,\n type PieArc,\n type PieLabelMode,\n type PieLabelPlacement,\n type PieSlice,\n type RingConfig,\n} from \"./shared\"\nimport { declarePaints } from \"@motionscript/core/component\"\n\nexport interface PieRingProps extends Node2DProps {\n /** One entry per slice: its `category`, `value` and `fill`. */\n slices: PieSlice[]\n /** Ring geometry and paint — gap, hole, start angle, selection growth. */\n ring: RingConfig\n /** How the labels are set, and the leader lines that point at them. */\n label: LabelConfig\n /**\n * How the hole's summary is set.\n *\n * Named `centerStyle` rather than `center` because every node already has a\n * `center` — the anchor its position is measured from.\n */\n centerStyle: CenterConfig\n /** What the labels say, or `\"none\"` to drop them entirely. */\n labelMode: PieLabelMode\n /** Where the labels sit: inside their wedge, outside on a leader, or nowhere. */\n labelPlacement: PieLabelPlacement\n /**\n * Sweep of the ring in `[0, 1]`: 0 draws nothing, 1 the full circle. The\n * wedges grow around clockwise from the ring's `startAngle` as this rises.\n */\n growth: number\n /**\n * Fade of the leader lines and labels in `[0, 1]`, held separate from\n * {@link growth} so they arrive *after* the ring has swept in.\n */\n labelReveal: number\n /**\n * How far each slice is currently pushed out of the ring, `0`–`1` per index.\n * Owned by the chart, so the ring and the legend read one signal.\n */\n pops: number[]\n /** Opacity everything *unselected* falls back to while any slice is selected. */\n dimOpacity: number\n /**\n * Text set in the middle of the ring's hole — the largest uninterrupted area\n * the chart owns, and on a donut otherwise empty. A one-line summary there\n * routinely does more work than the whole ring around it. Empty (the default)\n * leaves the hole clear; ignored when there is no hole.\n */\n centerLabel: string\n /** Smaller second line under {@link centerLabel}. Empty (the default) drops it. */\n centerCaption: string\n /**\n * Fade of the hole's summary in `[0, 1]`. Its own signal, untouched by the\n * ring's entrance — a hole label is usually a *conclusion*, so a scene that\n * wants it to land on a later beat sets this to 0 and calls\n * `PieChart.revealCenter` when it gets there.\n */\n centerReveal: number\n}\n\n/** Vertical breathing room between one label block and the next, in px. */\nconst LABEL_GAP = 12\n/** Breathing room past the outermost label, so it never touches the node's edge, in px. */\nconst LABEL_PAD = 14\n/** Rough width of one glyph as a fraction of the font size, for gutter sizing. */\nconst GLYPH_RATIO = 0.62\n/** Gap between a wedge's outer edge and where its leader lifts off, in px. */\nconst LEADER_LIFTOFF = 6\n/** How far past the ring's outer edge a leader runs before it elbows, in px. */\nconst LEADER_LENGTH = 34\n/** Horizontal run from the elbow to the label, in px. */\nconst LABEL_STUB = 26\n/** Gap between a leader's end and the label text it points at, in px. */\nconst TEXT_INSET = 8\n/**\n * Floor on the elbow's horizontal distance from the ring's axis, as a fraction\n * of the leader radius — so a label pushed clear above (or below) the ring still\n * elbows out sideways rather than running straight down the 12 o'clock line.\n */\nconst MIN_ELBOW = 0.18\n/** Segments used to tessellate a full turn of arc; a wedge takes its share. */\nconst ARC_STEPS = 240\n/** Rounding applied to the leader's elbow, in px. */\nconst ELBOW_RADIUS = 8\n/** Side padding used when nothing is leadered out — no gutter to reserve. */\nconst BARE_PAD = 2\n/** An inside label's caption size, as a fraction of its leading line. */\nconst INSIDE_CAPTION_RATIO = 0.44\n/**\n * Where an inside label sits on a **solid pie** (no hole to split the band\n * with), as a fraction of the wedge's radius — far enough out that the label\n * clears the point every wedge converges on.\n */\nconst PIE_LABEL_RADIUS = 0.62\n/** Fraction of the hole's diameter its summary is allowed to run to. */\nconst CENTER_LABEL_FIT = 0.78\n/** Fraction of the room inside a wedge that its label is allowed to run to. */\nconst INSIDE_LABEL_FIT = 0.9\n/** Below this, a wedge's bisector counts as axis-aligned and that term stops binding. */\nconst AXIS_EPSILON = 1e-3\n/** Fallback type size when a theme style leaves it unset or on autofit. */\nconst FALLBACK_SIZE = 26\n\n/** A style's numeric size, guarding the autofit and unset cases. */\nfunction sizeOf(style: TextStyle, fallback = FALLBACK_SIZE): number {\n const size = style.fontSize\n return typeof size === \"number\" ? size : fallback\n}\n\n/** Where one slice's label sits and the polyline that points at it. */\ninterface LabelPlacement {\n /** Index of the slice. */\n index: number\n /** Which side of the ring the label sits on: +1 right, −1 left. */\n side: 1 | -1\n /** Leader polyline: wedge edge → elbow → label. */\n leader: Vector2[]\n /** Point the label's inner edge is pinned to. */\n text: Vector2\n}\n\n/**\n * A ring-band wedge over `a0`→`a1` (radians, clockwise from 12 o'clock) spanning\n * `rInner`→`rOuter`, centred on `cx`. Ring wedges trace the outer arc, step in,\n * and trace the inner arc back; full pie wedges (`rInner <= 0`) close through the\n * centre.\n *\n * `halfGap` is **half the gap to the neighbouring slice, in px**, shaved off both\n * ends of the wedge. It's converted to an angle *per radius* (`halfGap / r` — a\n * wider angle near the hole than out at the rim), which is what keeps the channel\n * between two slices the same width all the way across the band. A fixed angular\n * gap instead reads as a thin pizza slice: right at the rim, pinched shut at the\n * hole. The inset is capped at the wedge's own half-span so a sliver of a slice\n * narrows to nothing rather than turning inside out.\n */\nfunction wedgePath(\n a0: number,\n a1: number,\n rInner: number,\n rOuter: number,\n halfGap: number,\n cx: number\n): PathBuilder {\n const path = new PathBuilder()\n const span = a1 - a0\n const steps = Math.max(\n 2,\n Math.ceil((Math.abs(span) / (Math.PI * 2)) * ARC_STEPS)\n )\n /** Angular inset at radius `r` that puts the wedge's edge `halfGap` px off the divide. */\n const insetAt = (r: number): number =>\n r <= 0 ? 0 : Math.min(halfGap / r, span / 2.2)\n const arcTo = (r: number, i: number): Vector2 => {\n const inset = insetAt(r)\n const from = a0 + inset\n const to = a1 - inset\n const point = ringPoint(r, from + ((to - from) * i) / steps)\n return { x: point.x + cx, y: point.y }\n }\n\n if (rInner <= 0) {\n // Solid pie wedge: the sides converge on the centre, so only the outer rim\n // carries the gap.\n path.moveTo(cx, 0)\n for (let i = 0; i <= steps; i++) {\n const p = arcTo(rOuter, i)\n path.lineTo(p.x, p.y)\n }\n path.close()\n return path\n }\n\n for (let i = 0; i <= steps; i++) {\n const p = arcTo(rOuter, i)\n if (i === 0) path.moveTo(p.x, p.y)\n else path.lineTo(p.x, p.y)\n }\n // Back along the inner arc — its own (wider) inset makes each side edge a\n // straight chord sitting `halfGap` px off the divide at both ends.\n for (let i = steps; i >= 0; i--) {\n const p = arcTo(rInner, i)\n path.lineTo(p.x, p.y)\n }\n path.close()\n return path\n}\n\n/**\n * The ring itself: one wedge per {@link PieSlice}, sized by its share of the\n * total, swept clockwise from the theme's `startAngle` with a `gap` of clear\n * space between neighbours — a *constant-width* channel, the same at the hole as\n * at the rim (see {@link wedgePath}). A **selected** slice reaches further out\n * while its hole edge stays put — so it reads as that band swelling out of the\n * ring rather than breaking off it — and the rest of the ring dims behind it,\n * leaders and labels included.\n *\n * This is the only part of the chart family that draws a path: the wedges are\n * filled {@link PathBuilder} polygons approximating each arc, and the leaders are\n * stroked polylines — both in the node's centred, y-up space, so neither depends\n * on SVG arc-sweep conventions. The **labels are real {@link Text} nodes**\n * (stacked in a hug vertical flow and pinned by their inner edge), so no\n * glyph-width guesswork decides where a caption starts.\n *\n * ### Label placement\n * Each label sits either **inside** its wedge or **outside** on a leader.\n *\n * An inside label is centred on its slice's band and leads with the number, the\n * caption set small underneath — inside a wedge the reader already knows which\n * slice they're on, so the magnitude is the thing being read. It costs no gutter\n * and no eye round-trip, so a ring labelled that way draws considerably bigger in\n * the same box.\n *\n * A leader label sits outside on the end of a polyline that lifts off its wedge,\n * elbows, and runs horizontally into the text. Labels are split into a left and a\n * right column by which way their slice's bisector points, and each column is\n * de-conflicted independently (see {@link relaxLabels}): a label takes the spot\n * nearest its wedge that still clears its neighbour, and the column is squeezed\n * to fit the node's height rather than spilling out of it. The elbow then rides on\n * a circle just outside the ring **at the label's settled y**, so the run into the\n * text is always horizontal and a nudged label never drags its leader back across\n * the ring.\n *\n * Only the sides that actually carry a leader reserve a gutter, and the ring's\n * centre slides into whatever the other side left over ({@link centerX}) — so a\n * ring whose slices all leader one way doesn't leave a bald patch on the other.\n */\nexport class PieRing extends Node2D<PieRingProps> {\n @property({ default: () => [] as PieSlice[] }) declare slices: PieSlice[]\n @property({ default: DEFAULT_PIE_CHART_THEME.ring }) declare ring: RingConfig\n @property({ default: DEFAULT_PIE_CHART_THEME.label })\n declare label: LabelConfig\n @property({ default: DEFAULT_PIE_CHART_THEME.center })\n declare centerStyle: CenterConfig\n @property({ default: \"percent\" }) declare labelMode: PieLabelMode\n @property({ default: \"leader\" }) declare labelPlacement: PieLabelPlacement\n @property({ default: 1 }) declare growth: number\n @property({ default: 1 }) declare labelReveal: number\n @property({ default: () => [] as number[] }) declare pops: number[]\n @property({ default: DEFAULT_PIE_CHART_THEME.spotlight.dimOpacity })\n declare dimOpacity: number\n @property({ default: \"\" }) declare centerLabel: string\n @property({ default: \"\" }) declare centerCaption: string\n @property({ default: 1 }) declare centerReveal: number\n\n /** Each slice's fill, resolved once so `renderSelf` doesn't re-resolve every frame. */\n private fills: FillResolved[][] = []\n\n constructor(props?: NodeConfig<PieRing, PieRingProps>) {\n super(props)\n\n this.fills = this.slices.map((slice) => fillOps.resolve(slice.fill))\n\n // One label per *drawn* slice (a zero-valued slice gets no wedge, so no\n // label either), in whichever of the two forms the chart asked for. Both are\n // real Text stacked in a hug vertical flow — the difference is only what they are\n // pinned to and which line leads.\n //\n // The *point* each label is pinned to stays reactive and follows the ring as\n // the box resizes or its slice pops out; only the choice of form, which\n // depends on props alone, is settled here.\n if (this.labelPlacement !== \"none\" && this.labelMode !== \"none\") {\n for (const arc of this.arcs) this.addLabel(arc)\n }\n\n // The hole's summary, pinned to the ring's centre so it tracks the sideways\n // shift a one-sided label column puts on the ring.\n if (this.hasCenterLabel) this.addCenterLabel()\n }\n\n /** Build slice `arc`'s label, in whichever form the chart's placement asks for. */\n private addLabel(arc: PieArc): void {\n const slice = this.slices[arc.index]\n // Fades in with the ring's labels, then dims along with its own slice\n // whenever another slice takes the focus.\n const opacity = () =>\n clampUnit(this.labelReveal) * this.sliceOpacity(arc.index)\n const wantsCategory =\n this.labelMode === \"both\" || this.labelMode === \"category\"\n const wantsPercent =\n this.labelMode === \"both\" || this.labelMode === \"percent\"\n\n if (this.labelPlacement === \"inside\") {\n // The number leads and the caption sits under it: inside a wedge the\n // reader already knows *which* wedge they are looking at, so the magnitude\n // is what the label is for. Both sizes are bound rather than read once —\n // the fitted size derives from the ring's radius, which isn't known until\n // the node has been laid out.\n const inside: Node2D[] = []\n if (wantsPercent) {\n inside.push(\n new Text({\n ...textOps.styleProps(this.label.insideStyle),\n text: formatPercent(arc.fraction),\n fontSize: () => this.insideFont,\n })\n )\n }\n if (wantsCategory) {\n inside.push(\n new Text({\n ...textOps.styleProps(this.label.insideStyle),\n text: slice.category,\n fontSize: () =>\n this.labelMode === \"category\"\n ? this.insideFont\n : this.insideFont * INSIDE_CAPTION_RATIO,\n })\n )\n }\n this.add(\n new Rect({ flow: \"vertical\",\n width: \"hug\",\n height: \"hug\",\n gap: 0,\n align: \"center\",\n opacity,\n center: () => this.insideAnchor(arc.index),\n children: inside,\n })\n )\n return\n }\n\n const side = this.sideOf(arc.mid)\n const at = () => this.placementFor(arc.index)?.text ?? { x: 0, y: 0 }\n const children: Node2D[] = []\n if (wantsCategory) {\n children.push(\n new Text({\n ...textOps.styleProps(this.label.textStyle),\n text: slice.category,\n textAlign: side > 0 ? \"left\" : \"right\",\n })\n )\n }\n if (wantsPercent) {\n children.push(\n new Text({\n ...textOps.styleProps(this.label.percentStyle),\n text: formatPercent(arc.fraction),\n textAlign: side > 0 ? \"left\" : \"right\",\n })\n )\n }\n this.add(\n new Rect({ flow: \"vertical\",\n width: \"hug\",\n height: \"hug\",\n gap: 2,\n align: side > 0 ? \"centerLeft\" : \"centerRight\",\n opacity,\n // Exactly one of these is set; `undefined` anchors are ignored.\n centerLeft: side > 0 ? at : undefined,\n centerRight: side > 0 ? undefined : at,\n children,\n })\n )\n }\n\n /** Build the hole's summary block. */\n private addCenterLabel(): void {\n const children: Node2D[] = []\n if (this.centerLabel !== \"\") {\n children.push(\n new Text({\n ...textOps.styleProps(this.centerStyle.labelStyle),\n text: this.centerLabel,\n fontSize: () => this.centerFont,\n })\n )\n }\n if (this.centerCaption !== \"\") {\n children.push(\n new Text({\n ...textOps.styleProps(this.centerStyle.captionStyle),\n text: this.centerCaption,\n fontSize: () =>\n this.centerFont *\n (sizeOf(this.centerStyle.captionStyle, 22) /\n sizeOf(this.centerStyle.labelStyle, 46)),\n })\n )\n }\n this.add(\n new Rect({ flow: \"vertical\",\n width: \"hug\",\n height: \"hug\",\n gap: 2,\n align: \"center\",\n opacity: () => clampUnit(this.centerReveal),\n center: () => ({ x: this.centerX, y: 0 }),\n children,\n })\n )\n }\n\n // ---- Arcs --------------------------------------------------------------\n\n /** The drawn slices' angular spans, re-read every frame so a value tween re-cuts them. */\n private get arcs(): PieArc[] {\n return pieArcs(this.slices, this.ring.startAngle)\n }\n\n /** Which side a leader off bisector `mid` runs to: +1 right, −1 left. */\n private sideOf(mid: number): 1 | -1 {\n return Math.sin(mid) >= 0 ? 1 : -1\n }\n\n /** Whether any slice is labelled on a leader — the only thing that costs a gutter. */\n private get hasLeaderLabels(): boolean {\n return (\n this.labelPlacement === \"leader\" &&\n this.labelMode !== \"none\" &&\n this.arcs.length > 0\n )\n }\n\n // ---- Label sizing ------------------------------------------------------\n\n /**\n * How wide a horizontal label centred in slice `arc`'s band can run before it\n * leaves the wedge, in px.\n *\n * Two things bound it, and which one binds depends entirely on where the wedge\n * sits. Stepping sideways from the label's centre moves you *radially* by\n * `dx·sin(mid)` and *tangentially* by `dx·cos(mid)`, so a wedge at 3 o'clock is\n * limited by the band's thickness (its label runs straight across the band)\n * while a wedge at 12 o'clock is limited by its own arc (its label runs along\n * the band, which is much roomier). Taking the smaller of the two is what stops\n * a label overflowing the ring on one chart and being pointlessly shrunk on the\n * next.\n *\n * Measured off the *unpopped* radius, so a slice growing out of the ring\n * doesn't resize its own text mid-animation.\n */\n private insideRoom(arc: PieArc): number {\n const outer = this.outerRadius\n const hole = this.holeRadius\n const band = hole > 0 ? outer - hole : outer * (1 - PIE_LABEL_RADIUS) * 2\n const mid = hole > 0 ? (hole + outer) / 2 : outer * PIE_LABEL_RADIUS\n const sin = Math.abs(Math.sin(arc.mid))\n const cos = Math.abs(Math.cos(arc.mid))\n const acrossBand = sin > AXIS_EPSILON ? band / sin : Infinity\n const alongArc = cos > AXIS_EPSILON ? ((arc.a1 - arc.a0) * mid) / cos : Infinity\n return Math.max(0, Math.min(acrossBand, alongArc))\n }\n\n /** Widest line, in glyphs at the leading line's size, an inside label runs to. */\n private insideGlyphs(arc: PieArc): number {\n const category = this.slices[arc.index]?.category.length ?? 0\n const percent =\n this.labelMode === \"both\" || this.labelMode === \"percent\"\n ? formatPercent(arc.fraction).length\n : 0\n // The caption is set at a fraction of the leading line, except when it *is*\n // the leading line.\n const caption =\n this.labelMode === \"category\"\n ? category\n : this.labelMode === \"both\"\n ? category * INSIDE_CAPTION_RATIO\n : 0\n return Math.max(1, percent, caption)\n }\n\n /**\n * Font size of an inside label's leading line: what the theme asked for,\n * shrunk if that wouldn't fit inside its wedge. **One size across every inside\n * label** — the smallest any of them needs — because labels at mismatched\n * sizes read as a mistake rather than as emphasis.\n *\n * So the theme's `insideStyle.fontSize` is an upper bound, not a promise: ask\n * for the size the chart wants and the ring keeps it legal.\n */\n private get insideFont(): number {\n let size = sizeOf(this.label.insideStyle, FALLBACK_SIZE * 1.9)\n for (const arc of this.arcs) {\n const fits =\n (this.insideRoom(arc) * INSIDE_LABEL_FIT) /\n (this.insideGlyphs(arc) * GLYPH_RATIO)\n size = Math.min(size, fits)\n }\n return Math.max(1, size)\n }\n\n /** Whether the hole carries a summary at all. */\n private get hasCenterLabel(): boolean {\n return this.centerLabel !== \"\" || this.centerCaption !== \"\"\n }\n\n /**\n * Font size of the hole's summary: the configured size, capped so it still\n * fits across the hole. The cap matters because the hole's radius derives from\n * the box, so a chart that reflows smaller would otherwise push its summary out\n * through the ring.\n */\n private get centerFont(): number {\n const wanted = sizeOf(this.centerStyle.labelStyle, 46)\n const hole = this.holeRadius\n if (hole <= 0) return wanted\n const captionRatio =\n sizeOf(this.centerStyle.captionStyle, 22) / Math.max(1, wanted)\n // Both lines have to clear the hole, and the caption is set at a fraction of\n // this size — so what binds is whichever is wider once drawn, not whichever\n // has more characters.\n const glyphs = Math.max(\n 1,\n this.centerLabel.length,\n this.centerCaption.length * captionRatio\n )\n return Math.min(wanted, (hole * 2 * CENTER_LABEL_FIT) / (glyphs * GLYPH_RATIO))\n }\n\n // ---- Ring geometry, all derived from layoutBounds ------------------------\n\n /** Rim radius of a fully selected slice as a multiple of the ring's, clamped sane. */\n private get growFactor(): number {\n return Math.max(1, Math.min(1.6, this.ring.selectedGrow))\n }\n\n /** How far past the ring's rim a fully selected slice reaches, in px. */\n private get maxPop(): number {\n return this.outerRadius * (this.growFactor - 1)\n }\n\n /** Height of one **leader** label block, in px — the unit those columns are spaced by. */\n private get labelRowHeight(): number {\n // Inside labels are stacked in the band, not in a column beside the ring, so\n // they cost no vertical reserve.\n if (!this.hasLeaderLabels) return 0\n const caption = sizeOf(this.label.textStyle) * 1.25\n const percent = sizeOf(this.label.percentStyle) * 1.25\n if (this.labelMode === \"both\") return caption + percent + 2\n return this.labelMode === \"category\" ? caption : percent\n }\n\n /** Widest line, in glyphs, that a leader label for slice `index` can run to. */\n private captionGlyphs(index: number): number {\n // \"100%\" is the widest a percentage gets; captions are their own length.\n const percent =\n this.labelMode === \"percent\" || this.labelMode === \"both\" ? 4 : 0\n const category =\n this.labelMode === \"category\" || this.labelMode === \"both\"\n ? (this.slices[index]?.category.length ?? 0)\n : 0\n return Math.max(percent, category)\n }\n\n /**\n * Horizontal room reserved on each side for the leaders and their labels, in\n * px — measured **per side**, from the slices that actually leader out that\n * way. A ring whose labels are all inside reserves nothing and draws bigger.\n *\n * Excludes the ring's own selection-growth allowance, which scales with the\n * radius and so is divided out in {@link outerRadius} instead.\n */\n private get labelGutters(): { left: number; right: number } {\n const gutters = { left: BARE_PAD, right: BARE_PAD }\n if (!this.hasLeaderLabels) return gutters\n const glyph = sizeOf(this.label.textStyle) * GLYPH_RATIO\n for (const arc of this.arcs) {\n const room =\n LEADER_LENGTH +\n LABEL_STUB +\n TEXT_INSET +\n this.captionGlyphs(arc.index) * glyph +\n LABEL_PAD\n const key = this.sideOf(arc.mid) > 0 ? \"right\" : \"left\"\n gutters[key] = Math.max(gutters[key], room)\n }\n return gutters\n }\n\n /**\n * How far the ring's centre sits from the node's, in px. Zero while the\n * gutters match; when the labels all fall one way it slides the ring into the\n * empty half so the ring-plus-labels group stays centred in the box instead of\n * the ring sitting dead centre with a bald patch beside it.\n */\n private get centerX(): number {\n const { left, right } = this.labelGutters\n return (left - right) / 2\n }\n\n /**\n * Radius of the ring's outer edge, fitted to whatever the label gutters leave.\n * A fully selected slice reaches `radius × growFactor`, so the room has to\n * cover that — hence the divisor, which keeps even the grown slice inside the\n * box (and holds the ring the same size whether or not anything is selected).\n */\n private get outerRadius(): number {\n const { left, right } = this.labelGutters\n const room = Math.min(\n (this.layoutBounds.width - left - right) / 2,\n this.layoutBounds.height / 2 - this.labelRowHeight - 4\n )\n return Math.max(0, room / this.growFactor)\n }\n\n /** Radius of the hole in the middle: a fraction of the outer radius, or explicit px. */\n private get holeRadius(): number {\n const configured = this.ring.holeRadius\n if (configured <= 0) return 0\n const px = configured < 1 ? configured * this.outerRadius : configured\n return Math.min(px, this.outerRadius * 0.95)\n }\n\n /** Radius of the circle every leader elbows on, clear of even a popped-out slice. */\n private get elbowRadius(): number {\n return this.outerRadius + this.maxPop + LEADER_LENGTH\n }\n\n /** How far slice `index` is currently pushed out, in `[0, 1]`. */\n private popOf(index: number): number {\n return clampUnit(this.pops[index] ?? 0)\n }\n\n /** Radius of slice `index`'s outer edge, its selection growth included. */\n private anchorRadius(index: number): number {\n return this.outerRadius + this.maxPop * this.popOf(index)\n }\n\n /**\n * Radius an inside label sits at on slice `index`: halfway across the band on a\n * donut, and further out than halfway on a solid pie, where \"halfway\" would\n * crowd the point every wedge converges on. Rides the slice's own pop, so an\n * inside label travels out with the wedge it belongs to.\n */\n private bandMidRadius(index: number): number {\n const rim = this.anchorRadius(index)\n const hole = this.holeRadius\n return hole > 0 ? (hole + rim) / 2 : rim * PIE_LABEL_RADIUS\n }\n\n /** Node2D-space point slice `index`'s inside label is centred on. */\n private insideAnchor(index: number): Vector2 {\n const arc = this.arcs.find((a) => a.index === index)\n if (arc === undefined) return { x: this.centerX, y: 0 }\n const point = ringPoint(this.bandMidRadius(index), arc.mid)\n return { x: point.x + this.centerX, y: point.y }\n }\n\n /**\n * How selected the ring is overall, in `[0, 1]` — the most-grown slice. Rides\n * the same tween the pops do, so the dim below arrives with the growth rather\n * than needing an animation of its own.\n */\n private get selectionStrength(): number {\n let strongest = 0\n for (let i = 0; i < this.slices.length; i++) {\n strongest = Math.max(strongest, this.popOf(i))\n }\n return strongest\n }\n\n /**\n * Opacity slice `index` (and its leader and label) is drawn at: full while\n * nothing is selected, falling toward {@link dimOpacity} in proportion to how\n * selected the *rest* of the ring is. A slice that's selected itself stays at\n * full — the two factors cancel.\n */\n private sliceOpacity(index: number): number {\n const focus = this.selectionStrength\n if (focus <= 0) return 1\n return 1 - (1 - clampUnit(this.dimOpacity)) * focus * (1 - this.popOf(index))\n }\n\n // ---- Label placement ---------------------------------------------------\n\n /**\n * Where every leader label sits and how its leader gets there. Labels are split\n * into a right and a left column by their slice's bisector, each column is\n * spread so nothing overlaps (and nothing leaves the box), and each leader is\n * then built as wedge edge → elbow → label. The elbow rides the leader circle at\n * the label's *settled* y, which keeps the final run horizontal and the whole\n * polyline outside the ring however far the label was nudged.\n */\n private placements(): LabelPlacement[] {\n if (!this.hasLeaderLabels) return []\n const arcs = this.arcs\n if (arcs.length === 0 || this.outerRadius <= 0) return []\n\n const radius = this.elbowRadius\n const rowHeight = this.labelRowHeight\n const top = this.layoutBounds.height / 2 - rowHeight / 2\n const bottom = -top\n const cx = this.centerX\n\n interface Slot {\n index: number\n side: 1 | -1\n mid: number\n ideal: number\n y: number\n }\n const right: Slot[] = []\n const left: Slot[] = []\n for (const arc of arcs) {\n const side = this.sideOf(arc.mid)\n const ideal = ringPoint(radius, arc.mid).y\n ;(side > 0 ? right : left).push({\n index: arc.index,\n side,\n mid: arc.mid,\n ideal,\n y: ideal,\n })\n }\n relaxLabels(right, rowHeight + LABEL_GAP, top, bottom)\n relaxLabels(left, rowHeight + LABEL_GAP, top, bottom)\n\n return [...right, ...left].map((slot) => {\n const start = ringPoint(\n this.anchorRadius(slot.index) + LEADER_LIFTOFF,\n slot.mid\n )\n // The elbow sits where the label's y crosses the leader circle. Solving\n // x² + y² = radius² for x keeps it *on* that circle (never inside the\n // ring); a label pushed past the circle's top or bottom falls back to the\n // sideways floor so its leader still reads as pointing outward.\n const onCircle = Math.sqrt(\n Math.max(0, radius * radius - slot.y * slot.y)\n )\n const elbowX = cx + slot.side * Math.max(onCircle, radius * MIN_ELBOW)\n const endX = cx + slot.side * (radius + LABEL_STUB)\n\n return {\n index: slot.index,\n side: slot.side,\n leader: [\n { x: start.x + cx, y: start.y },\n { x: elbowX, y: slot.y },\n { x: endX, y: slot.y },\n ],\n text: { x: endX + slot.side * TEXT_INSET, y: slot.y },\n }\n })\n }\n\n /** This frame's placement for slice `index`, or `undefined` if it isn't leadered. */\n private placementFor(index: number): LabelPlacement | undefined {\n return this.placements().find((placement) => placement.index === index)\n }\n\n // ---- Draw --------------------------------------------------------------\n\n /**\n * The ring's paints live nowhere `ShapeNode` would look: one fill per slice,\n * resolved once into {@link fills}, plus the leader line's own stroke. Both are\n * passed explicitly — see {@link declarePaints}.\n */\n override declareAssets(assets: AssetScope): void {\n super.declareAssets(assets)\n declarePaints(this, assets, {\n fills: this.fills,\n strokes: [strokeOps.resolve(this.label.leaderStroke)],\n })\n }\n\n protected renderSelf(ctx: RenderContext2D): void {\n const rOuter = this.outerRadius\n if (rOuter <= 0) return\n\n const arcs = this.arcs\n if (arcs.length === 0) return\n\n const sweep = clampUnit(this.growth)\n const revealEnd = this.ring.startAngle * (Math.PI / 180) + Math.PI * 2 * sweep\n const hole = this.holeRadius\n const halfGap = Math.max(0, this.ring.gap) / 2\n\n // One shared frame (the whole ring square, grown slices included) pinned onto\n // every wedge path, so `Graphics2D.path()` doesn't re-centre each wedge on its\n // own bbox and collapse them all onto the origin. It stays symmetric about the\n // *node's* origin — so path coordinates land exactly in node space — and is\n // grown by the ring's sideways offset rather than moved with it, which would\n // undo the very shift it has to contain.\n const cx = this.centerX\n const half = rOuter + this.maxPop + 1 + Math.abs(cx)\n const centerBounds: [number, number, number, number] = [\n -half,\n -half,\n half,\n half,\n ]\n // Explicit width/height alongside centerBounds: a wedge path's command list\n // carries no implied extent, so a slice filled with an image or a video needs\n // this to size its decode.\n const span = half * 2\n\n for (const arc of arcs) {\n // Clip the wedge to the growth-revealed arc; skip it until the sweep\n // reaches it, so the ring draws in as one clockwise wipe.\n const a1 = Math.min(arc.a1, revealEnd)\n if (a1 <= arc.a0) continue\n\n const path = wedgePath(\n arc.a0,\n a1,\n hole,\n this.anchorRadius(arc.index),\n halfGap,\n cx\n )\n const g = new Graphics2D().path(\n path.toPathState({ centerBounds, width: span, height: span })\n )\n g.shadow(this.ring.shadow)\n g.fill(this.fills[arc.index] ?? [])\n g.stroke(this.ring.stroke)\n ctx.draw(g.opacity(this.sliceOpacity(arc.index)))\n }\n\n // Leaders. Each polyline gets its own `Graphics2D`: several open polylines\n // chained into one command list are combined into a single surface before the\n // stroke, which closes each contour back on itself and paints the leaders as\n // thin triangles.\n const reveal = clampUnit(this.labelReveal)\n if (reveal <= 0.001) return\n for (const placement of this.placements()) {\n ctx.draw(\n new Graphics2D()\n .line({ points: placement.leader, radius: ELBOW_RADIUS })\n .stroke(this.label.leaderStroke)\n .opacity(reveal * this.sliceOpacity(placement.index))\n )\n }\n }\n\n // ---- Entrance ----------------------------------------------------------\n\n /** Tween {@link growth} `0 → 1`, wiping the wedges in around the ring. */\n @command()\n sweep(\n args: CommandArgs<Record<string, never>> & { duration: number }\n ): Command<RingSweep> {\n // No priming to 0 first — the value at `t` is a function of `t`, so a repeat\n // call re-sweeps by definition rather than by having reset something.\n return this.command<RingSweep>((t) => ({ growth: t }), args.duration, args.easing ?? easeOut())\n }\n\n /** Tween {@link labelReveal} `0 → 1`, fading the leaders and captions up. */\n @command()\n revealLabels(\n args: CommandArgs<Record<string, never>> & { duration: number }\n ): Command<RingLabels> {\n return this.command<RingLabels>((t) => ({ labelReveal: t }), args.duration, args.easing ?? easeOut())\n }\n\n /**\n * Fade the hole's summary up. Deliberately not part of the ring's entrance: a\n * hole label is usually the chart's conclusion, so the scene decides when it\n * lands.\n */\n @command()\n revealCenter(\n args: CommandArgs<Record<string, never>> & { duration?: number } = {}\n ): Command<RingCenter> {\n const from = clampUnit(this.centerReveal)\n return this.command<RingCenter>(\n (t) => ({ centerReveal: from + (1 - from) * t }),\n args.duration ?? 0.6,\n args.easing ?? easeOut()\n )\n }\n}\n\n/** The signals the ring's own commands move, as props types. */\ntype RingSweep = { growth: number }\ntype RingLabels = { labelReveal: number }\ntype RingCenter = { centerReveal: number }\n"]}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types and pure helpers specific to the {@link PieChart} family: how rows
|
|
3
|
+
* become slices, how slices become arcs on a ring, where the labels around it
|
|
4
|
+
* end up, and the theme all of that is drawn from.
|
|
5
|
+
*
|
|
6
|
+
* The one chart in the family that draws **one mark per row** rather than one
|
|
7
|
+
* per column, which is why almost nothing about its geometry is shared: there is
|
|
8
|
+
* no scale, no axis and no baseline, only a circle divided by share. What it
|
|
9
|
+
* *does* share — the legend, the theme leaf resolvers, the palette, the
|
|
10
|
+
* percentage format — comes from `nodes/chart-kit/shared.ts`.
|
|
11
|
+
*
|
|
12
|
+
* Kept renderer-agnostic (no `Node` imports) so the studio's inspector mapping
|
|
13
|
+
* (`pie-chart-props.ts`) can build a partial {@link PieChartTheme} without
|
|
14
|
+
* pulling the node classes in.
|
|
15
|
+
*/
|
|
16
|
+
import { type DataRecord, type Fill, type Shadow, type Stroke, type TextStyle, type Vector2 } from "@motionscript/core";
|
|
17
|
+
import { type LegendConfig, type LegendTheme } from "../kit/shared.js";
|
|
18
|
+
/**
|
|
19
|
+
* One **resolved** slice of a {@link PieChart}: its caption, its magnitude, and
|
|
20
|
+
* the paint its wedge and legend swatch take.
|
|
21
|
+
*
|
|
22
|
+
* This is what the ring and the legend consume, not what a scene authors: the
|
|
23
|
+
* chart takes tabular `data` plus two field names and resolves it into these, so
|
|
24
|
+
* the parts stay unaware of where a slice's caption, magnitude and paint came
|
|
25
|
+
* from.
|
|
26
|
+
*/
|
|
27
|
+
export interface PieSlice {
|
|
28
|
+
/** Legend caption and label text for this slice. */
|
|
29
|
+
category: string;
|
|
30
|
+
/** This slice's magnitude. Its wedge covers `value / (sum of all values)`. */
|
|
31
|
+
value: number;
|
|
32
|
+
/** Wedge and swatch paint. */
|
|
33
|
+
fill: Fill;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Resolve tabular rows into slices: one per row, captioned by the `category`
|
|
37
|
+
* column, sized by the `value` column, painted from `palette` by row order
|
|
38
|
+
* (cycling when the palette is shorter than the data).
|
|
39
|
+
*
|
|
40
|
+
* Paint comes from the palette rather than from the rows because a pie draws one
|
|
41
|
+
* mark per *row* — unlike the line and bar charts, where a colour belongs to a
|
|
42
|
+
* series (a whole column) and rides on the series entry instead. Keeping it out
|
|
43
|
+
* of the rows is what lets a pie be fed straight from a CSV of plain numbers.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolvePieSlices(data: DataRecord[], category: string, value: string, palette: Fill[]): PieSlice[];
|
|
46
|
+
/** What a {@link PieChart}'s labels say. */
|
|
47
|
+
export type PieLabelMode =
|
|
48
|
+
/**
|
|
49
|
+
* The category and its percentage, two lines. Their order flips with the
|
|
50
|
+
* placement: a **leader** label reads category over percentage, an **inside**
|
|
51
|
+
* label reads the percentage big over a small category caption — inside a
|
|
52
|
+
* wedge the reader already knows which slice they're on, so the magnitude is
|
|
53
|
+
* the thing being read.
|
|
54
|
+
*/
|
|
55
|
+
"both"
|
|
56
|
+
/** The category only. */
|
|
57
|
+
| "category"
|
|
58
|
+
/** The percentage only — the pick when a legend already names the categories. */
|
|
59
|
+
| "percent"
|
|
60
|
+
/** No labels and no leader lines at all. */
|
|
61
|
+
| "none";
|
|
62
|
+
/**
|
|
63
|
+
* Where a slice's label sits.
|
|
64
|
+
*
|
|
65
|
+
* `"inside"` drops the leader line entirely and centres the label in the wedge's
|
|
66
|
+
* own band, which costs no gutter — so the ring draws bigger — and costs the eye
|
|
67
|
+
* no round trip. `"leader"` is the classic treatment, and what a sliver too
|
|
68
|
+
* narrow to hold text needs.
|
|
69
|
+
*/
|
|
70
|
+
export type PieLabelPlacement = "inside" | "leader" | "none";
|
|
71
|
+
/** Degrees → radians. */
|
|
72
|
+
export declare const DEG: number;
|
|
73
|
+
/** A slice's plotted value: negatives and non-finite values count as 0. */
|
|
74
|
+
export declare function sliceValue(slice: PieSlice): number;
|
|
75
|
+
/** Sum of every slice's plotted value — the denominator every share is taken against. */
|
|
76
|
+
export declare function sliceTotal(slices: PieSlice[]): number;
|
|
77
|
+
/**
|
|
78
|
+
* The point at radius `r` and angle `a` on a ring centred on the origin, in the
|
|
79
|
+
* node's centred, **y-up** space. Angles run **clockwise from 12 o'clock**:
|
|
80
|
+
* `a = 0` points straight up (+y), and increasing `a` sweeps toward +x then −y.
|
|
81
|
+
*/
|
|
82
|
+
export declare function ringPoint(r: number, a: number): Vector2;
|
|
83
|
+
/** One slice's resolved angular span on the ring. */
|
|
84
|
+
export interface PieArc {
|
|
85
|
+
/** Index of the slice in the source list. */
|
|
86
|
+
index: number;
|
|
87
|
+
/** Start angle, radians clockwise from 12 o'clock. */
|
|
88
|
+
a0: number;
|
|
89
|
+
/** End angle, radians clockwise from 12 o'clock. */
|
|
90
|
+
a1: number;
|
|
91
|
+
/** Bisector angle — where this slice's label and pop-out point. */
|
|
92
|
+
mid: number;
|
|
93
|
+
/** This slice's share of the total, in `[0, 1]`. */
|
|
94
|
+
fraction: number;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Resolve slices into per-slice arcs: each covers exactly its share of the
|
|
98
|
+
* circle, walking clockwise from `startDegrees` (0 = 12 o'clock), with the arcs
|
|
99
|
+
* abutting. Zero/negative slices are skipped entirely; an all-zero list yields
|
|
100
|
+
* no arcs.
|
|
101
|
+
*
|
|
102
|
+
* Arcs are the *undivided* shares — the gap between neighbours is not carved out
|
|
103
|
+
* here, because a fixed angular gap reads as a wedge: wide at the rim, pinched
|
|
104
|
+
* shut at the hole. It's applied when the wedge is drawn instead, as a
|
|
105
|
+
* constant-width inset off both ends of every arc, so a slice still covers its
|
|
106
|
+
* true percentage of the circle.
|
|
107
|
+
*/
|
|
108
|
+
export declare function pieArcs(slices: PieSlice[], startDegrees: number): PieArc[];
|
|
109
|
+
/** A label competing for vertical space in one of the two label columns. */
|
|
110
|
+
export interface LabelSlot {
|
|
111
|
+
/** Where the label would sit if nothing else were in the way. */
|
|
112
|
+
ideal: number;
|
|
113
|
+
/** Where it ends up once the column has been de-conflicted. Written by {@link relaxLabels}. */
|
|
114
|
+
y: number;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Spread one column of labels so no two overlap, keeping each as close to its
|
|
118
|
+
* `ideal` y as possible and the whole column inside `[bottom, top]`.
|
|
119
|
+
*
|
|
120
|
+
* Two passes, the standard treatment. Walking top-to-bottom, each label takes
|
|
121
|
+
* the highest slot at or below its ideal that still clears the label above it by
|
|
122
|
+
* `minGap`; if that pushes the tail past `bottom`, a reverse pass lifts it back
|
|
123
|
+
* up. When there are more labels than the column can hold, the reverse pass wins
|
|
124
|
+
* and the crowding is shared evenly rather than dumped off the bottom edge.
|
|
125
|
+
*
|
|
126
|
+
* Mutates each slot's `y` and returns `slots` re-ordered top-to-bottom.
|
|
127
|
+
*/
|
|
128
|
+
export declare function relaxLabels<T extends LabelSlot>(slots: T[], minGap: number, top: number, bottom: number): T[];
|
|
129
|
+
/** The ring's geometry and paint — everything about the wedges but their colour. */
|
|
130
|
+
export interface RingConfig {
|
|
131
|
+
/**
|
|
132
|
+
* Width of the channel between adjacent slices, in px, held constant all the
|
|
133
|
+
* way across the band — the same clearance at the hole as at the rim. (An
|
|
134
|
+
* angular gap would splay open toward the rim instead.)
|
|
135
|
+
*/
|
|
136
|
+
gap: number;
|
|
137
|
+
/**
|
|
138
|
+
* Radius of the hole punched through the middle. Below 1 it reads as a
|
|
139
|
+
* fraction of the ring's outer radius (`0.6` leaves a band 40% of the radius
|
|
140
|
+
* thick); 1 and up as an explicit pixel radius; `0` fills the middle in,
|
|
141
|
+
* drawing solid pie wedges.
|
|
142
|
+
*/
|
|
143
|
+
holeRadius: number;
|
|
144
|
+
/** Angle in degrees where the first slice begins, clockwise from 12 o'clock. */
|
|
145
|
+
startAngle: number;
|
|
146
|
+
/**
|
|
147
|
+
* How far out a selected slice's rim reaches, as a **multiple of the ring's
|
|
148
|
+
* outer radius**. Being relative, the emphasis scales with the chart instead
|
|
149
|
+
* of shrinking on a big one and swamping a small one. Clamped to `[1, 1.6]`.
|
|
150
|
+
*/
|
|
151
|
+
selectedGrow: number;
|
|
152
|
+
/** Optional outline on every wedge. */
|
|
153
|
+
stroke: Stroke;
|
|
154
|
+
/** Optional drop shadow on every wedge. */
|
|
155
|
+
shadow: Shadow;
|
|
156
|
+
}
|
|
157
|
+
/** How the ring's labels are set, and the leader lines that point at them. */
|
|
158
|
+
export interface LabelConfig {
|
|
159
|
+
/** The category caption on a label. */
|
|
160
|
+
textStyle: TextStyle;
|
|
161
|
+
/** The percentage on a label. */
|
|
162
|
+
percentStyle: TextStyle;
|
|
163
|
+
/**
|
|
164
|
+
* Ink for a label set **inside** its wedge, both lines. Separate because an
|
|
165
|
+
* inside label sits on the wedge's own paint rather than on the background, so
|
|
166
|
+
* it usually wants the opposite end of the value range from everything else.
|
|
167
|
+
*/
|
|
168
|
+
insideStyle: TextStyle;
|
|
169
|
+
/** The leader line running from a wedge out to its label. */
|
|
170
|
+
leaderStroke: Stroke;
|
|
171
|
+
}
|
|
172
|
+
/** The summary set in the ring's hole. */
|
|
173
|
+
export interface CenterConfig {
|
|
174
|
+
labelStyle: TextStyle;
|
|
175
|
+
captionStyle: TextStyle;
|
|
176
|
+
}
|
|
177
|
+
/** A {@link PieChart}'s full, resolved visual theme. */
|
|
178
|
+
export interface PieChartConfig {
|
|
179
|
+
/** Wedge and swatch paint, cycled by **row** index (`i % length`). */
|
|
180
|
+
sliceFills: Fill[];
|
|
181
|
+
ring: RingConfig;
|
|
182
|
+
label: LabelConfig;
|
|
183
|
+
center: CenterConfig;
|
|
184
|
+
legend: LegendConfig;
|
|
185
|
+
/** How far everything outside the selection fades while any slice is selected. */
|
|
186
|
+
spotlight: {
|
|
187
|
+
dimOpacity: number;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/** Author-facing partial theme — every branch optional and deep-merged. */
|
|
191
|
+
export type PieChartTheme = {
|
|
192
|
+
sliceFills?: Fill[];
|
|
193
|
+
ring?: Partial<RingConfig>;
|
|
194
|
+
label?: Partial<LabelConfig>;
|
|
195
|
+
center?: Partial<CenterConfig>;
|
|
196
|
+
legend?: LegendTheme;
|
|
197
|
+
spotlight?: Partial<PieChartConfig["spotlight"]>;
|
|
198
|
+
};
|
|
199
|
+
/** The pie chart's out-of-the-box look. */
|
|
200
|
+
export declare const DEFAULT_PIE_CHART_THEME: PieChartConfig;
|
|
201
|
+
/**
|
|
202
|
+
* {@link PieChart}'s `theme` @property mapper: merges the author's partial
|
|
203
|
+
* {@link PieChartTheme} onto `previous` (falling back to
|
|
204
|
+
* {@link DEFAULT_PIE_CHART_THEME} on first resolution), fully resolving every
|
|
205
|
+
* leaf so the tween below always has resolved data to interpolate.
|
|
206
|
+
*/
|
|
207
|
+
export declare function resolvePieChartTheme(theme: PieChartTheme | undefined, previous?: PieChartConfig): PieChartConfig;
|
|
208
|
+
/** {@link PieChart}'s `theme` @property tween — leaf by leaf. */
|
|
209
|
+
export declare function lerpPieChartTheme(from: PieChartConfig, to: PieChartConfig, t: number): PieChartConfig;
|
|
210
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/pie-chart/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAKL,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,MAAM,EAEX,KAAK,MAAM,EAEX,KAAK,SAAS,EACd,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E,CAAA;IAClB,IAAI,EAAE,UAAU,CAAA;IAChB,KAAK,EAAE,WAAW,CAAA;IAClB,MAAM,EAAE,YAAY,CAAA;IACpB,MAAM,EAAE,YAAY,CAAA;IACpB,kFAAkF;IAClF,SAAS,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;CAClC;AAED,2EAA2E;AAC3E,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,CAAC,EAAE,IAAI,EAAE,CAAA;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAA;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;IAC9B,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAA;CACjD,CAAA;AASD,2CAA2C;AAC3C,eAAO,MAAM,uBAAuB,EAAE,cAqCrC,CAAA;AAiGD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,QAAQ,CAAC,EAAE,cAAc,GACxB,cAAc,CAYhB;AAED,iEAAiE;AACjE,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,cAAc,EACpB,EAAE,EAAE,cAAc,EAClB,CAAC,EAAE,MAAM,GACR,cAAc,CAkBhB"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types and pure helpers specific to the {@link PieChart} family: how rows
|
|
3
|
+
* become slices, how slices become arcs on a ring, where the labels around it
|
|
4
|
+
* end up, and the theme all of that is drawn from.
|
|
5
|
+
*
|
|
6
|
+
* The one chart in the family that draws **one mark per row** rather than one
|
|
7
|
+
* per column, which is why almost nothing about its geometry is shared: there is
|
|
8
|
+
* no scale, no axis and no baseline, only a circle divided by share. What it
|
|
9
|
+
* *does* share — the legend, the theme leaf resolvers, the palette, the
|
|
10
|
+
* percentage format — comes from `nodes/chart-kit/shared.ts`.
|
|
11
|
+
*
|
|
12
|
+
* Kept renderer-agnostic (no `Node` imports) so the studio's inspector mapping
|
|
13
|
+
* (`pie-chart-props.ts`) can build a partial {@link PieChartTheme} without
|
|
14
|
+
* pulling the node classes in.
|
|
15
|
+
*/
|
|
16
|
+
import { lerpNumber, shadowOps, strokeOps, textOps, } from "@motionscript/core";
|
|
17
|
+
import { CHART_PALETTE, DEFAULT_LEGEND, DEFAULT_SERIES_FILLS, SPOTLIGHT_DIM, lerpLegendConfig, lerpSeriesFills, num, resolveLegendConfig, resolveSeriesFills, text, } from "../kit/shared.js";
|
|
18
|
+
/**
|
|
19
|
+
* Resolve tabular rows into slices: one per row, captioned by the `category`
|
|
20
|
+
* column, sized by the `value` column, painted from `palette` by row order
|
|
21
|
+
* (cycling when the palette is shorter than the data).
|
|
22
|
+
*
|
|
23
|
+
* Paint comes from the palette rather than from the rows because a pie draws one
|
|
24
|
+
* mark per *row* — unlike the line and bar charts, where a colour belongs to a
|
|
25
|
+
* series (a whole column) and rides on the series entry instead. Keeping it out
|
|
26
|
+
* of the rows is what lets a pie be fed straight from a CSV of plain numbers.
|
|
27
|
+
*/
|
|
28
|
+
export function resolvePieSlices(data, category, value, palette) {
|
|
29
|
+
return data.map((row, i) => ({
|
|
30
|
+
category: text(row, category),
|
|
31
|
+
value: num(row, value),
|
|
32
|
+
fill: palette.length > 0 ? palette[i % palette.length] : "white",
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
/** Degrees → radians. */
|
|
36
|
+
export const DEG = Math.PI / 180;
|
|
37
|
+
/** A slice's plotted value: negatives and non-finite values count as 0. */
|
|
38
|
+
export function sliceValue(slice) {
|
|
39
|
+
return slice.value > 0 && Number.isFinite(slice.value) ? slice.value : 0;
|
|
40
|
+
}
|
|
41
|
+
/** Sum of every slice's plotted value — the denominator every share is taken against. */
|
|
42
|
+
export function sliceTotal(slices) {
|
|
43
|
+
let sum = 0;
|
|
44
|
+
for (const slice of slices)
|
|
45
|
+
sum += sliceValue(slice);
|
|
46
|
+
return sum;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The point at radius `r` and angle `a` on a ring centred on the origin, in the
|
|
50
|
+
* node's centred, **y-up** space. Angles run **clockwise from 12 o'clock**:
|
|
51
|
+
* `a = 0` points straight up (+y), and increasing `a` sweeps toward +x then −y.
|
|
52
|
+
*/
|
|
53
|
+
export function ringPoint(r, a) {
|
|
54
|
+
return { x: r * Math.sin(a), y: r * Math.cos(a) };
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Resolve slices into per-slice arcs: each covers exactly its share of the
|
|
58
|
+
* circle, walking clockwise from `startDegrees` (0 = 12 o'clock), with the arcs
|
|
59
|
+
* abutting. Zero/negative slices are skipped entirely; an all-zero list yields
|
|
60
|
+
* no arcs.
|
|
61
|
+
*
|
|
62
|
+
* Arcs are the *undivided* shares — the gap between neighbours is not carved out
|
|
63
|
+
* here, because a fixed angular gap reads as a wedge: wide at the rim, pinched
|
|
64
|
+
* shut at the hole. It's applied when the wedge is drawn instead, as a
|
|
65
|
+
* constant-width inset off both ends of every arc, so a slice still covers its
|
|
66
|
+
* true percentage of the circle.
|
|
67
|
+
*/
|
|
68
|
+
export function pieArcs(slices, startDegrees) {
|
|
69
|
+
const total = sliceTotal(slices);
|
|
70
|
+
if (total <= 0)
|
|
71
|
+
return [];
|
|
72
|
+
const arcs = [];
|
|
73
|
+
let cursor = startDegrees * DEG;
|
|
74
|
+
slices.forEach((slice, index) => {
|
|
75
|
+
const value = sliceValue(slice);
|
|
76
|
+
if (value <= 0)
|
|
77
|
+
return;
|
|
78
|
+
const fraction = value / total;
|
|
79
|
+
const a0 = cursor;
|
|
80
|
+
const a1 = a0 + fraction * Math.PI * 2;
|
|
81
|
+
cursor = a1;
|
|
82
|
+
arcs.push({ index, a0, a1, mid: (a0 + a1) / 2, fraction });
|
|
83
|
+
});
|
|
84
|
+
return arcs;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Spread one column of labels so no two overlap, keeping each as close to its
|
|
88
|
+
* `ideal` y as possible and the whole column inside `[bottom, top]`.
|
|
89
|
+
*
|
|
90
|
+
* Two passes, the standard treatment. Walking top-to-bottom, each label takes
|
|
91
|
+
* the highest slot at or below its ideal that still clears the label above it by
|
|
92
|
+
* `minGap`; if that pushes the tail past `bottom`, a reverse pass lifts it back
|
|
93
|
+
* up. When there are more labels than the column can hold, the reverse pass wins
|
|
94
|
+
* and the crowding is shared evenly rather than dumped off the bottom edge.
|
|
95
|
+
*
|
|
96
|
+
* Mutates each slot's `y` and returns `slots` re-ordered top-to-bottom.
|
|
97
|
+
*/
|
|
98
|
+
export function relaxLabels(slots, minGap, top, bottom) {
|
|
99
|
+
slots.sort((a, b) => b.ideal - a.ideal);
|
|
100
|
+
let ceiling = top;
|
|
101
|
+
for (const slot of slots) {
|
|
102
|
+
slot.y = Math.min(slot.ideal, ceiling);
|
|
103
|
+
ceiling = slot.y - minGap;
|
|
104
|
+
}
|
|
105
|
+
let floor = bottom;
|
|
106
|
+
for (let i = slots.length - 1; i >= 0; i--) {
|
|
107
|
+
slots[i].y = Math.max(slots[i].y, floor);
|
|
108
|
+
floor = slots[i].y + minGap;
|
|
109
|
+
}
|
|
110
|
+
return slots;
|
|
111
|
+
}
|
|
112
|
+
const LABEL_TEXT_STYLE = {
|
|
113
|
+
fontSize: 26,
|
|
114
|
+
fontWeight: 600,
|
|
115
|
+
textAlign: "center",
|
|
116
|
+
fill: CHART_PALETTE.markerColor,
|
|
117
|
+
};
|
|
118
|
+
/** The pie chart's out-of-the-box look. */
|
|
119
|
+
export const DEFAULT_PIE_CHART_THEME = {
|
|
120
|
+
sliceFills: DEFAULT_SERIES_FILLS,
|
|
121
|
+
ring: {
|
|
122
|
+
gap: 6,
|
|
123
|
+
// A donut rather than a solid pie by default: the hole is the largest
|
|
124
|
+
// uninterrupted area the chart owns and the one place a conclusion can be
|
|
125
|
+
// set. `0` here would give that away before anyone had asked for it.
|
|
126
|
+
holeRadius: 0.6,
|
|
127
|
+
startAngle: 0,
|
|
128
|
+
selectedGrow: 1.08,
|
|
129
|
+
stroke: [],
|
|
130
|
+
shadow: [],
|
|
131
|
+
},
|
|
132
|
+
label: {
|
|
133
|
+
textStyle: LABEL_TEXT_STYLE,
|
|
134
|
+
percentStyle: { ...LABEL_TEXT_STYLE, fontWeight: 700 },
|
|
135
|
+
// Inside labels sit on the wedge's paint, which is a mid-tone from the
|
|
136
|
+
// palette — so they lead with the panel colour rather than the axis ink.
|
|
137
|
+
insideStyle: { ...LABEL_TEXT_STYLE, fontWeight: 800, fill: "#15130e" },
|
|
138
|
+
leaderStroke: { weight: 2, fill: CHART_PALETTE.markerColor },
|
|
139
|
+
},
|
|
140
|
+
center: {
|
|
141
|
+
labelStyle: {
|
|
142
|
+
fontSize: 46,
|
|
143
|
+
fontWeight: 800,
|
|
144
|
+
textAlign: "center",
|
|
145
|
+
fill: CHART_PALETTE.markerColor,
|
|
146
|
+
},
|
|
147
|
+
captionStyle: {
|
|
148
|
+
fontSize: 22,
|
|
149
|
+
fontWeight: 500,
|
|
150
|
+
textAlign: "center",
|
|
151
|
+
fill: CHART_PALETTE.markerColor,
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
legend: DEFAULT_LEGEND,
|
|
155
|
+
spotlight: { dimOpacity: SPOTLIGHT_DIM },
|
|
156
|
+
};
|
|
157
|
+
function resolveRingConfig(ring, previous) {
|
|
158
|
+
return {
|
|
159
|
+
gap: ring?.gap ?? previous.gap,
|
|
160
|
+
holeRadius: ring?.holeRadius ?? previous.holeRadius,
|
|
161
|
+
startAngle: ring?.startAngle ?? previous.startAngle,
|
|
162
|
+
selectedGrow: ring?.selectedGrow ?? previous.selectedGrow,
|
|
163
|
+
stroke: strokeOps.resolve(ring?.stroke ?? previous.stroke),
|
|
164
|
+
shadow: shadowOps.resolve(ring?.shadow ?? previous.shadow),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function lerpRingConfig(from, to, t) {
|
|
168
|
+
return {
|
|
169
|
+
gap: lerpNumber(from.gap, to.gap, t),
|
|
170
|
+
holeRadius: lerpNumber(from.holeRadius, to.holeRadius, t),
|
|
171
|
+
startAngle: lerpNumber(from.startAngle, to.startAngle, t),
|
|
172
|
+
selectedGrow: lerpNumber(from.selectedGrow, to.selectedGrow, t),
|
|
173
|
+
stroke: strokeOps.lerp(from.stroke, to.stroke, t),
|
|
174
|
+
shadow: shadowOps.lerp(from.shadow, to.shadow, t),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function resolveLabelConfig(label, previous) {
|
|
178
|
+
return {
|
|
179
|
+
textStyle: textOps.resolveStyle(label?.textStyle, previous.textStyle),
|
|
180
|
+
percentStyle: textOps.resolveStyle(label?.percentStyle, previous.percentStyle),
|
|
181
|
+
insideStyle: textOps.resolveStyle(label?.insideStyle, previous.insideStyle),
|
|
182
|
+
leaderStroke: strokeOps.resolve(label?.leaderStroke ?? previous.leaderStroke),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function lerpLabelConfig(from, to, t) {
|
|
186
|
+
return {
|
|
187
|
+
textStyle: textOps.lerpStyle(from.textStyle, to.textStyle, t),
|
|
188
|
+
percentStyle: textOps.lerpStyle(from.percentStyle, to.percentStyle, t),
|
|
189
|
+
insideStyle: textOps.lerpStyle(from.insideStyle, to.insideStyle, t),
|
|
190
|
+
leaderStroke: strokeOps.lerp(from.leaderStroke, to.leaderStroke, t),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function resolveCenterConfig(center, previous) {
|
|
194
|
+
return {
|
|
195
|
+
labelStyle: textOps.resolveStyle(center?.labelStyle, previous.labelStyle),
|
|
196
|
+
captionStyle: textOps.resolveStyle(center?.captionStyle, previous.captionStyle),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function lerpCenterConfig(from, to, t) {
|
|
200
|
+
return {
|
|
201
|
+
labelStyle: textOps.lerpStyle(from.labelStyle, to.labelStyle, t),
|
|
202
|
+
captionStyle: textOps.lerpStyle(from.captionStyle, to.captionStyle, t),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* {@link PieChart}'s `theme` @property mapper: merges the author's partial
|
|
207
|
+
* {@link PieChartTheme} onto `previous` (falling back to
|
|
208
|
+
* {@link DEFAULT_PIE_CHART_THEME} on first resolution), fully resolving every
|
|
209
|
+
* leaf so the tween below always has resolved data to interpolate.
|
|
210
|
+
*/
|
|
211
|
+
export function resolvePieChartTheme(theme, previous) {
|
|
212
|
+
const base = previous ?? DEFAULT_PIE_CHART_THEME;
|
|
213
|
+
return {
|
|
214
|
+
sliceFills: resolveSeriesFills(theme?.sliceFills, base.sliceFills),
|
|
215
|
+
ring: resolveRingConfig(theme?.ring, base.ring),
|
|
216
|
+
label: resolveLabelConfig(theme?.label, base.label),
|
|
217
|
+
center: resolveCenterConfig(theme?.center, base.center),
|
|
218
|
+
legend: resolveLegendConfig(theme?.legend, base.legend),
|
|
219
|
+
spotlight: {
|
|
220
|
+
dimOpacity: theme?.spotlight?.dimOpacity ?? base.spotlight.dimOpacity,
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/** {@link PieChart}'s `theme` @property tween — leaf by leaf. */
|
|
225
|
+
export function lerpPieChartTheme(from, to, t) {
|
|
226
|
+
return {
|
|
227
|
+
// A palette is a list of independent paints rather than one value, so it
|
|
228
|
+
// interpolates pairwise by index; one that grows or shrinks holds the longer
|
|
229
|
+
// side's tail, exactly as the cartesian charts' palettes do.
|
|
230
|
+
sliceFills: lerpSeriesFills(from.sliceFills, to.sliceFills, t),
|
|
231
|
+
ring: lerpRingConfig(from.ring, to.ring, t),
|
|
232
|
+
label: lerpLabelConfig(from.label, to.label, t),
|
|
233
|
+
center: lerpCenterConfig(from.center, to.center, t),
|
|
234
|
+
legend: lerpLegendConfig(from.legend, to.legend, t),
|
|
235
|
+
spotlight: {
|
|
236
|
+
dimOpacity: lerpNumber(from.spotlight.dimOpacity, to.spotlight.dimOpacity, t),
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=shared.js.map
|