@motionscript/charts 0.1.0-alpha.0 → 0.1.0-alpha.10
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 +105 -0
- package/NOTICE +49 -0
- package/README.md +99 -0
- package/dist/bar-chart/bar-chart.d.ts +133 -228
- package/dist/bar-chart/bar-chart.d.ts.map +1 -1
- package/dist/bar-chart/bar-chart.js +386 -565
- package/dist/bar-chart/bar-chart.js.map +1 -1
- package/dist/bar-chart/category-axis.d.ts +35 -41
- package/dist/bar-chart/category-axis.d.ts.map +1 -1
- package/dist/bar-chart/category-axis.js +93 -115
- package/dist/bar-chart/category-axis.js.map +1 -1
- package/dist/bar-chart/chart-bars.d.ts +50 -70
- package/dist/bar-chart/chart-bars.d.ts.map +1 -1
- package/dist/bar-chart/chart-bars.js +155 -210
- package/dist/bar-chart/chart-bars.js.map +1 -1
- package/dist/bar-chart/index.d.ts +2 -2
- package/dist/bar-chart/index.d.ts.map +1 -1
- package/dist/bar-chart/index.js +1 -1
- package/dist/bar-chart/index.js.map +1 -1
- package/dist/bar-chart/shared.d.ts +7 -7
- package/dist/bar-chart/shared.d.ts.map +1 -1
- package/dist/bar-chart/shared.js +7 -7
- package/dist/bar-chart/shared.js.map +1 -1
- package/dist/browser/chunks/chunk-TJNHLQGV.js +2 -0
- package/dist/browser/chunks/chunk-TJNHLQGV.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/browser/kit.js +1 -1
- package/dist/browser/manifest.json +4 -3
- package/dist/engine.d.ts +10 -8
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +10 -8
- package/dist/engine.js.map +1 -1
- package/dist/kit/cartesian.d.ts +44 -0
- package/dist/kit/cartesian.d.ts.map +1 -0
- package/dist/kit/cartesian.js +59 -0
- package/dist/kit/cartesian.js.map +1 -0
- package/dist/kit/chart-border.d.ts +10 -11
- package/dist/kit/chart-border.d.ts.map +1 -1
- package/dist/kit/chart-border.js +15 -32
- package/dist/kit/chart-border.js.map +1 -1
- package/dist/kit/chart-canvas.d.ts +32 -21
- package/dist/kit/chart-canvas.d.ts.map +1 -1
- package/dist/kit/chart-canvas.js +33 -90
- package/dist/kit/chart-canvas.js.map +1 -1
- package/dist/kit/chart-legend.d.ts +123 -85
- package/dist/kit/chart-legend.d.ts.map +1 -1
- package/dist/kit/chart-legend.js +137 -186
- package/dist/kit/chart-legend.js.map +1 -1
- package/dist/kit/entries.d.ts +17 -0
- package/dist/kit/entries.d.ts.map +1 -0
- package/dist/kit/entries.js +19 -0
- package/dist/kit/entries.js.map +1 -0
- package/dist/kit/motion.d.ts +48 -0
- package/dist/kit/motion.d.ts.map +1 -0
- package/dist/kit/motion.js +63 -0
- package/dist/kit/motion.js.map +1 -0
- package/dist/kit/paints.d.ts +10 -0
- package/dist/kit/paints.d.ts.map +1 -0
- package/dist/kit/paints.js +12 -0
- package/dist/kit/paints.js.map +1 -0
- package/dist/kit/shared.d.ts +61 -10
- package/dist/kit/shared.d.ts.map +1 -1
- package/dist/kit/shared.js +108 -13
- package/dist/kit/shared.js.map +1 -1
- package/dist/kit/vertical-axis.d.ts +48 -61
- package/dist/kit/vertical-axis.d.ts.map +1 -1
- package/dist/kit/vertical-axis.js +97 -132
- package/dist/kit/vertical-axis.js.map +1 -1
- package/dist/line-chart/chart-line.d.ts +60 -77
- package/dist/line-chart/chart-line.d.ts.map +1 -1
- package/dist/line-chart/chart-line.js +100 -121
- package/dist/line-chart/chart-line.js.map +1 -1
- package/dist/line-chart/chart-region.d.ts +32 -33
- package/dist/line-chart/chart-region.d.ts.map +1 -1
- package/dist/line-chart/chart-region.js +31 -65
- package/dist/line-chart/chart-region.js.map +1 -1
- package/dist/line-chart/horizontal-axis.d.ts +58 -64
- package/dist/line-chart/horizontal-axis.d.ts.map +1 -1
- package/dist/line-chart/horizontal-axis.js +94 -123
- package/dist/line-chart/horizontal-axis.js.map +1 -1
- package/dist/line-chart/index.d.ts +3 -3
- package/dist/line-chart/index.d.ts.map +1 -1
- package/dist/line-chart/index.js +2 -2
- package/dist/line-chart/index.js.map +1 -1
- package/dist/line-chart/line-chart.d.ts +156 -303
- package/dist/line-chart/line-chart.d.ts.map +1 -1
- package/dist/line-chart/line-chart.js +410 -638
- package/dist/line-chart/line-chart.js.map +1 -1
- package/dist/line-chart/shared.d.ts +7 -7
- package/dist/line-chart/shared.d.ts.map +1 -1
- package/dist/line-chart/shared.js +23 -8
- package/dist/line-chart/shared.js.map +1 -1
- package/dist/line-chart/x-scale.d.ts +4 -11
- package/dist/line-chart/x-scale.d.ts.map +1 -1
- package/dist/line-chart/x-scale.js +16 -5
- package/dist/line-chart/x-scale.js.map +1 -1
- package/dist/nodes.d.ts +6 -9
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js +7 -9
- package/dist/nodes.js.map +1 -1
- package/dist/pie-chart/index.d.ts +2 -2
- package/dist/pie-chart/index.d.ts.map +1 -1
- package/dist/pie-chart/index.js +1 -1
- package/dist/pie-chart/index.js.map +1 -1
- package/dist/pie-chart/pie-chart.d.ts +108 -126
- package/dist/pie-chart/pie-chart.d.ts.map +1 -1
- package/dist/pie-chart/pie-chart.js +202 -271
- package/dist/pie-chart/pie-chart.js.map +1 -1
- package/dist/pie-chart/pie-legend.d.ts +84 -31
- package/dist/pie-chart/pie-legend.d.ts.map +1 -1
- package/dist/pie-chart/pie-legend.js +93 -107
- package/dist/pie-chart/pie-legend.js.map +1 -1
- package/dist/pie-chart/pie-ring.d.ts +160 -122
- package/dist/pie-chart/pie-ring.d.ts.map +1 -1
- package/dist/pie-chart/pie-ring.js +333 -361
- package/dist/pie-chart/pie-ring.js.map +1 -1
- package/dist/pie-chart/shared.d.ts +12 -6
- package/dist/pie-chart/shared.d.ts.map +1 -1
- package/dist/pie-chart/shared.js +14 -8
- package/dist/pie-chart/shared.js.map +1 -1
- package/package.json +7 -4
- package/src/bar-chart/bar-chart.ts +424 -686
- package/src/bar-chart/category-axis.ts +96 -111
- package/src/bar-chart/chart-bars.ts +178 -201
- package/src/bar-chart/index.ts +2 -2
- package/src/bar-chart/shared.ts +7 -7
- package/src/engine.ts +10 -8
- package/src/kit/cartesian.ts +81 -0
- package/src/kit/chart-border.ts +23 -34
- package/src/kit/chart-canvas.ts +45 -80
- package/src/kit/chart-legend.ts +185 -206
- package/src/kit/entries.ts +20 -0
- package/src/kit/motion.ts +90 -0
- package/src/kit/paints.ts +15 -0
- package/src/kit/shared.ts +120 -13
- package/src/kit/vertical-axis.ts +111 -141
- package/src/line-chart/chart-line.ts +103 -155
- package/src/line-chart/chart-region.ts +36 -81
- package/src/line-chart/horizontal-axis.ts +102 -153
- package/src/line-chart/index.ts +3 -3
- package/src/line-chart/line-chart.ts +463 -759
- package/src/line-chart/shared.ts +22 -8
- package/src/line-chart/x-scale.ts +20 -5
- package/src/nodes.ts +8 -10
- package/src/pie-chart/index.ts +2 -2
- package/src/pie-chart/pie-chart.ts +225 -303
- package/src/pie-chart/pie-legend.ts +125 -115
- package/src/pie-chart/pie-ring.ts +388 -443
- package/src/pie-chart/shared.ts +14 -8
- package/dist/browser/chunks/chunk-ZMBOBHYL.js +0 -2
- package/dist/browser/chunks/chunk-ZMBOBHYL.js.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"horizontal-axis.js","sourceRoot":"","sources":["../../src/line-chart/horizontal-axis.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,OAAO,EACP,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,SAAS,EACT,OAAO,GAIR,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,cAAc,EACd,WAAW,EACX,YAAY,GAGb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,OAAO,EAAiB,MAAM,8BAA8B,CAAA;AAgBzE,oEAAoE;AACpE,MAAM,KAAK,GAAG,EAAE,CAAC;AAKjB;;;;;;;;;;;;;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;2CA8BT","sourcesContent":["import {\n command,\n Node2D,\n Rect,\n Text,\n easeOut,\n property,\n insetsOps,\n textOps,\n type CommandArgs,\n type NodeConfig,\n type Node2DProps,\n} from \"@motionscript/core\";\n\nimport {\n DEFAULT_X_AXIS,\n enterBudget,\n formatMarker,\n type AxisConfig,\n type Range,\n} from \"../kit/shared\";\nimport { at, compose, type Seekable } from \"@motionscript/core/component\"\n\nexport interface HorizontalAxisProps extends Node2DProps {\n /** `[min, max]` of the horizontal scale the markers are positioned within. */\n range: Range;\n /** Tick values (in data units) to draw along the axis. */\n markers: number[];\n /** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */\n axis: AxisConfig;\n /**\n * Caption drawn centred in the gutter beneath the marker row. Empty string\n * (the default) hides it.\n */\n label: string;\n}\n\n/** How far a marker starts above its slot when it enters, in px. */\nconst SLIDE = 24;\n\n/** How a tick value is captioned — see {@link HorizontalAxis.labelFor}. */\nexport type MarkerLabel = (value: number) => string;\n\n/**\n * The horizontal axis of a {@link LineChart}: a **row of {@link Text} nodes**,\n * one per marker value, running left-to-right. Pure layout — the mirror of the\n * kit's `VerticalAxis`, including its bound (not snapshotted) marker text and\n * positions, and its landed resting state.\n *\n * Markers are always placed **by value** across the range, whatever they say:\n * `2026-03` sits three months along, not three slots along. That is what keeps\n * it distinct from a bar chart's bottom axis, which centres a caption on each\n * slot and has no scale at all — the two only look alike. What the values are\n * captioned *as* is the chart's to decide; see {@link labelFor}.\n *\n * {@link enter} staggers the markers in **left-to-right**: each starts lifted a\n * little above its slot and transparent, then fades and slides down into place.\n */\nexport class HorizontalAxis extends Node2D<HorizontalAxisProps> {\n @property({ default: () => [0, 1] as Range }) declare range: Range;\n @property({ default: () => [] as number[] }) declare markers: number[];\n @property({ default: DEFAULT_X_AXIS }) declare axis: AxisConfig;\n @property({ default: \"\" }) declare label: string;\n\n /**\n * How a tick value is captioned. Defaults to the numeric formatting the\n * vertical axis uses; a chart whose x column names months or categories\n * replaces it (see `x-scale.ts`).\n *\n * A plain field rather than a `@property`, because it is a **policy, not a\n * value**: there is nothing to tween between two formatters, and a signal\n * holding a function is a signal every `set`/`to` on this node would have to\n * know not to touch. Read inside each marker's `text` binding, so replacing it\n * before the first frame is enough — which is when the chart does it.\n */\n labelFor: MarkerLabel = formatMarker;\n\n /** One text node per marker, ordered left → right, for the staggered enter. */\n private markerNodes: Text[] = [];\n /** The caption node, or null when `label` is empty. */\n private labelNode: Text | null = null;\n\n /** The live tick values, left → right — re-read every frame, not snapshotted. */\n private get sortedMarkers(): number[] {\n return [...this.markers].sort((a, b) => a - b);\n }\n\n private valueAt(index: number): number | undefined {\n return this.sortedMarkers[index];\n }\n\n /** Tick `i`'s fraction across the live `range`, 0 at the left edge. */\n private fracAt(index: number): number {\n const v = this.valueAt(index);\n if (v === undefined) return 0;\n const [min, max] = this.range;\n return max <= min ? 0 : (v - min) / (max - min);\n }\n\n constructor(props?: NodeConfig<HorizontalAxis, HorizontalAxisProps>) {\n super(props);\n\n const tickPad = insetsOps.resolve(this.axis.tickPadding).top;\n const titlePad = insetsOps.resolve(this.axis.titlePadding).top;\n\n this.markerNodes = this.markers.map((_, i) => {\n const marker: Text = new Text({\n ...textOps.styleProps(this.axis.labelStyle),\n text: () => {\n const v = this.valueAt(i);\n return v === undefined ? \"\" : this.labelFor(v);\n },\n x: () => {\n const width = this.layoutBounds.width;\n const centred = (this.fracAt(i) - 0.5) * width;\n // Held inside the axis's right edge, which is also the *chart's*: the\n // last marker is centred on the last grid line, so half of `2026-06`\n // — or of `3300` — would be drawn outside the node's box and outside\n // the rectangle the editor draws around it. Only the right edge is\n // held, because the left one has the vertical axis's whole gutter\n // beyond it, and a marker overhanging into that is inside the chart.\n const limit = width / 2 - marker.layoutBounds.width / 2;\n return Math.min(centred, limit);\n },\n });\n return marker;\n });\n\n const children: Node2D[] = [\n new Rect({\n width: \"fill\",\n height: \"hug\",\n padding: { top: tickPad },\n children: this.markerNodes,\n }),\n ];\n if (this.label !== \"\") {\n this.labelNode = new Text({\n ...textOps.styleProps(this.axis.titleStyle),\n text: this.label,\n });\n children.push(this.labelNode);\n }\n\n this.add(\n new Rect({ flow: \"vertical\", gap: titlePad, height: \"hug\", width: \"fill\", children }),\n );\n }\n\n /**\n * Primes every marker (and the caption) at its pre-entrance state: lifted\n * above its slot and transparent. Idempotent — see {@link VerticalAxis.arm}.\n */\n arm(slide = SLIDE): void {\n for (const marker of this.markerNodes) marker.set({ opacity: 0, y: slide });\n this.labelNode?.set({ opacity: 0, y: slide });\n }\n\n /**\n * Stagger the markers in left to right, then slide the caption in after them.\n *\n * A {@link Seekable} rather than a generator. The offsets were always static —\n * `i * step` per marker — but expressed as `wait` inside a generator they only\n * existed while it ran, so knowing what the axis looked like partway through\n * meant running it from zero. Placed explicitly, the same stagger can be asked\n * for a time, which is what lets a chart scene scrub in constant time.\n *\n * `duration` is the **whole** entrance — see {@link VerticalAxis.enter} and\n * {@link enterBudget}.\n */\n @command()\n enter(\n args: CommandArgs<{ stagger?: number; slide?: number }> & { duration: number },\n ): Seekable {\n const { stagger, slide = SLIDE } = args.data ?? {};\n const duration = args.duration;\n const easing = args.easing ?? easeOut();\n const nodes = this.markerNodes;\n if (nodes.length === 0) return compose([]);\n const { step, per, caption } = enterBudget(\n duration,\n nodes.length,\n this.labelNode !== null,\n stagger,\n );\n\n this.arm(slide);\n\n // Left marker leads: markerNodes is already left → right.\n const markers = nodes.map((node, i) =>\n at(i * step, node.to({ data: { opacity: 1, y: 0 }, duration: per, easing })),\n );\n const lastMarkerEnds = nodes.length === 0 ? 0 : (nodes.length - 1) * step + per;\n\n return compose([\n ...markers,\n ...(this.labelNode\n ? [at(lastMarkerEnds, this.labelNode.to({ data: { opacity: 1, y: 0 }, duration: caption, easing }))]\n : []),\n ]);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"horizontal-axis.js","sourceRoot":"","sources":["../../src/line-chart/horizontal-axis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,IAAI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KAAK,KAAK,CAAC;oBAAE,OAAO,GAAG,CAAC;gBAC5B,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;gBACzF,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;gBACjC,sDAAsD;gBACtD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBACxH,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpI,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3E,CAAC;SACF;KACF;CACF,CAAC,CAAC","sourcesContent":["import {\n Rect,\n Text,\n Types,\n component2d,\n insetsOps,\n textOps,\n type NodeOf,\n type Node2D,\n} from \"@motionscript/sdk\";\n\nimport { asParts, fresh } from \"../kit/entries\";\nimport { armed, arrival, arrivalOf, arrivalsEntry, beats, frameEase, type Arrival } from \"../kit/motion\";\nimport {\n DEFAULT_X_AXIS,\n enterBudget,\n type AxisConfig,\n type Range,\n} from \"../kit/shared\";\nimport { markerCaption } from \"../kit/vertical-axis\";\n\n/** How far a marker starts above its slot when it enters, in px. */\nconst SLIDE = 24;\n\n/**\n * The horizontal axis of a {@link LineChart}: a **row of {@link Text} nodes**,\n * one per marker value, running left-to-right. Pure layout — the mirror of the\n * kit's `VerticalAxis`, including its bound (not snapshotted) marker text and\n * positions, and its landed resting state.\n *\n * Markers are always placed **by value** across the range, whatever they say:\n * `2026-03` sits three months along, not three slots along. That is what keeps\n * it distinct from a bar chart's bottom axis, which centres a caption on each\n * slot and has no scale at all — the two only look alike. What the values are\n * captioned *as* is the chart's to decide, in `captions`.\n *\n * `enter` staggers the markers in **left-to-right**: each starts lifted a\n * little above its slot and transparent, then fades and slides down into place.\n */\nexport const HorizontalAxis = component2d({\n key: \"horizontalAxis\",\n state: {\n /** `[min, max]` of the horizontal scale the markers are positioned within. */\n range: fresh<Range>(() => [0, 1]),\n /** Tick values (in data units) to draw along the axis. */\n markers: fresh<number[]>(() => []),\n /**\n * How each marker is captioned, one per entry of `markers` and in its order.\n * Empty (the default), or short, captions a marker with its bare numeric\n * reading; a chart whose x column names months or categories writes those.\n */\n captions: fresh<string[]>(() => []),\n /** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */\n axis: Types.custom<AxisConfig>(DEFAULT_X_AXIS),\n /** Caption drawn centred in the gutter beneath the marker row; empty (the default) hides it. */\n label: \"\",\n arrivals: arrivalsEntry(),\n },\n // A plain node filled its parent; one made of its markers would hug them.\n defaults: { width: \"fill\", height: \"fill\" },\n children: (state) => {\n const tickPad = insetsOps.resolve(state.axis.tickPadding).top;\n const titlePad = insetsOps.resolve(state.axis.titlePadding).top;\n\n const column: Node2D[] = [];\n // The column's parent is the axis: its box is what the markers are placed in.\n const box = () => (column[0]?.parent as Node2D | null | undefined)?.layoutBounds ?? { width: 0, height: 0 };\n /** The live tick values, left → right — re-read every frame, not snapshotted. */\n const sorted = () => [...state.markers].sort((a, b) => a - b);\n /** Tick `i`'s fraction across the live `range`, 0 at the left edge. */\n const fracAt = (value: number | undefined) => {\n if (value === undefined) return 0;\n const [min, max] = state.range;\n return max <= min ? 0 : (value - min) / (max - min);\n };\n\n const markers = state.markers.map((_, i) => {\n const marker: Node2D = new Text({\n ...textOps.styleProps(state.axis.labelStyle),\n text: () => {\n const value = sorted()[i];\n return value === undefined ? \"\" : markerCaption(state, value);\n },\n x: () => {\n const width = box().width;\n const centred = (fracAt(sorted()[i]) - 0.5) * width;\n // Held inside the axis's right edge, which is also the *chart's*: the\n // last marker is centred on the last grid line, so half of `2026-06`\n // — or of `3300` — would be drawn outside the node's box and outside\n // the rectangle the editor draws around it. Only the right edge is\n // held, because the left one has the vertical axis's whole gutter\n // beyond it, and a marker overhanging into that is inside the chart.\n const limit = width / 2 - marker.layoutBounds.width / 2;\n return Math.min(centred, limit);\n },\n opacity: () => arrivalOf(state.arrivals, i).opacity,\n y: () => arrivalOf(state.arrivals, i).shift,\n });\n return marker;\n });\n\n const children: Node2D[] = [\n new Rect({ width: \"fill\", height: \"hug\", padding: { top: tickPad }, children: markers }),\n ];\n if (state.label !== \"\") {\n children.push(\n new Text({\n ...textOps.styleProps(state.axis.titleStyle),\n text: state.label,\n opacity: () => arrivalOf(state.arrivals, \"label\").opacity,\n y: () => arrivalOf(state.arrivals, \"label\").shift,\n }),\n );\n }\n\n column.push(new Rect({ flow: \"vertical\", gap: titlePad, height: \"hug\", width: \"fill\", children }));\n return asParts(column);\n },\n commands: {\n /**\n * Stagger the markers in left to right, then slide the caption in after\n * them. Its first frame arms them all: lifted by `slide` and transparent.\n *\n * The timeline's duration is the **whole** entrance — see\n * `VerticalAxis.enter` and {@link enterBudget}.\n */\n enter: {\n args: {\n stagger: Types.custom<number | undefined>(undefined),\n slide: Types.number(SLIDE),\n },\n run: (timeline, state) => {\n const { stagger, slide } = timeline.args;\n const count = state.markers.length;\n const captioned = state.label !== \"\";\n const from: Arrival = { opacity: 0, shift: slide };\n const keys = [...state.markers.keys(), ...(captioned ? [\"label\"] : [])];\n const arm = timeline.animate(() => ({ arrivals: armed(keys, from) }));\n if (count === 0) return arm;\n const { step, per, caption } = enterBudget(timeline.duration, count, captioned, stagger);\n const ease = frameEase(timeline);\n // Left marker leads: the row is already left → right.\n const markers = state.markers.map((_, i) => ({ at: i * step, duration: per, piece: arrival(timeline, i, from, ease) }));\n const label = captioned ? [{ at: (count - 1) * step + per, duration: caption, piece: arrival(timeline, \"label\", from, ease) }] : [];\n return timeline.together([arm, beats(timeline, [...markers, ...label])]);\n },\n },\n },\n});\n\nexport type HorizontalAxis = NodeOf<typeof HorizontalAxis>;\n"]}
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
* (the plot panel, the value axis, the legend); each part is exported too, so
|
|
7
7
|
* another node type can reuse one on its own.
|
|
8
8
|
*
|
|
9
|
-
* These files are what
|
|
9
|
+
* These files are what a copy of the line chart takes (`registry.json`). Everything they reach for
|
|
10
10
|
* that is *not* here comes from the kit and stays a dependency — see
|
|
11
11
|
* `../engine.ts` for why that line is where it is.
|
|
12
12
|
*/
|
|
13
|
-
export { LineChart } from "./line-chart.js";
|
|
14
|
-
export type { LineChartProps } from "./line-chart.js";
|
|
13
|
+
export { LineChart, lineChartDomains } from "./line-chart.js";
|
|
14
|
+
export type { LineChartDomains, LineChartProps, LineChartValues } from "./line-chart.js";
|
|
15
15
|
export { ChartRegion } from "./chart-region.js";
|
|
16
16
|
export { ChartLine } from "./chart-line.js";
|
|
17
17
|
export { HorizontalAxis } from "./horizontal-axis.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/line-chart/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/line-chart/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC1D,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,OAAO,GACR,MAAM,UAAU,CAAA;AACjB,YAAY,EACV,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,YAAY,GACb,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACtE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/line-chart/index.js
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* (the plot panel, the value axis, the legend); each part is exported too, so
|
|
7
7
|
* another node type can reuse one on its own.
|
|
8
8
|
*
|
|
9
|
-
* These files are what
|
|
9
|
+
* These files are what a copy of the line chart takes (`registry.json`). Everything they reach for
|
|
10
10
|
* that is *not* here comes from the kit and stays a dependency — see
|
|
11
11
|
* `../engine.ts` for why that line is where it is.
|
|
12
12
|
*/
|
|
13
|
-
export { LineChart } from "./line-chart.js";
|
|
13
|
+
export { LineChart, lineChartDomains } from "./line-chart.js";
|
|
14
14
|
export { ChartRegion } from "./chart-region.js";
|
|
15
15
|
export { ChartLine } from "./chart-line.js";
|
|
16
16
|
export { HorizontalAxis } from "./horizontal-axis.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/line-chart/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/line-chart/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,OAAO,GACR,MAAM,UAAU,CAAA;AASjB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA","sourcesContent":["/**\n * The line chart: a cartesian plot with a traced polyline, spotlit regions and\n * a staggered entrance.\n *\n * {@link LineChart} composes the parts below plus the shared ones in the kit\n * (the plot panel, the value axis, the legend); each part is exported too, so\n * another node type can reuse one on its own.\n *\n * These files are what a copy of the line chart takes (`registry.json`). Everything they reach for\n * that is *not* here comes from the kit and stays a dependency — see\n * `../engine.ts` for why that line is where it is.\n */\nexport { LineChart, lineChartDomains } from \"./line-chart\"\nexport type { LineChartDomains, LineChartProps, LineChartValues } from \"./line-chart\"\nexport { ChartRegion } from \"./chart-region\"\nexport { ChartLine } from \"./chart-line\"\nexport { HorizontalAxis } from \"./horizontal-axis\"\nexport {\n DEFAULT_CHART_THEME,\n EMPTY_REGION_BOX,\n clipPolylineToBox,\n hasRegion,\n lerpChartTheme,\n resolveChartTheme,\n resolveRegionBox,\n resolveYScale,\n seriesPoints,\n yExtent,\n} from \"./shared\"\nexport type {\n ChartConfig,\n ChartTheme,\n LineSeries,\n PlotRegion,\n RegionBox,\n RegionConfig,\n} from \"./shared\"\nexport { formatInstant, parseInstant, resolveXScale } from \"./x-scale\"\nexport type { XScale, XScaleKind } from \"./x-scale\"\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type AxisDomainConfig } from "../kit/shared.js";
|
|
3
|
-
import { type ChartTheme, type LineSeries, type PlotRegion } from "./shared.js";
|
|
4
|
-
import { type Seekable } from "@motionscript/core/component";
|
|
1
|
+
import { type DataRecord, type NodeOf, type Node2D, type Node2DProps } from "@motionscript/sdk";
|
|
2
|
+
import { type AxisDomainConfig, type Range } from "../kit/shared.js";
|
|
3
|
+
import { type ChartConfig, type ChartTheme, type LineSeries, type PlotRegion } from "./shared.js";
|
|
5
4
|
export interface LineChartProps extends Node2DProps {
|
|
6
5
|
/** One row per sample — a plain record of field name to value. */
|
|
7
6
|
data: DataRecord[];
|
|
@@ -19,8 +18,8 @@ export interface LineChartProps extends Node2DProps {
|
|
|
19
18
|
/**
|
|
20
19
|
* A slice of the plot to spotlight, in **data units**. Dashed rules mark the
|
|
21
20
|
* bounded edges and every series fades outside the box — see
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* `spotlightRegion`, which animates the same thing. `null` (the default) is no
|
|
22
|
+
* region.
|
|
24
23
|
*/
|
|
25
24
|
region?: PlotRegion | null;
|
|
26
25
|
/**
|
|
@@ -32,18 +31,27 @@ export interface LineChartProps extends Node2DProps {
|
|
|
32
31
|
/** Whether the legend row below the plot is drawn at all. */
|
|
33
32
|
showLegend?: boolean;
|
|
34
33
|
}
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
/** Both axes' domains with their ranges and ticks resolved. */
|
|
35
|
+
export interface LineChartDomains {
|
|
36
|
+
readonly x: AxisDomainConfig & {
|
|
37
|
+
readonly range: Range;
|
|
38
|
+
readonly ticks: number[];
|
|
39
|
+
};
|
|
40
|
+
readonly y: AxisDomainConfig & {
|
|
41
|
+
readonly range: Range;
|
|
42
|
+
readonly ticks: number[];
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** What a line chart plots, as its entries hold it. */
|
|
46
|
+
export interface LineChartValues {
|
|
47
|
+
readonly data: DataRecord[];
|
|
48
|
+
readonly xField: string;
|
|
49
|
+
readonly series: LineSeries[];
|
|
50
|
+
readonly xAxis: AxisDomainConfig;
|
|
51
|
+
readonly yAxis: AxisDomainConfig;
|
|
52
|
+
}
|
|
53
|
+
/** Both axes as a line chart draws them now, an auto range or tick row read back as itself. */
|
|
54
|
+
export declare function lineChartDomains(s: LineChartValues): LineChartDomains;
|
|
47
55
|
/**
|
|
48
56
|
* A multi-series line chart, composed from five independent parts rather than
|
|
49
57
|
* one monolithic draw:
|
|
@@ -56,292 +64,137 @@ type RegionState = {
|
|
|
56
64
|
* - {@link ChartLine} (one per series) — the traced polylines over the canvas.
|
|
57
65
|
* - {@link ChartLegend} — a row of entries below the chart, one per series.
|
|
58
66
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* and the series lines read the same resolved scales as the axes, so points land
|
|
64
|
-
* exactly on their markers.
|
|
67
|
+
* Every part reads the chart's entries through bindings, and the lines, the
|
|
68
|
+
* region and the grid all map against the plot panel's own laid-out box, so
|
|
69
|
+
* points land exactly on their markers and the chart re-flows if its box
|
|
70
|
+
* changes.
|
|
65
71
|
*
|
|
66
|
-
* **Resting state is the finished chart
|
|
67
|
-
*
|
|
68
|
-
* state on a paused canvas, and a chart that only appeared once a command had
|
|
69
|
-
* run would be edited blind. {@link enter} arms every part back to its
|
|
70
|
-
* pre-entrance state before animating, so the entrance itself is unchanged.
|
|
72
|
+
* **Resting state is the finished chart**: an editor paints a node's Initial
|
|
73
|
+
* state on a paused canvas. `enter` arms every part on its first frame.
|
|
71
74
|
*
|
|
72
|
-
* Past the entrance,
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
75
|
+
* Past the entrance, `showSeries`/`hideSeries`/`spotlightSeries` pick out a
|
|
76
|
+
* *series*, `spotlightRegion` marks a *slice of the plot* without changing the
|
|
77
|
+
* scale, and `zoomTo` rescales the axes so a slice fills the plot. A spotlit
|
|
78
|
+
* region resolves against the live scales, so it travels with a zoom. A `to` of
|
|
79
|
+
* an axis `range` or `ticks` tweens from the domain as drawn (see
|
|
80
|
+
* {@link lerpAxisEntry}), so an auto axis rescales continuously.
|
|
78
81
|
*/
|
|
79
|
-
export declare
|
|
80
|
-
data: DataRecord[]
|
|
81
|
-
xField:
|
|
82
|
-
series:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
*
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
*
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*/
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
*
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
*
|
|
159
|
-
* the
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
* {@link resolveRegionBox} applies before it maps anything: a region bounding
|
|
198
|
-
* *neither* axis is not a call-out, so `{}` counts as none exactly as `null`
|
|
199
|
-
* does.
|
|
200
|
-
*/
|
|
201
|
-
private hasCallout;
|
|
202
|
-
private regionBox;
|
|
203
|
-
constructor(props?: NodeConfig<LineChart, LineChartProps>);
|
|
204
|
-
/**
|
|
205
|
-
* Prime every part at its pre-entrance state — axis markers shifted and
|
|
206
|
-
* transparent, lines untraced, legend dropped and transparent.
|
|
207
|
-
*
|
|
208
|
-
* Called by {@link enter} before its first frame so nothing flashes ahead of
|
|
209
|
-
* its beat. Idempotent, and public so a scene can hide a chart ahead of time
|
|
210
|
-
* without starting the entrance.
|
|
211
|
-
*/
|
|
212
|
-
arm(): void;
|
|
213
|
-
/**
|
|
214
|
-
* Animate the whole chart in: the two axes stagger their markers in (vertical
|
|
215
|
-
* bottom-to-top, horizontal left-to-right), the series lines trace
|
|
216
|
-
* left-to-right, and the legend fades up last.
|
|
217
|
-
*
|
|
218
|
-
* `duration` is the **whole** entrance. The phases below are shares of it, not
|
|
219
|
-
* multiples — a command that declares 1.4 seconds has to take 1.4 seconds,
|
|
220
|
-
* because that is the slot the timeline lays out for it, the length its
|
|
221
|
-
* parallel siblings are timed against, and its contribution to the scene's own
|
|
222
|
-
* duration. (The component this was ported from scaled every phase *off* the
|
|
223
|
-
* line trace and let the total fall where it may, which came out around 3×.)
|
|
224
|
-
*
|
|
225
|
-
* A chart authored with a `region` lands its call-out last, over lines that
|
|
226
|
-
* have already traced — the same order a scene would get by calling
|
|
227
|
-
* {@link spotlightRegion} right after this — and that beat comes out of the
|
|
228
|
-
* same budget.
|
|
229
|
-
*/
|
|
230
|
-
enter(args: CommandArgs<Record<string, never>> & {
|
|
231
|
-
duration: number;
|
|
232
|
-
}): Seekable;
|
|
233
|
-
/**
|
|
234
|
-
* Spotlight a rectangular slice of the plot given in **data units**: dashed
|
|
235
|
-
* rules draw themselves onto each bounded edge while every series fades
|
|
236
|
-
* outside the box and stays full inside it.
|
|
237
|
-
*
|
|
238
|
-
* Either axis alone is a band — `{ x: [80, 100] }` picks out the last fifth
|
|
239
|
-
* across all series, `{ y: [8, 10] }` a value band across the whole width —
|
|
240
|
-
* and both together a box. The unbounded axis spans the plot and draws no
|
|
241
|
-
* rule, since there's no data bound there to mark.
|
|
242
|
-
*
|
|
243
|
-
* Calling it while another region is already up cross-fades: the old call-out
|
|
244
|
-
* retracts, then the new one draws in, each over half `duration`.
|
|
245
|
-
*
|
|
246
|
-
* Both the call-out's shape and its draw-on are plain signals — `region` and
|
|
247
|
-
* {@link regionReveal} — so the whole thing is a function of `t`, including
|
|
248
|
-
* the swap: which region is up is a step at the halfway point rather than an
|
|
249
|
-
* effect that has to have happened.
|
|
250
|
-
*/
|
|
251
|
-
spotlightRegion(args: CommandArgs<{
|
|
252
|
-
region: PlotRegion;
|
|
253
|
-
}> & {
|
|
254
|
-
duration?: number;
|
|
255
|
-
}): Command<RegionState>;
|
|
256
|
-
/**
|
|
257
|
-
* Drop the region call-out — the rules retract, the wash fades, and every
|
|
258
|
-
* series comes back to full across its whole length. A no-op when nothing is
|
|
259
|
-
* spotlit.
|
|
260
|
-
*/
|
|
261
|
-
clearRegion(args?: CommandArgs<Record<string, never>> & {
|
|
262
|
-
duration?: number;
|
|
263
|
-
}): Command<RegionState>;
|
|
264
|
-
/**
|
|
265
|
-
* The domain to come back to, captured the first time {@link zoomTo} runs so a
|
|
266
|
-
* later {@link resetZoom} restores the chart as authored — including ticks
|
|
267
|
-
* that were auto-derived rather than given, which the props alone don't
|
|
268
|
-
* record. Cleared by {@link resetZoom}, so a second zoom captures wherever the
|
|
269
|
-
* chart genuinely rests then.
|
|
270
|
-
*/
|
|
271
|
-
private home;
|
|
272
|
-
/**
|
|
273
|
-
* The `region` a document handed a command, or `{}`. A command is added
|
|
274
|
-
* before its arguments are filled in, so an unstated region is ordinary input
|
|
275
|
-
* rather than a malformed one.
|
|
276
|
-
*/
|
|
277
|
-
private static regionArg;
|
|
278
|
-
/** A range read as a span, whichever way round the author wrote it. */
|
|
279
|
-
private static span;
|
|
280
|
-
/**
|
|
281
|
-
* Rescale an axis to `range`, keeping the tick *count* it already has — the
|
|
282
|
-
* axis tween interpolates ticks pairwise by index, so a constant count lets
|
|
283
|
-
* each marker slide from its old value to its new one instead of the row
|
|
284
|
-
* popping.
|
|
285
|
-
*/
|
|
286
|
-
private static rescale;
|
|
287
|
-
/**
|
|
288
|
-
* Zoom the plot to a slice of itself, given in **data units**: the named axes
|
|
289
|
-
* rescale so that slice fills the plot, the grid and both marker rows
|
|
290
|
-
* following the new scale, and every series re-tracing itself into the new
|
|
291
|
-
* frame. All of it tweens, so the move reads as a camera push rather than a
|
|
292
|
-
* cut.
|
|
293
|
-
*
|
|
294
|
-
* An **omitted axis is left as it is** rather than being fitted to what's
|
|
295
|
-
* visible — so a zoom is exactly what was asked for, and two calls compose
|
|
296
|
-
* predictably. A spotlit region, if one is up, follows the zoom: it resolves
|
|
297
|
-
* against the same live scales, so its rules stay on their data bounds.
|
|
298
|
-
*/
|
|
299
|
-
zoomTo(args: CommandArgs<{
|
|
300
|
-
region: PlotRegion;
|
|
301
|
-
}> & {
|
|
302
|
-
duration?: number;
|
|
303
|
-
}): Seekable;
|
|
304
|
-
/**
|
|
305
|
-
* Pull back out to the domain the chart was authored with — the mirror of
|
|
306
|
-
* {@link zoomTo}, and a no-op if it was never zoomed.
|
|
307
|
-
*/
|
|
308
|
-
resetZoom(args?: CommandArgs<Record<string, never>> & {
|
|
309
|
-
duration?: number;
|
|
310
|
-
}): Seekable;
|
|
311
|
-
/**
|
|
312
|
-
* Show series `index`: **trace** its line in left-to-right — the same draw as
|
|
313
|
-
* {@link enter}, not an opacity fade — in lockstep with its legend entry
|
|
314
|
-
* growing in.
|
|
315
|
-
*
|
|
316
|
-
* `enabled` is set as part of the command's own value rather than before it,
|
|
317
|
-
* so the line is drawable for every `t` the trace covers and undrawn outside
|
|
318
|
-
* it — which is what makes arriving here backwards show the same thing as
|
|
319
|
-
* arriving forwards.
|
|
320
|
-
*/
|
|
321
|
-
showSeries(args: CommandArgs<{
|
|
322
|
-
seriesIndex: number;
|
|
323
|
-
}> & {
|
|
324
|
-
duration?: number;
|
|
325
|
-
}): Seekable;
|
|
326
|
-
/**
|
|
327
|
-
* Hide series `index`: **retrace** its line back out (`progress` 1 → 0) as its
|
|
328
|
-
* legend entry shrinks away — the mirror of {@link showSeries}.
|
|
329
|
-
*/
|
|
330
|
-
hideSeries(args: CommandArgs<{
|
|
331
|
-
seriesIndex: number;
|
|
332
|
-
}> & {
|
|
333
|
-
duration?: number;
|
|
334
|
-
}): Seekable;
|
|
335
|
-
/**
|
|
336
|
-
* Fade out all other series — each line **and its legend entry** — to focus
|
|
337
|
-
* attention on `index`, which comes back to full. The legend dims in place
|
|
338
|
-
* (opacity only), so no entry moves and the row doesn't reflow.
|
|
339
|
-
*/
|
|
340
|
-
spotlightSeries(args: CommandArgs<{
|
|
341
|
-
seriesIndex: number;
|
|
342
|
-
}> & {
|
|
343
|
-
duration?: number;
|
|
344
|
-
}): Seekable;
|
|
345
|
-
}
|
|
346
|
-
export {};
|
|
82
|
+
export declare const LineChart: import("@motionscript/sdk").Component<"lineChart", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
83
|
+
readonly data: import("@motionscript/sdk").Type<DataRecord[], DataRecord[], false>;
|
|
84
|
+
readonly xField: "";
|
|
85
|
+
readonly series: import("@motionscript/sdk").Type<import("../index.js").ChartSeries[], import("../index.js").ChartSeries[], false>;
|
|
86
|
+
readonly xAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
|
|
87
|
+
readonly yAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
|
|
88
|
+
readonly theme: import("@motionscript/sdk").Type<ChartTheme, ChartConfig, false>;
|
|
89
|
+
/**
|
|
90
|
+
* The spotlit slice of the plot in data units, or `null` for none. The box
|
|
91
|
+
* snaps; the animation is {@link regionReveal} drawing the rules on.
|
|
92
|
+
*/
|
|
93
|
+
readonly region: import("@motionscript/sdk").Type<PlotRegion | null, PlotRegion | null, false>;
|
|
94
|
+
/**
|
|
95
|
+
* How far the `region` call-out is drawn in, `[0, 1]`: the rules grow out and
|
|
96
|
+
* the wash fades up as it climbs, while every line's out-of-region stretch
|
|
97
|
+
* fades to the theme's `region.dimOpacity`.
|
|
98
|
+
*/
|
|
99
|
+
readonly regionReveal: 0;
|
|
100
|
+
/** Read as the chart is built: the legend is a part the chart builds or doesn't. */
|
|
101
|
+
readonly showLegend: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
102
|
+
/**
|
|
103
|
+
* The domain `zoomTo` first left, so `resetZoom` restores the chart as it
|
|
104
|
+
* stood, auto-derived ticks included. Cleared by `resetZoom`, so the next zoom
|
|
105
|
+
* remembers wherever the chart rests then.
|
|
106
|
+
*/
|
|
107
|
+
readonly home: import("@motionscript/sdk").Type<LineChartDomains | null, LineChartDomains | null, false>;
|
|
108
|
+
}>, {
|
|
109
|
+
readonly enter: {};
|
|
110
|
+
readonly spotlightRegion: {
|
|
111
|
+
readonly region: import("@motionscript/sdk").Type<PlotRegion | undefined, PlotRegion | undefined, false>;
|
|
112
|
+
};
|
|
113
|
+
readonly clearRegion: {};
|
|
114
|
+
readonly zoomTo: {
|
|
115
|
+
readonly region: import("@motionscript/sdk").Type<PlotRegion | undefined, PlotRegion | undefined, false>;
|
|
116
|
+
};
|
|
117
|
+
readonly resetZoom: {};
|
|
118
|
+
readonly showSeries: {
|
|
119
|
+
readonly seriesIndex: import("@motionscript/sdk").Type<number, number, false>;
|
|
120
|
+
};
|
|
121
|
+
readonly hideSeries: {
|
|
122
|
+
readonly seriesIndex: import("@motionscript/sdk").Type<number, number, false>;
|
|
123
|
+
};
|
|
124
|
+
readonly spotlightSeries: {
|
|
125
|
+
readonly seriesIndex: import("@motionscript/sdk").Type<number, number, false>;
|
|
126
|
+
};
|
|
127
|
+
}, readonly [], Node2D<Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
128
|
+
readonly data: import("@motionscript/sdk").Type<DataRecord[], DataRecord[], false>;
|
|
129
|
+
readonly xField: "";
|
|
130
|
+
readonly series: import("@motionscript/sdk").Type<import("../index.js").ChartSeries[], import("../index.js").ChartSeries[], false>;
|
|
131
|
+
readonly xAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
|
|
132
|
+
readonly yAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
|
|
133
|
+
readonly theme: import("@motionscript/sdk").Type<ChartTheme, ChartConfig, false>;
|
|
134
|
+
/**
|
|
135
|
+
* The spotlit slice of the plot in data units, or `null` for none. The box
|
|
136
|
+
* snaps; the animation is {@link regionReveal} drawing the rules on.
|
|
137
|
+
*/
|
|
138
|
+
readonly region: import("@motionscript/sdk").Type<PlotRegion | null, PlotRegion | null, false>;
|
|
139
|
+
/**
|
|
140
|
+
* How far the `region` call-out is drawn in, `[0, 1]`: the rules grow out and
|
|
141
|
+
* the wash fades up as it climbs, while every line's out-of-region stretch
|
|
142
|
+
* fades to the theme's `region.dimOpacity`.
|
|
143
|
+
*/
|
|
144
|
+
readonly regionReveal: 0;
|
|
145
|
+
/** Read as the chart is built: the legend is a part the chart builds or doesn't. */
|
|
146
|
+
readonly showLegend: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
147
|
+
/**
|
|
148
|
+
* The domain `zoomTo` first left, so `resetZoom` restores the chart as it
|
|
149
|
+
* stood, auto-derived ticks included. Cleared by `resetZoom`, so the next zoom
|
|
150
|
+
* remembers wherever the chart rests then.
|
|
151
|
+
*/
|
|
152
|
+
readonly home: import("@motionscript/sdk").Type<LineChartDomains | null, LineChartDomains | null, false>;
|
|
153
|
+
}>, readonly [], import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
154
|
+
readonly data: import("@motionscript/sdk").Type<DataRecord[], DataRecord[], false>;
|
|
155
|
+
readonly xField: "";
|
|
156
|
+
readonly series: import("@motionscript/sdk").Type<import("../index.js").ChartSeries[], import("../index.js").ChartSeries[], false>;
|
|
157
|
+
readonly xAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
|
|
158
|
+
readonly yAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
|
|
159
|
+
readonly theme: import("@motionscript/sdk").Type<ChartTheme, ChartConfig, false>;
|
|
160
|
+
/**
|
|
161
|
+
* The spotlit slice of the plot in data units, or `null` for none. The box
|
|
162
|
+
* snaps; the animation is {@link regionReveal} drawing the rules on.
|
|
163
|
+
*/
|
|
164
|
+
readonly region: import("@motionscript/sdk").Type<PlotRegion | null, PlotRegion | null, false>;
|
|
165
|
+
/**
|
|
166
|
+
* How far the `region` call-out is drawn in, `[0, 1]`: the rules grow out and
|
|
167
|
+
* the wash fades up as it climbs, while every line's out-of-region stretch
|
|
168
|
+
* fades to the theme's `region.dimOpacity`.
|
|
169
|
+
*/
|
|
170
|
+
readonly regionReveal: 0;
|
|
171
|
+
/** Read as the chart is built: the legend is a part the chart builds or doesn't. */
|
|
172
|
+
readonly showLegend: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
173
|
+
/**
|
|
174
|
+
* The domain `zoomTo` first left, so `resetZoom` restores the chart as it
|
|
175
|
+
* stood, auto-derived ticks included. Cleared by `resetZoom`, so the next zoom
|
|
176
|
+
* remembers wherever the chart rests then.
|
|
177
|
+
*/
|
|
178
|
+
readonly home: import("@motionscript/sdk").Type<LineChartDomains | null, LineChartDomains | null, false>;
|
|
179
|
+
}>, {
|
|
180
|
+
readonly enter: {};
|
|
181
|
+
readonly spotlightRegion: {
|
|
182
|
+
readonly region: import("@motionscript/sdk").Type<PlotRegion | undefined, PlotRegion | undefined, false>;
|
|
183
|
+
};
|
|
184
|
+
readonly clearRegion: {};
|
|
185
|
+
readonly zoomTo: {
|
|
186
|
+
readonly region: import("@motionscript/sdk").Type<PlotRegion | undefined, PlotRegion | undefined, false>;
|
|
187
|
+
};
|
|
188
|
+
readonly resetZoom: {};
|
|
189
|
+
readonly showSeries: {
|
|
190
|
+
readonly seriesIndex: import("@motionscript/sdk").Type<number, number, false>;
|
|
191
|
+
};
|
|
192
|
+
readonly hideSeries: {
|
|
193
|
+
readonly seriesIndex: import("@motionscript/sdk").Type<number, number, false>;
|
|
194
|
+
};
|
|
195
|
+
readonly spotlightSeries: {
|
|
196
|
+
readonly seriesIndex: import("@motionscript/sdk").Type<number, number, false>;
|
|
197
|
+
};
|
|
198
|
+
}, Node2D<Node2DProps>>>>;
|
|
199
|
+
export type LineChart = NodeOf<typeof LineChart>;
|
|
347
200
|
//# sourceMappingURL=line-chart.d.ts.map
|