@motionscript/charts 0.1.0-alpha.5 → 0.1.0-alpha.7
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 +40 -0
- package/README.md +30 -16
- package/dist/bar-chart/bar-chart.d.ts +133 -242
- package/dist/bar-chart/bar-chart.d.ts.map +1 -1
- package/dist/bar-chart/bar-chart.js +378 -569
- 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 +156 -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 +3 -3
- package/dist/bar-chart/shared.d.ts.map +1 -1
- package/dist/bar-chart/shared.js +3 -3
- package/dist/bar-chart/shared.js.map +1 -1
- package/dist/browser/chunks/chunk-XROBIRQK.js +2 -0
- package/dist/browser/chunks/chunk-XROBIRQK.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 +1 -1
- package/dist/engine.d.ts +8 -6
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +8 -6
- 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 -64
- package/dist/kit/chart-legend.d.ts.map +1 -1
- package/dist/kit/chart-legend.js +129 -154
- 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 +31 -3
- package/dist/kit/shared.d.ts.map +1 -1
- package/dist/kit/shared.js +42 -3
- 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 +2 -2
- package/dist/line-chart/index.d.ts.map +1 -1
- package/dist/line-chart/index.js +1 -1
- package/dist/line-chart/index.js.map +1 -1
- package/dist/line-chart/line-chart.d.ts +156 -319
- package/dist/line-chart/line-chart.d.ts.map +1 -1
- package/dist/line-chart/line-chart.js +403 -663
- package/dist/line-chart/line-chart.js.map +1 -1
- package/dist/line-chart/shared.d.ts +3 -3
- package/dist/line-chart/shared.d.ts.map +1 -1
- package/dist/line-chart/shared.js +3 -3
- package/dist/line-chart/shared.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 -132
- package/dist/pie-chart/pie-chart.d.ts.map +1 -1
- package/dist/pie-chart/pie-chart.js +200 -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 -131
- package/dist/pie-chart/pie-ring.d.ts.map +1 -1
- package/dist/pie-chart/pie-ring.js +333 -391
- package/dist/pie-chart/pie-ring.js.map +1 -1
- package/dist/pie-chart/shared.d.ts +2 -2
- package/dist/pie-chart/shared.d.ts.map +1 -1
- package/dist/pie-chart/shared.js +2 -2
- package/dist/pie-chart/shared.js.map +1 -1
- package/package.json +4 -4
- package/src/bar-chart/bar-chart.ts +415 -701
- package/src/bar-chart/category-axis.ts +95 -110
- package/src/bar-chart/chart-bars.ts +178 -200
- package/src/bar-chart/index.ts +2 -2
- package/src/bar-chart/shared.ts +3 -3
- package/src/engine.ts +8 -6
- package/src/kit/cartesian.ts +81 -0
- package/src/kit/chart-border.ts +22 -33
- package/src/kit/chart-canvas.ts +44 -79
- package/src/kit/chart-legend.ts +173 -189
- 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 +52 -3
- package/src/kit/vertical-axis.ts +110 -140
- package/src/line-chart/chart-line.ts +102 -154
- package/src/line-chart/chart-region.ts +35 -80
- package/src/line-chart/horizontal-axis.ts +101 -152
- package/src/line-chart/index.ts +2 -2
- package/src/line-chart/line-chart.ts +449 -825
- package/src/line-chart/shared.ts +3 -3
- package/src/nodes.ts +8 -10
- package/src/pie-chart/index.ts +2 -2
- package/src/pie-chart/pie-chart.ts +221 -311
- package/src/pie-chart/pie-legend.ts +124 -114
- package/src/pie-chart/pie-ring.ts +386 -473
- package/src/pie-chart/shared.ts +2 -2
- package/dist/browser/chunks/chunk-5ZPBV6BU.js +0 -2
- package/dist/browser/chunks/chunk-5ZPBV6BU.js.map +0 -7
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { command, Node2D, Rect, RotatedBox, Text, easeOut, property, insetsOps, textOps, } from "@motionscript/sdk";
|
|
1
|
+
import { Rect, RotatedBox, Text, Types, component2d, insetsOps, textOps, } from "@motionscript/sdk";
|
|
2
|
+
import { asParts, fresh } from "./entries.js";
|
|
3
|
+
import { armed, arrival, arrivalOf, arrivalsEntry, beats, frameEase } from "./motion.js";
|
|
8
4
|
import { DEFAULT_Y_AXIS, enterBudget, formatMarker, } from "./shared.js";
|
|
9
|
-
import { at, compose } from "@motionscript/sdk/component";
|
|
10
5
|
/** How far a marker starts to the right of its slot when it enters, in px. */
|
|
11
6
|
const SLIDE = 24;
|
|
7
|
+
/** What a marker's caption reads: the one listed for its value, else its bare reading. */
|
|
8
|
+
export function markerCaption(s, value) {
|
|
9
|
+
const index = s.markers.indexOf(value);
|
|
10
|
+
return (index >= 0 ? s.captions[index] : undefined) ?? formatMarker(value);
|
|
11
|
+
}
|
|
12
12
|
/**
|
|
13
13
|
* The numeric vertical axis shared by the cartesian charts: a **column of
|
|
14
14
|
* {@link Text} nodes**, one per marker value, running top-to-bottom (highest
|
|
@@ -22,62 +22,53 @@ const SLIDE = 24;
|
|
|
22
22
|
* tweens `range`/`markers` live. Only the marker **count** is fixed at
|
|
23
23
|
* construction.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
25
|
+
* `enter` staggers them in **bottom-to-top**: each marker starts pushed a
|
|
26
26
|
* little to the right and transparent, then fades and slides left into place.
|
|
27
27
|
* The resting state is the landed one, so a chart that is never told to enter
|
|
28
28
|
* still reads as a finished chart.
|
|
29
29
|
*/
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
return max <= min ? 0 : (v - min) / (max - min);
|
|
63
|
-
}
|
|
64
|
-
constructor(props) {
|
|
65
|
-
super(props);
|
|
66
|
-
// Composed from plain props (range/markers/label) — no context needed, so
|
|
67
|
-
// it's built here. super() applied the props, so the reads below resolve.
|
|
68
|
-
const tickPad = insetsOps.resolve(this.axis.tickPadding).right;
|
|
69
|
-
const titlePad = insetsOps.resolve(this.axis.titlePadding).right;
|
|
70
|
-
this.markerNodes = this.markers.map((_, i) => {
|
|
30
|
+
export const VerticalAxis = component2d({
|
|
31
|
+
key: "verticalAxis",
|
|
32
|
+
state: {
|
|
33
|
+
range: fresh(() => [0, 1]),
|
|
34
|
+
markers: fresh(() => []),
|
|
35
|
+
captions: fresh(() => []),
|
|
36
|
+
axis: Types.custom(DEFAULT_Y_AXIS),
|
|
37
|
+
label: "",
|
|
38
|
+
arrivals: arrivalsEntry(),
|
|
39
|
+
},
|
|
40
|
+
// A plain node filled its parent; one made of its markers would hug them.
|
|
41
|
+
defaults: { width: "fill", height: "fill" },
|
|
42
|
+
children: (state) => {
|
|
43
|
+
// Composed from plain entries (range/markers/label), so it's built once here.
|
|
44
|
+
const tickPad = insetsOps.resolve(state.axis.tickPadding).right;
|
|
45
|
+
const titlePad = insetsOps.resolve(state.axis.titlePadding).right;
|
|
46
|
+
const row = [];
|
|
47
|
+
// The row's parent is the axis: its box is what the markers are placed in.
|
|
48
|
+
const box = () => row[0]?.parent?.layoutBounds ?? { width: 0, height: 0 };
|
|
49
|
+
/** The live tick values, top → bottom (highest first) — re-read every frame. */
|
|
50
|
+
const sorted = () => [...state.markers].sort((a, b) => b - a);
|
|
51
|
+
/** Tick `i`'s fraction across the live `range`, 0 at the bottom edge. */
|
|
52
|
+
const fracAt = (value) => {
|
|
53
|
+
if (value === undefined)
|
|
54
|
+
return 0;
|
|
55
|
+
const [min, max] = state.range;
|
|
56
|
+
return max <= min ? 0 : (value - min) / (max - min);
|
|
57
|
+
};
|
|
58
|
+
// One text node per marker, ordered top → bottom. A slot with no value (the
|
|
59
|
+
// live list is shorter than the column built for it) renders as empty text
|
|
60
|
+
// rather than repeating its neighbour.
|
|
61
|
+
const markers = state.markers.map((_, i) => {
|
|
71
62
|
const marker = new Text({
|
|
72
|
-
...textOps.styleProps(
|
|
63
|
+
...textOps.styleProps(state.axis.labelStyle),
|
|
73
64
|
text: () => {
|
|
74
|
-
const
|
|
75
|
-
return
|
|
65
|
+
const value = sorted()[i];
|
|
66
|
+
return value === undefined ? "" : markerCaption(state, value);
|
|
76
67
|
},
|
|
77
68
|
y: () => {
|
|
78
69
|
// Node2D space is y-up, so the fraction runs from the bottom.
|
|
79
|
-
const height =
|
|
80
|
-
const centred = (
|
|
70
|
+
const height = box().height;
|
|
71
|
+
const centred = (fracAt(sorted()[i]) - 0.5) * height;
|
|
81
72
|
// Held inside the axis's top edge — the backstop for a chart whose
|
|
82
73
|
// headroom is smaller than its marker text is tall, which a theme with
|
|
83
74
|
// much larger markers can arrange. Only the top, because what lies
|
|
@@ -85,92 +76,66 @@ export class VerticalAxis extends Node2D {
|
|
|
85
76
|
const limit = height / 2 - marker.layoutBounds.height / 2;
|
|
86
77
|
return Math.min(centred, limit);
|
|
87
78
|
},
|
|
79
|
+
opacity: () => arrivalOf(state.arrivals, i).opacity,
|
|
80
|
+
x: () => arrivalOf(state.arrivals, i).shift,
|
|
88
81
|
});
|
|
89
82
|
return marker;
|
|
90
83
|
});
|
|
91
84
|
const children = [];
|
|
92
|
-
if (
|
|
93
|
-
this.labelNode = new Text({
|
|
94
|
-
...textOps.styleProps(this.axis.titleStyle),
|
|
95
|
-
text: this.label,
|
|
96
|
-
});
|
|
85
|
+
if (state.label !== "") {
|
|
97
86
|
// Node2D space is y-up and rotation is clockwise, so -90° reads bottom-to-top.
|
|
98
87
|
children.push(new RotatedBox({
|
|
99
88
|
angle: -90,
|
|
100
89
|
width: "hug",
|
|
101
90
|
height: "hug",
|
|
102
|
-
children:
|
|
91
|
+
children: new Text({
|
|
92
|
+
...textOps.styleProps(state.axis.titleStyle),
|
|
93
|
+
text: state.label,
|
|
94
|
+
opacity: () => arrivalOf(state.arrivals, "label").opacity,
|
|
95
|
+
x: () => arrivalOf(state.arrivals, "label").shift,
|
|
96
|
+
}),
|
|
103
97
|
}));
|
|
104
98
|
}
|
|
105
|
-
children.push(new Rect({
|
|
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
|
-
const markers = nodes.map((node, i) => {
|
|
148
|
-
const order = nodes.length - 1 - i; // bottom-most = 0
|
|
149
|
-
return at(order * step, node.to({ data: { opacity: 1, x: 0 }, duration: per, easing }));
|
|
150
|
-
});
|
|
151
|
-
const lastMarkerEnds = (nodes.length - 1) * step + per;
|
|
152
|
-
// Once every marker has landed, the caption slides in from the right.
|
|
153
|
-
return compose([
|
|
154
|
-
...markers,
|
|
155
|
-
...(this.labelNode
|
|
156
|
-
? [at(lastMarkerEnds, this.labelNode.to({ data: { opacity: 1, x: 0 }, duration: caption, easing }))]
|
|
157
|
-
: []),
|
|
158
|
-
]);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
__decorate([
|
|
162
|
-
property({ default: () => [0, 1] })
|
|
163
|
-
], VerticalAxis.prototype, "range", void 0);
|
|
164
|
-
__decorate([
|
|
165
|
-
property({ default: () => [] })
|
|
166
|
-
], VerticalAxis.prototype, "markers", void 0);
|
|
167
|
-
__decorate([
|
|
168
|
-
property({ default: DEFAULT_Y_AXIS })
|
|
169
|
-
], VerticalAxis.prototype, "axis", void 0);
|
|
170
|
-
__decorate([
|
|
171
|
-
property({ default: "" })
|
|
172
|
-
], VerticalAxis.prototype, "label", void 0);
|
|
173
|
-
__decorate([
|
|
174
|
-
command()
|
|
175
|
-
], VerticalAxis.prototype, "enter", null);
|
|
99
|
+
children.push(new Rect({ height: "fill", width: "hug", padding: { right: tickPad }, children: markers }));
|
|
100
|
+
row.push(new Rect({ flow: "horizontal", gap: titlePad, children }));
|
|
101
|
+
return asParts(row);
|
|
102
|
+
},
|
|
103
|
+
commands: {
|
|
104
|
+
/**
|
|
105
|
+
* Stagger the markers in bottom to top, then slide the caption in from the
|
|
106
|
+
* right after them. Its first frame arms them all: shifted right by `slide`
|
|
107
|
+
* and transparent.
|
|
108
|
+
*
|
|
109
|
+
* The timeline's duration is the **whole** entrance, not one marker's slide:
|
|
110
|
+
* the stagger and the caption are carved out of it rather than added on top.
|
|
111
|
+
* See {@link enterBudget} for why that distinction matters here.
|
|
112
|
+
*
|
|
113
|
+
* `stagger` is seconds between successive markers (derived when omitted);
|
|
114
|
+
* `slide` is the starting rightward offset in px.
|
|
115
|
+
*/
|
|
116
|
+
enter: {
|
|
117
|
+
args: {
|
|
118
|
+
stagger: Types.custom(undefined),
|
|
119
|
+
slide: Types.number(SLIDE),
|
|
120
|
+
},
|
|
121
|
+
run: (timeline, state) => {
|
|
122
|
+
const { stagger, slide } = timeline.args;
|
|
123
|
+
const count = state.markers.length;
|
|
124
|
+
const captioned = state.label !== "";
|
|
125
|
+
const from = { opacity: 0, shift: slide };
|
|
126
|
+
const keys = [...state.markers.keys(), ...(captioned ? ["label"] : [])];
|
|
127
|
+
const arm = timeline.animate(() => ({ arrivals: armed(keys, from) }));
|
|
128
|
+
if (count === 0)
|
|
129
|
+
return arm;
|
|
130
|
+
const { step, per, caption } = enterBudget(timeline.duration, count, captioned, stagger);
|
|
131
|
+
const ease = frameEase(timeline);
|
|
132
|
+
// Bottom marker leads: the column is top → bottom, so walk it in reverse.
|
|
133
|
+
const markers = state.markers.map((_, i) => ({ at: (count - 1 - i) * step, duration: per, piece: arrival(timeline, i, from, ease) }));
|
|
134
|
+
// Once every marker has landed, the caption slides in from the right.
|
|
135
|
+
const label = captioned ? [{ at: (count - 1) * step + per, duration: caption, piece: arrival(timeline, "label", from, ease) }] : [];
|
|
136
|
+
return timeline.together([arm, beats(timeline, [...markers, ...label])]);
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
});
|
|
176
141
|
//# sourceMappingURL=vertical-axis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertical-axis.js","sourceRoot":"","sources":["../../src/kit/vertical-axis.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,OAAO,EACP,MAAM,EACN,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,SAAS,EACT,OAAO,GAIR,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,cAAc,EACd,WAAW,EACX,YAAY,GAGb,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,EAAE,EAAE,OAAO,EAAiB,MAAM,6BAA6B,CAAA;AAqBxE,8EAA8E;AAC9E,MAAM,KAAK,GAAG,EAAE,CAAA;AAKhB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,YAAa,SAAQ,MAAyB;IAMzD;;;;;;;OAOG;IACH,QAAQ,GAAgB,YAAY,CAAA;IAEpC,+EAA+E;IACvE,WAAW,GAAW,EAAE,CAAA;IAChC,kFAAkF;IAC1E,SAAS,GAAgB,IAAI,CAAA;IAErC,gFAAgF;IAChF,IAAY,aAAa;QACvB,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IAChD,CAAC;IAED;;;;OAIG;IACK,OAAO,CAAC,KAAa;QAC3B,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;IAClC,CAAC;IAED,yEAAyE;IACjE,MAAM,CAAC,KAAa;QAC1B,MAAM,CAAC,GAAG,IAA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zF,CAAC,CAAC,CAAA;QACF,MAAM,cAAc,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,CAAA;QAEtD,sEAAsE;QACtE,OAAO,OAAO,CAAC;YACb,GAAG,OAAO;YACV,GAAG,CAAC,IAAI,CAAC,SAAS;gBAChB,CAAC,CAAC,CAAC,EAAE,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;gBACpG,CAAC,CAAC,EAAE,CAAC;SACR,CAAC,CAAA;IACJ,CAAC;CACF;AA3JuD;IAArD,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAU,EAAE,CAAC;2CAAqB;AACb;IAApD,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAc,EAAE,CAAC;6CAA0B;AACvB;IAA9C,QAAQ,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;0CAAyB;AAC5B;IAAlC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;2CAAsB;AA2HhD;IADC,OAAO,EAAE;yCA6BT","sourcesContent":["import {\r\n command,\r\n Node2D,\r\n Rect,\r\n RotatedBox,\r\n Text,\r\n easeOut,\r\n property,\r\n insetsOps,\r\n textOps,\r\n type CommandArgs,\r\n type NodeConfig,\r\n type Node2DProps,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport {\r\n DEFAULT_Y_AXIS,\r\n enterBudget,\r\n formatMarker,\r\n type AxisConfig,\r\n type Range,\r\n} from \"./shared\"\r\nimport { at, compose, type Seekable } from \"@motionscript/sdk/component\"\r\n\r\nexport interface VerticalAxisProps extends Node2DProps {\r\n /** `[min, max]` of the vertical scale the markers are positioned within. */\r\n range: Range\r\n /**\r\n * Tick values (in data units) to draw up the axis, each placed by its fraction\r\n * across {@link VerticalAxisProps.range}. Need not be evenly spaced or include\r\n * the ends.\r\n */\r\n markers: number[]\r\n /** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */\r\n axis: AxisConfig\r\n /**\r\n * Rotated caption drawn in the gutter to the left of the marker column. Empty\r\n * string (the default) hides it — no caption node is built and no label gutter\r\n * is reserved.\r\n */\r\n label: string\r\n}\r\n\r\n/** How far a marker starts to the right of its slot when it enters, in px. */\r\nconst SLIDE = 24\r\n\r\n/** How a tick value is captioned — see {@link VerticalAxis.labelFor}. */\r\nexport type MarkerLabel = (value: number) => string\r\n\r\n/**\r\n * The numeric vertical axis shared by the cartesian charts: a **column of\r\n * {@link Text} nodes**, one per marker value, running top-to-bottom (highest\r\n * value at the top). Pure layout — no `Graphics` — so the markers are real text\r\n * nodes the scene can measure, restyle, or animate individually.\r\n *\r\n * Each marker is positioned so its centre lands exactly on its value's fraction\r\n * across `range` within the axis's filled height, so unevenly-spaced markers\r\n * land where their values fall. Both the caption and the position are *bound*,\r\n * not snapshotted: a chart that rescales its axes (see `LineChart.zoomTo`)\r\n * tweens `range`/`markers` live. Only the marker **count** is fixed at\r\n * construction.\r\n *\r\n * {@link enter} staggers them in **bottom-to-top**: each marker starts pushed a\r\n * little to the right and transparent, then fades and slides left into place.\r\n * The resting state is the landed one, so a chart that is never told to enter\r\n * still reads as a finished chart.\r\n */\r\nexport class VerticalAxis extends Node2D<VerticalAxisProps> {\r\n @property({ default: () => [0, 1] as Range }) declare range: Range\r\n @property({ default: () => [] as number[] }) declare markers: number[]\r\n @property({ default: DEFAULT_Y_AXIS }) declare axis: AxisConfig\r\n @property({ default: \"\" }) declare label: string\r\n\r\n /**\r\n * How a tick value is captioned. Defaults to the bare numeric reading; a\r\n * chart with a number format on this axis replaces it (see `number-format`).\r\n *\r\n * A plain field rather than a `@property`, for the reason the horizontal\r\n * axis's twin spells out: it is a policy, not a value, and there is nothing\r\n * to tween between two formatters.\r\n */\r\n labelFor: MarkerLabel = formatMarker\r\n\r\n /** One text node per marker, ordered top → bottom, for the staggered enter. */\r\n private markerNodes: Text[] = []\r\n /** The caption node, or null when `label` is empty. Entered after the markers. */\r\n private labelNode: Text | null = null\r\n\r\n /** The live tick values, top → bottom (highest first) — re-read every frame. */\r\n private get sortedMarkers(): number[] {\r\n return [...this.markers].sort((a, b) => b - a)\r\n }\r\n\r\n /**\r\n * Tick `i`'s value, or `undefined` once the live `markers` list is shorter\r\n * than the column of text nodes built for it — a slot with no value renders as\r\n * empty text rather than repeating its neighbour.\r\n */\r\n private valueAt(index: number): number | undefined {\r\n return this.sortedMarkers[index]\r\n }\r\n\r\n /** Tick `i`'s fraction across the live `range`, 0 at the bottom edge. */\r\n private fracAt(index: number): number {\r\n const v = this.valueAt(index)\r\n if (v === undefined) return 0\r\n const [min, max] = this.range\r\n return max <= min ? 0 : (v - min) / (max - min)\r\n }\r\n\r\n constructor(props?: NodeConfig<VerticalAxis, VerticalAxisProps>) {\r\n super(props)\r\n\r\n // Composed from plain props (range/markers/label) — no context needed, so\r\n // it's built here. super() applied the props, so the reads below resolve.\r\n const tickPad = insetsOps.resolve(this.axis.tickPadding).right\r\n const titlePad = insetsOps.resolve(this.axis.titlePadding).right\r\n\r\n this.markerNodes = this.markers.map((_, i) => {\r\n const marker: Text = new Text({\r\n ...textOps.styleProps(this.axis.labelStyle),\r\n text: () => {\r\n const v = this.valueAt(i)\r\n return v === undefined ? \"\" : this.labelFor(v)\r\n },\r\n y: () => {\r\n // Node2D space is y-up, so the fraction runs from the bottom.\r\n const height = this.layoutBounds.height\r\n const centred = (this.fracAt(i) - 0.5) * height\r\n // Held inside the axis's top edge — the backstop for a chart whose\r\n // headroom is smaller than its marker text is tall, which a theme with\r\n // much larger markers can arrange. Only the top, because what lies\r\n // below the axis is the chart's own horizontal axis and legend.\r\n const limit = height / 2 - marker.layoutBounds.height / 2\r\n return Math.min(centred, limit)\r\n },\r\n })\r\n return marker\r\n })\r\n\r\n const children: Node2D[] = []\r\n if (this.label !== \"\") {\r\n this.labelNode = new Text({\r\n ...textOps.styleProps(this.axis.titleStyle),\r\n text: this.label,\r\n })\r\n // Node2D space is y-up and rotation is clockwise, so -90° reads bottom-to-top.\r\n children.push(\r\n new RotatedBox({\r\n angle: -90,\r\n width: \"hug\",\r\n height: \"hug\",\r\n children: this.labelNode,\r\n })\r\n )\r\n }\r\n children.push(\r\n new Rect({\r\n height: \"fill\",\r\n width: \"hug\",\r\n padding: { right: tickPad },\r\n children: this.markerNodes,\r\n })\r\n )\r\n\r\n this.add(new Rect({ flow: \"horizontal\", gap: titlePad, children }))\r\n }\r\n\r\n /**\r\n * Primes every marker (and the caption) at its pre-entrance state: shifted\r\n * right and transparent. Idempotent, and separate from {@link enter} so the\r\n * chart can arm its whole composition before the first frame is drawn.\r\n */\r\n arm(slide = SLIDE): void {\r\n for (const marker of this.markerNodes) marker.set({ opacity: 0, x: slide })\r\n this.labelNode?.set({ opacity: 0, x: slide })\r\n }\r\n\r\n /**\r\n * Stagger the markers in bottom to top, then slide the caption in from the\r\n * right after them.\r\n *\r\n * A {@link Seekable} rather than a generator — see the note on the horizontal\r\n * axis's `enter`. The offsets were always static; expressing them as `wait`\r\n * inside a generator is what made them reachable only by running it.\r\n *\r\n * `args.duration` is the **whole** entrance, not one marker's slide: the\r\n * stagger and the caption are carved out of it rather than added on top. See\r\n * {@link enterBudget} for why that distinction matters here.\r\n *\r\n * `args.data.stagger` is seconds between successive markers (derived when\r\n * omitted); `args.data.slide` is the starting rightward offset in px.\r\n */\r\n @command()\r\n enter(args: CommandArgs<{ stagger?: number; slide?: number }> & { duration: number }): Seekable {\r\n const { stagger, slide = SLIDE } = args.data ?? {}\r\n const easing = args.easing ?? easeOut()\r\n const nodes = this.markerNodes\r\n if (nodes.length === 0) return compose([])\r\n const { step, per, caption } = enterBudget(\r\n args.duration,\r\n nodes.length,\r\n this.labelNode !== null,\r\n stagger\r\n )\r\n\r\n this.arm(slide)\r\n\r\n // Bottom marker leads: markerNodes is top → bottom, so walk it in reverse.\r\n const markers = nodes.map((node, i) => {\r\n const order = nodes.length - 1 - i // bottom-most = 0\r\n return at(order * step, node.to({ data: { opacity: 1, x: 0 }, duration: per, easing }))\r\n })\r\n const lastMarkerEnds = (nodes.length - 1) * step + per\r\n\r\n // Once every marker has landed, the caption slides in from the right.\r\n return compose([\r\n ...markers,\r\n ...(this.labelNode\r\n ? [at(lastMarkerEnds, this.labelNode.to({ data: { opacity: 1, x: 0 }, duration: caption, easing }))]\r\n : []),\r\n ])\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"vertical-axis.js","sourceRoot":"","sources":["../../src/kit/vertical-axis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,KAAK,EACL,WAAW,EACX,SAAS,EACT,OAAO,GAIR,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAgB,MAAM,UAAU,CAAA;AACnG,OAAO,EACL,cAAc,EACd,WAAW,EACX,YAAY,GAGb,MAAM,UAAU,CAAA;AA2BjB,8EAA8E;AAC9E,MAAM,KAAK,GAAG,EAAE,CAAA;AAKhB,0FAA0F;AAC1F,MAAM,UAAU,aAAa,CAAC,CAAgF,EAAE,KAAa;IAC3H,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IACtC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,YAAY,CAAC,KAAK,CAAC,CAAA;AAC5E,CAAC;AAED;;;;;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AC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;gBACrI,sEAAsE;gBACtE,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,CAAA;gBACnI,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YAC1E,CAAC;SACF;KACF;CACF,CAAC,CAAA","sourcesContent":["import {\r\n Rect,\r\n RotatedBox,\r\n Text,\r\n Types,\r\n component2d,\r\n insetsOps,\r\n textOps,\r\n type NodeOf,\r\n type Node2D,\r\n type Node2DProps,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport { asParts, fresh } from \"./entries\"\r\nimport { armed, arrival, arrivalOf, arrivalsEntry, beats, frameEase, type Arrival } from \"./motion\"\r\nimport {\r\n DEFAULT_Y_AXIS,\r\n enterBudget,\r\n formatMarker,\r\n type AxisConfig,\r\n type Range,\r\n} from \"./shared\"\r\n\r\nexport interface VerticalAxisProps extends Node2DProps {\r\n /** `[min, max]` of the vertical scale the markers are positioned within. */\r\n range: Range\r\n /**\r\n * Tick values (in data units) to draw up the axis, each placed by its fraction\r\n * across {@link VerticalAxisProps.range}. Need not be evenly spaced or include\r\n * the ends.\r\n */\r\n markers: number[]\r\n /**\r\n * How each marker is captioned, one per entry of `markers` and in its order.\r\n * Empty (the default), or short, captions a marker with its bare numeric\r\n * reading; a chart with a number format on this axis writes them through it.\r\n */\r\n captions: string[]\r\n /** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */\r\n axis: AxisConfig\r\n /**\r\n * Rotated caption drawn in the gutter to the left of the marker column. Empty\r\n * string (the default) hides it — no caption node is built and no label gutter\r\n * is reserved.\r\n */\r\n label: string\r\n}\r\n\r\n/** How far a marker starts to the right of its slot when it enters, in px. */\r\nconst SLIDE = 24\r\n\r\n/** How a tick value is captioned — see {@link VerticalAxisProps.captions}. */\r\nexport type MarkerLabel = (value: number) => string\r\n\r\n/** What a marker's caption reads: the one listed for its value, else its bare reading. */\r\nexport function markerCaption(s: { readonly markers: readonly number[]; readonly captions: readonly string[] }, value: number): string {\r\n const index = s.markers.indexOf(value)\r\n return (index >= 0 ? s.captions[index] : undefined) ?? formatMarker(value)\r\n}\r\n\r\n/**\r\n * The numeric vertical axis shared by the cartesian charts: a **column of\r\n * {@link Text} nodes**, one per marker value, running top-to-bottom (highest\r\n * value at the top). Pure layout — no `Graphics` — so the markers are real text\r\n * nodes the scene can measure, restyle, or animate individually.\r\n *\r\n * Each marker is positioned so its centre lands exactly on its value's fraction\r\n * across `range` within the axis's filled height, so unevenly-spaced markers\r\n * land where their values fall. Both the caption and the position are *bound*,\r\n * not snapshotted: a chart that rescales its axes (see `LineChart.zoomTo`)\r\n * tweens `range`/`markers` live. Only the marker **count** is fixed at\r\n * construction.\r\n *\r\n * `enter` staggers them in **bottom-to-top**: each marker starts pushed a\r\n * little to the right and transparent, then fades and slides left into place.\r\n * The resting state is the landed one, so a chart that is never told to enter\r\n * still reads as a finished chart.\r\n */\r\nexport const VerticalAxis = component2d({\r\n key: \"verticalAxis\",\r\n state: {\r\n range: fresh<Range>(() => [0, 1]),\r\n markers: fresh<number[]>(() => []),\r\n captions: fresh<string[]>(() => []),\r\n axis: Types.custom<AxisConfig>(DEFAULT_Y_AXIS),\r\n label: \"\",\r\n arrivals: arrivalsEntry(),\r\n },\r\n // A plain node filled its parent; one made of its markers would hug them.\r\n defaults: { width: \"fill\", height: \"fill\" },\r\n children: (state) => {\r\n // Composed from plain entries (range/markers/label), so it's built once here.\r\n const tickPad = insetsOps.resolve(state.axis.tickPadding).right\r\n const titlePad = insetsOps.resolve(state.axis.titlePadding).right\r\n\r\n const row: Node2D[] = []\r\n // The row's parent is the axis: its box is what the markers are placed in.\r\n const box = () => (row[0]?.parent as Node2D | null | undefined)?.layoutBounds ?? { width: 0, height: 0 }\r\n /** The live tick values, top → bottom (highest first) — re-read every frame. */\r\n const sorted = () => [...state.markers].sort((a, b) => b - a)\r\n /** Tick `i`'s fraction across the live `range`, 0 at the bottom edge. */\r\n const fracAt = (value: number | undefined) => {\r\n if (value === undefined) return 0\r\n const [min, max] = state.range\r\n return max <= min ? 0 : (value - min) / (max - min)\r\n }\r\n\r\n // One text node per marker, ordered top → bottom. A slot with no value (the\r\n // live list is shorter than the column built for it) renders as empty text\r\n // rather than repeating its neighbour.\r\n const markers = state.markers.map((_, i) => {\r\n const marker: Node2D = new Text({\r\n ...textOps.styleProps(state.axis.labelStyle),\r\n text: () => {\r\n const value = sorted()[i]\r\n return value === undefined ? \"\" : markerCaption(state, value)\r\n },\r\n y: () => {\r\n // Node2D space is y-up, so the fraction runs from the bottom.\r\n const height = box().height\r\n const centred = (fracAt(sorted()[i]) - 0.5) * height\r\n // Held inside the axis's top edge — the backstop for a chart whose\r\n // headroom is smaller than its marker text is tall, which a theme with\r\n // much larger markers can arrange. Only the top, because what lies\r\n // below the axis is the chart's own horizontal axis and legend.\r\n const limit = height / 2 - marker.layoutBounds.height / 2\r\n return Math.min(centred, limit)\r\n },\r\n opacity: () => arrivalOf(state.arrivals, i).opacity,\r\n x: () => arrivalOf(state.arrivals, i).shift,\r\n })\r\n return marker\r\n })\r\n\r\n const children: Node2D[] = []\r\n if (state.label !== \"\") {\r\n // Node2D space is y-up and rotation is clockwise, so -90° reads bottom-to-top.\r\n children.push(\r\n new RotatedBox({\r\n angle: -90,\r\n width: \"hug\",\r\n height: \"hug\",\r\n children: new Text({\r\n ...textOps.styleProps(state.axis.titleStyle),\r\n text: state.label,\r\n opacity: () => arrivalOf(state.arrivals, \"label\").opacity,\r\n x: () => arrivalOf(state.arrivals, \"label\").shift,\r\n }),\r\n })\r\n )\r\n }\r\n children.push(new Rect({ height: \"fill\", width: \"hug\", padding: { right: tickPad }, children: markers }))\r\n row.push(new Rect({ flow: \"horizontal\", gap: titlePad, children }))\r\n return asParts(row)\r\n },\r\n commands: {\r\n /**\r\n * Stagger the markers in bottom to top, then slide the caption in from the\r\n * right after them. Its first frame arms them all: shifted right by `slide`\r\n * and transparent.\r\n *\r\n * The timeline's duration is the **whole** entrance, not one marker's slide:\r\n * the stagger and the caption are carved out of it rather than added on top.\r\n * See {@link enterBudget} for why that distinction matters here.\r\n *\r\n * `stagger` is seconds between successive markers (derived when omitted);\r\n * `slide` is the starting rightward offset in px.\r\n */\r\n enter: {\r\n args: {\r\n stagger: Types.custom<number | undefined>(undefined),\r\n slide: Types.number(SLIDE),\r\n },\r\n run: (timeline, state) => {\r\n const { stagger, slide } = timeline.args\r\n const count = state.markers.length\r\n const captioned = state.label !== \"\"\r\n const from: Arrival = { opacity: 0, shift: slide }\r\n const keys = [...state.markers.keys(), ...(captioned ? [\"label\"] : [])]\r\n const arm = timeline.animate(() => ({ arrivals: armed(keys, from) }))\r\n if (count === 0) return arm\r\n const { step, per, caption } = enterBudget(timeline.duration, count, captioned, stagger)\r\n const ease = frameEase(timeline)\r\n // Bottom marker leads: the column is top → bottom, so walk it in reverse.\r\n const markers = state.markers.map((_, i) => ({ at: (count - 1 - i) * step, duration: per, piece: arrival(timeline, i, from, ease) }))\r\n // Once every marker has landed, the caption slides in from the right.\r\n const label = captioned ? [{ at: (count - 1) * step + per, duration: caption, piece: arrival(timeline, \"label\", from, ease) }] : []\r\n return timeline.together([arm, beats(timeline, [...markers, ...label])])\r\n },\r\n },\r\n },\r\n})\r\n\r\nexport type VerticalAxis = NodeOf<typeof VerticalAxis>\r\n"]}
|
|
@@ -1,91 +1,74 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type NodeOf, type Node2D as _Node2D, type Stroke, type StrokeResolved, type Vector2 } from "@motionscript/sdk";
|
|
2
2
|
import { type RegionBox } from "./shared.js";
|
|
3
|
-
export interface ChartLineProps extends Node2DProps {
|
|
4
|
-
/**
|
|
5
|
-
* The series polyline, already mapped into this node's local pixel space
|
|
6
|
-
* (origin at centre, y-up) by the parent {@link LineChart}. Ordered along x.
|
|
7
|
-
*/
|
|
8
|
-
points: Vector2[];
|
|
9
|
-
/** Line colour + weight (+ optional dash/cap/join) — the per-series stroke. */
|
|
10
|
-
stroke: Stroke;
|
|
11
|
-
/**
|
|
12
|
-
* Reveal of the line in `[0, 1]`: 0 hides it, 1 traces it fully from its left
|
|
13
|
-
* end to its right.
|
|
14
|
-
*
|
|
15
|
-
* Defaults to **1**, unlike the standalone chart this was ported from: in an
|
|
16
|
-
* editor a node's resting state is what the paused editor canvas paints, so a
|
|
17
|
-
* chart that only appeared once a command had run would edit blind. {@link
|
|
18
|
-
* enter} drives it from 0 regardless of where it rests, so the animation is
|
|
19
|
-
* unchanged.
|
|
20
|
-
*/
|
|
21
|
-
progress: number;
|
|
22
|
-
/**
|
|
23
|
-
* Whether this line is drawn at all. `false` hides it outright — the switch
|
|
24
|
-
* the chart flips alongside its legend's per-series toggle.
|
|
25
|
-
*/
|
|
26
|
-
enabled: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* A slice of the plot to spotlight, in this node's own pixel space. When set
|
|
29
|
-
* to a real box, the stretches of the line *outside* it drop to
|
|
30
|
-
* {@link ChartLineProps.dimOpacity} while the stretches inside stay full.
|
|
31
|
-
*/
|
|
32
|
-
spotlight: RegionBox;
|
|
33
|
-
/** Opacity the out-of-region stretches fade to. */
|
|
34
|
-
dimOpacity: number;
|
|
35
|
-
}
|
|
36
3
|
/**
|
|
37
4
|
* A single series line of a {@link LineChart}: one rounded polyline traced
|
|
38
5
|
* through pre-mapped pixel `points`, drawn as one {@link Graphics2D} command list.
|
|
39
6
|
* Sized and positioned by the parent, which shares the plot's coordinate frame.
|
|
40
7
|
*
|
|
41
|
-
* Two signals drive it:
|
|
42
|
-
* (animated by
|
|
8
|
+
* Two signals drive it: `progress` traces the line in
|
|
9
|
+
* (animated by `enter`) and `enabled` shows or hides it wholesale.
|
|
43
10
|
*/
|
|
44
|
-
export declare
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
spotlight: RegionBox;
|
|
50
|
-
dimOpacity: number;
|
|
51
|
-
/**
|
|
52
|
-
* This node extends `Node2D` rather than `ShapeNode`, so nothing declares the
|
|
53
|
-
* paint props it carries — see {@link declarePaints}.
|
|
54
|
-
*/
|
|
55
|
-
declareAssets(assets: AssetScope): void;
|
|
56
|
-
protected renderSelf(ctx: RenderContext2D): void;
|
|
11
|
+
export declare const ChartLine: import("@motionscript/sdk").Component<"chartLine", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
12
|
+
/** The series polyline, already mapped into this node's local pixel space (origin at centre, y-up) by the parent {@link LineChart}. Ordered along x. */
|
|
13
|
+
readonly points: import("@motionscript/sdk").Type<Vector2[], Vector2[], false>;
|
|
14
|
+
/** Line colour + weight (+ optional dash/cap/join) — the per-series stroke. */
|
|
15
|
+
readonly stroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
|
|
57
16
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* point partway along the active segment.
|
|
17
|
+
* Reveal of the line in `[0, 1]`: 0 hides it, 1 traces it fully from its left
|
|
18
|
+
* end to its right. Defaults to 1, so the paused editor canvas paints the line;
|
|
19
|
+
* `enter` drives it from 0 regardless of where it rests.
|
|
62
20
|
*/
|
|
63
|
-
|
|
21
|
+
readonly progress: 1;
|
|
22
|
+
/** Whether this line is drawn at all: the switch the chart flips alongside its legend's per-series toggle. */
|
|
23
|
+
readonly enabled: true;
|
|
24
|
+
/** A slice of the plot to spotlight, in this node's own pixel space: outside it the line drops to `dimOpacity`. */
|
|
25
|
+
readonly spotlight: import("@motionscript/sdk").Type<RegionBox, RegionBox, false>;
|
|
26
|
+
/** Opacity the out-of-region stretches fade to. */
|
|
27
|
+
readonly dimOpacity: 0.2;
|
|
28
|
+
}>, {
|
|
29
|
+
readonly enter: {
|
|
30
|
+
readonly from: import("@motionscript/sdk").Type<number, number, false>;
|
|
31
|
+
readonly to: import("@motionscript/sdk").Type<number, number, false>;
|
|
32
|
+
};
|
|
33
|
+
}, null, _Node2D<import("@motionscript/core").Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
34
|
+
/** The series polyline, already mapped into this node's local pixel space (origin at centre, y-up) by the parent {@link LineChart}. Ordered along x. */
|
|
35
|
+
readonly points: import("@motionscript/sdk").Type<Vector2[], Vector2[], false>;
|
|
36
|
+
/** Line colour + weight (+ optional dash/cap/join) — the per-series stroke. */
|
|
37
|
+
readonly stroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
|
|
64
38
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* A `Command` rather than a generator, so the trace can be *evaluated* at a
|
|
69
|
-
* time instead of run to one — which is what lets a scene containing this
|
|
70
|
-
* chart be scrubbed in constant time. It no longer needs to prime `progress`
|
|
71
|
-
* to 0 first: the value at `t` is a function of `t`, so a repeat call re-traces
|
|
72
|
-
* by definition rather than by having reset something.
|
|
39
|
+
* Reveal of the line in `[0, 1]`: 0 hides it, 1 traces it fully from its left
|
|
40
|
+
* end to its right. Defaults to 1, so the paused editor canvas paints the line;
|
|
41
|
+
* `enter` drives it from 0 regardless of where it rests.
|
|
73
42
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
43
|
+
readonly progress: 1;
|
|
44
|
+
/** Whether this line is drawn at all: the switch the chart flips alongside its legend's per-series toggle. */
|
|
45
|
+
readonly enabled: true;
|
|
46
|
+
/** A slice of the plot to spotlight, in this node's own pixel space: outside it the line drops to `dimOpacity`. */
|
|
47
|
+
readonly spotlight: import("@motionscript/sdk").Type<RegionBox, RegionBox, false>;
|
|
48
|
+
/** Opacity the out-of-region stretches fade to. */
|
|
49
|
+
readonly dimOpacity: 0.2;
|
|
50
|
+
}>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
51
|
+
/** The series polyline, already mapped into this node's local pixel space (origin at centre, y-up) by the parent {@link LineChart}. Ordered along x. */
|
|
52
|
+
readonly points: import("@motionscript/sdk").Type<Vector2[], Vector2[], false>;
|
|
53
|
+
/** Line colour + weight (+ optional dash/cap/join) — the per-series stroke. */
|
|
54
|
+
readonly stroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
|
|
77
55
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* are the same motion in opposite directions, and expressing them as one thing
|
|
82
|
-
* with endpoints is what stops the pair drifting apart.
|
|
83
|
-
*
|
|
84
|
-
* `enabled` rides along in the same value rather than being set before or after
|
|
85
|
-
* the command. A line is drawable for every `t` the trace covers and undrawn
|
|
86
|
-
* outside it, which is what makes arriving at a time backwards show what
|
|
87
|
-
* arriving forwards does — a flag flipped by a side effect would not.
|
|
56
|
+
* Reveal of the line in `[0, 1]`: 0 hides it, 1 traces it fully from its left
|
|
57
|
+
* end to its right. Defaults to 1, so the paused editor canvas paints the line;
|
|
58
|
+
* `enter` drives it from 0 regardless of where it rests.
|
|
88
59
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
60
|
+
readonly progress: 1;
|
|
61
|
+
/** Whether this line is drawn at all: the switch the chart flips alongside its legend's per-series toggle. */
|
|
62
|
+
readonly enabled: true;
|
|
63
|
+
/** A slice of the plot to spotlight, in this node's own pixel space: outside it the line drops to `dimOpacity`. */
|
|
64
|
+
readonly spotlight: import("@motionscript/sdk").Type<RegionBox, RegionBox, false>;
|
|
65
|
+
/** Opacity the out-of-region stretches fade to. */
|
|
66
|
+
readonly dimOpacity: 0.2;
|
|
67
|
+
}>, {
|
|
68
|
+
readonly enter: {
|
|
69
|
+
readonly from: import("@motionscript/sdk").Type<number, number, false>;
|
|
70
|
+
readonly to: import("@motionscript/sdk").Type<number, number, false>;
|
|
71
|
+
};
|
|
72
|
+
}, _Node2D<import("@motionscript/core").Node2DProps>>>>;
|
|
73
|
+
export type ChartLine = NodeOf<typeof ChartLine>;
|
|
91
74
|
//# sourceMappingURL=chart-line.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-line.d.ts","sourceRoot":"","sources":["../../src/line-chart/chart-line.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"chart-line.d.ts","sourceRoot":"","sources":["../../src/line-chart/chart-line.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,MAAM,EAEX,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,OAAO,EACb,MAAM,mBAAmB,CAAA;AAM1B,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,UAAU,CAAA;AAuCjB;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS;IAGlB,wJAAwJ;;IAExJ,+EAA+E;;IAE/E;;;;OAIG;;IAEH,8GAA8G;;IAE9G,mHAAmH;;IAEnH,mDAAmD;;;;;;;;IAdnD,wJAAwJ;;IAExJ,+EAA+E;;IAE/E;;;;OAIG;;IAEH,8GAA8G;;IAE9G,mHAAmH;;IAEnH,mDAAmD;;;IAdnD,wJAAwJ;;IAExJ,+EAA+E;;IAE/E;;;;OAIG;;IAEH,8GAA8G;;IAE9G,mHAAmH;;IAEnH,mDAAmD;;;;;;;uDAmErD,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAA"}
|