@motionscript/charts 0.1.0-alpha.3 → 0.1.0-alpha.6
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 +63 -0
- package/LICENSE +201 -201
- package/NOTICE +48 -0
- package/README.md +99 -0
- package/dist/bar-chart/bar-chart.d.ts +93 -231
- package/dist/bar-chart/bar-chart.d.ts.map +1 -1
- package/dist/bar-chart/bar-chart.js +378 -565
- package/dist/bar-chart/bar-chart.js.map +1 -1
- package/dist/bar-chart/category-axis.d.ts +24 -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 +36 -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 +6 -6
- package/dist/bar-chart/shared.d.ts.map +1 -1
- package/dist/bar-chart/shared.js +6 -6
- 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 +3 -2
- 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/index.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 +8 -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 +23 -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 +79 -88
- 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 +59 -8
- package/dist/kit/shared.d.ts.map +1 -1
- package/dist/kit/shared.js +105 -10
- package/dist/kit/shared.js.map +1 -1
- package/dist/kit/vertical-axis.d.ts +36 -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 +27 -53
- package/dist/line-chart/chart-line.d.ts.map +1 -1
- package/dist/line-chart/chart-line.js +89 -120
- package/dist/line-chart/chart-line.js.map +1 -1
- package/dist/line-chart/chart-region.d.ts +14 -14
- package/dist/line-chart/chart-region.d.ts.map +1 -1
- package/dist/line-chart/chart-region.js +26 -64
- package/dist/line-chart/chart-region.js.map +1 -1
- package/dist/line-chart/horizontal-axis.d.ts +32 -56
- package/dist/line-chart/horizontal-axis.d.ts.map +1 -1
- package/dist/line-chart/horizontal-axis.js +85 -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 +111 -311
- package/dist/line-chart/line-chart.d.ts.map +1 -1
- package/dist/line-chart/line-chart.js +403 -639
- package/dist/line-chart/line-chart.js.map +1 -1
- package/dist/line-chart/shared.d.ts +6 -6
- package/dist/line-chart/shared.d.ts.map +1 -1
- package/dist/line-chart/shared.js +22 -7
- package/dist/line-chart/shared.js.map +1 -1
- package/dist/line-chart/x-scale.d.ts +1 -1
- package/dist/line-chart/x-scale.js +1 -1
- 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 +77 -134
- package/dist/pie-chart/pie-chart.d.ts.map +1 -1
- package/dist/pie-chart/pie-chart.js +199 -268
- package/dist/pie-chart/pie-chart.js.map +1 -1
- package/dist/pie-chart/pie-legend.d.ts +54 -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 +142 -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 +3 -3
- package/dist/pie-chart/shared.js +3 -3
- package/dist/pie-chart/shared.js.map +1 -1
- package/package.json +6 -5
- package/registry.json +23 -23
- package/src/bar-chart/bar-chart.ts +534 -814
- package/src/bar-chart/category-axis.ts +162 -177
- package/src/bar-chart/chart-bars.ts +288 -310
- package/src/bar-chart/index.ts +31 -31
- package/src/bar-chart/shared.ts +354 -354
- package/src/engine.ts +28 -26
- package/src/index.ts +5 -5
- package/src/kit/cartesian.ts +81 -0
- package/src/kit/chart-border.ts +50 -61
- package/src/kit/chart-canvas.ts +122 -157
- package/src/kit/chart-legend.ts +229 -250
- 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 +782 -675
- package/src/kit/vertical-axis.ts +194 -224
- package/src/line-chart/chart-line.ts +181 -208
- package/src/line-chart/chart-region.ts +106 -135
- package/src/line-chart/horizontal-axis.ts +166 -202
- package/src/line-chart/index.ts +39 -39
- package/src/line-chart/line-chart.ts +585 -929
- package/src/line-chart/shared.ts +473 -459
- package/src/line-chart/x-scale.ts +367 -367
- package/src/nodes.ts +18 -20
- package/src/pie-chart/index.ts +37 -37
- package/src/pie-chart/pie-chart.ts +293 -381
- package/src/pie-chart/pie-legend.ts +169 -159
- package/src/pie-chart/pie-ring.ts +848 -903
- package/src/pie-chart/shared.ts +490 -490
- package/dist/browser/chunks/chunk-RMHQ6GYU.js +0 -2
- package/dist/browser/chunks/chunk-RMHQ6GYU.js.map +0 -7
package/dist/line-chart/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
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":["/**\r\n * The line chart: a cartesian plot with a traced polyline, spotlit regions and\r\n * a staggered entrance.\r\n *\r\n * {@link LineChart} composes the parts below plus the shared ones in the kit\r\n * (the plot panel, the value axis, the legend); each part is exported too, so\r\n * another node type can reuse one on its own.\r\n *\r\n * These files are what `ms add line-chart` copies. Everything they reach for\r\n * that is *not* here comes from the kit and stays a dependency — see\r\n * `../engine.ts` for why that line is where it is.\r\n */\r\nexport { LineChart, lineChartDomains } from \"./line-chart\"\r\nexport type { LineChartDomains, LineChartProps, LineChartValues } from \"./line-chart\"\r\nexport { ChartRegion } from \"./chart-region\"\r\nexport { ChartLine } from \"./chart-line\"\r\nexport { HorizontalAxis } from \"./horizontal-axis\"\r\nexport {\r\n DEFAULT_CHART_THEME,\r\n EMPTY_REGION_BOX,\r\n clipPolylineToBox,\r\n hasRegion,\r\n lerpChartTheme,\r\n resolveChartTheme,\r\n resolveRegionBox,\r\n resolveYScale,\r\n seriesPoints,\r\n yExtent,\r\n} from \"./shared\"\r\nexport type {\r\n ChartConfig,\r\n ChartTheme,\r\n LineSeries,\r\n PlotRegion,\r\n RegionBox,\r\n RegionConfig,\r\n} from \"./shared\"\r\nexport { formatInstant, parseInstant, resolveXScale } from \"./x-scale\"\r\nexport type { XScale, XScaleKind } from \"./x-scale\"\r\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type AxisDomainConfig } from "../kit/shared.js";
|
|
3
|
-
import { type ChartTheme, type LineSeries, type PlotRegion } from "./shared.js";
|
|
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";
|
|
4
4
|
export interface LineChartProps extends Node2DProps {
|
|
5
5
|
/** One row per sample — a plain record of field name to value. */
|
|
6
6
|
data: DataRecord[];
|
|
@@ -18,8 +18,8 @@ export interface LineChartProps extends Node2DProps {
|
|
|
18
18
|
/**
|
|
19
19
|
* A slice of the plot to spotlight, in **data units**. Dashed rules mark the
|
|
20
20
|
* bounded edges and every series fades outside the box — see
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* `spotlightRegion`, which animates the same thing. `null` (the default) is no
|
|
22
|
+
* region.
|
|
23
23
|
*/
|
|
24
24
|
region?: PlotRegion | null;
|
|
25
25
|
/**
|
|
@@ -31,23 +31,27 @@ export interface LineChartProps extends Node2DProps {
|
|
|
31
31
|
/** Whether the legend row below the plot is drawn at all. */
|
|
32
32
|
showLegend?: boolean;
|
|
33
33
|
}
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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;
|
|
51
55
|
/**
|
|
52
56
|
* A multi-series line chart, composed from five independent parts rather than
|
|
53
57
|
* one monolithic draw:
|
|
@@ -60,296 +64,92 @@ type AxisState = {
|
|
|
60
64
|
* - {@link ChartLine} (one per series) — the traced polylines over the canvas.
|
|
61
65
|
* - {@link ChartLegend} — a row of entries below the chart, one per series.
|
|
62
66
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* and the series lines read the same resolved scales as the axes, so points land
|
|
68
|
-
* 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.
|
|
69
71
|
*
|
|
70
|
-
* **Resting state is the finished chart
|
|
71
|
-
*
|
|
72
|
-
* state on a paused canvas, and a chart that only appeared once a command had
|
|
73
|
-
* run would be edited blind. {@link enter} arms every part back to its
|
|
74
|
-
* 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.
|
|
75
74
|
*
|
|
76
|
-
* Past the entrance,
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
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.
|
|
82
81
|
*/
|
|
83
|
-
export declare
|
|
84
|
-
data: DataRecord[]
|
|
85
|
-
xField:
|
|
86
|
-
series:
|
|
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
|
-
* a reader wants are Jan/Apr/Jul/Oct/Dec, which are rows.
|
|
157
|
-
*/
|
|
158
|
-
private get resolvedXMarkers();
|
|
159
|
-
/**
|
|
160
|
-
* The plot panel's size, **as laid out**.
|
|
161
|
-
*
|
|
162
|
-
* This used to be computed: six constants estimating what the axis gutters and
|
|
163
|
-
* the legend row would take, subtracted from the node's box. The estimate was
|
|
164
|
-
* never the layout — the vertical axis is `width: "hug"`, so its real width is
|
|
165
|
-
* whatever its widest marker needs — and everything downstream inherited the
|
|
166
|
-
* gap. The grid is drawn by {@link ChartCanvas} across its *own* allocation,
|
|
167
|
-
* while the lines were mapped across the estimate, so a series sat a few
|
|
168
|
-
* percent off the grid line it was supposed to touch, silently and by an
|
|
169
|
-
* amount that changed with the theme.
|
|
170
|
-
*
|
|
171
|
-
* Asking the panel is exact by construction and cannot drift: the lines, the
|
|
172
|
-
* region rules and the grid all resolve against one box, and it is the box
|
|
173
|
-
* they are drawn in. Zero until the first layout pass, like any other
|
|
174
|
-
* `layoutBounds` read — the bindings that call this re-run on the next frame.
|
|
175
|
-
*/
|
|
176
|
-
private plotSize;
|
|
177
|
-
/**
|
|
178
|
-
* Map one series' data points into the plot's **centred** pixel space (origin
|
|
179
|
-
* at the plot centre, y-up) — the local frame of the clip/line box that fills
|
|
180
|
-
* the plot. x runs `[-w/2, +w/2]`, y runs `[-h/2, +h/2]`.
|
|
181
|
-
*/
|
|
182
|
-
private seriesPixels;
|
|
183
|
-
/**
|
|
184
|
-
* {@link region} mapped into the plot's **centred** pixel space — the same
|
|
185
|
-
* frame {@link seriesPixels} returns, so the region's rules and each line's
|
|
186
|
-
* clip resolve against one box from one place. Reads the live scales, so it
|
|
187
|
-
* re-maps when `xAxis`/`yAxis` tween.
|
|
188
|
-
*/
|
|
189
|
-
/**
|
|
190
|
-
* Whether a call-out is authored at all — the question {@link enter} and
|
|
191
|
-
* {@link spotlightRegion} branch on.
|
|
192
|
-
*
|
|
193
|
-
* Deliberately **not** `hasRegion(this.regionBox())`, which they used to ask.
|
|
194
|
-
* That resolves the region into pixels, so it answers "and has the chart been
|
|
195
|
-
* laid out yet" as well, and comes back false for a perfectly real region on a
|
|
196
|
-
* chart that has not been measured. A generator never noticed, because it only
|
|
197
|
-
* ever ran mid-playback; a command is *built* before the first layout pass, and
|
|
198
|
-
* would have quietly dropped the region beat every time.
|
|
199
|
-
*
|
|
200
|
-
* What is left once the pixels are taken out is the same test
|
|
201
|
-
* {@link resolveRegionBox} applies before it maps anything: a region bounding
|
|
202
|
-
* *neither* axis is not a call-out, so `{}` counts as none exactly as `null`
|
|
203
|
-
* does.
|
|
204
|
-
*/
|
|
205
|
-
private hasCallout;
|
|
206
|
-
private regionBox;
|
|
207
|
-
constructor(props?: NodeConfig<LineChart, LineChartProps>);
|
|
208
|
-
/**
|
|
209
|
-
* Prime every part at its pre-entrance state — axis markers shifted and
|
|
210
|
-
* transparent, lines untraced, legend dropped and transparent.
|
|
211
|
-
*
|
|
212
|
-
* Called by {@link enter} before its first frame so nothing flashes ahead of
|
|
213
|
-
* its beat. Idempotent, and public so a scene can hide a chart ahead of time
|
|
214
|
-
* without starting the entrance.
|
|
215
|
-
*/
|
|
216
|
-
arm(): void;
|
|
217
|
-
/**
|
|
218
|
-
* Animate the whole chart in: the two axes stagger their markers in (vertical
|
|
219
|
-
* bottom-to-top, horizontal left-to-right), the series lines trace
|
|
220
|
-
* left-to-right, and the legend fades up last.
|
|
221
|
-
*
|
|
222
|
-
* `duration` is the **whole** entrance. The phases below are shares of it, not
|
|
223
|
-
* multiples — a command that declares 1.4 seconds has to take 1.4 seconds,
|
|
224
|
-
* because that is the slot the timeline lays out for it, the length its
|
|
225
|
-
* parallel siblings are timed against, and its contribution to the scene's own
|
|
226
|
-
* duration. (The component this was ported from scaled every phase *off* the
|
|
227
|
-
* line trace and let the total fall where it may, which came out around 3×.)
|
|
228
|
-
*
|
|
229
|
-
* A chart authored with a `region` lands its call-out last, over lines that
|
|
230
|
-
* have already traced — the same order a scene would get by calling
|
|
231
|
-
* {@link spotlightRegion} right after this — and that beat comes out of the
|
|
232
|
-
* same budget.
|
|
233
|
-
*/
|
|
234
|
-
enter(args: CommandArgs<Record<string, never>> & {
|
|
235
|
-
duration: number;
|
|
236
|
-
}): Command<Record<string, never>>;
|
|
237
|
-
/**
|
|
238
|
-
* Spotlight a rectangular slice of the plot given in **data units**: dashed
|
|
239
|
-
* rules draw themselves onto each bounded edge while every series fades
|
|
240
|
-
* outside the box and stays full inside it.
|
|
241
|
-
*
|
|
242
|
-
* Either axis alone is a band — `{ x: [80, 100] }` picks out the last fifth
|
|
243
|
-
* across all series, `{ y: [8, 10] }` a value band across the whole width —
|
|
244
|
-
* and both together a box. The unbounded axis spans the plot and draws no
|
|
245
|
-
* rule, since there's no data bound there to mark.
|
|
246
|
-
*
|
|
247
|
-
* Calling it while another region is already up cross-fades: the old call-out
|
|
248
|
-
* retracts, then the new one draws in, each over half `duration`.
|
|
249
|
-
*
|
|
250
|
-
* Both the call-out's shape and its draw-on are plain signals — `region` and
|
|
251
|
-
* {@link regionReveal} — so the whole thing is a function of `t`, including
|
|
252
|
-
* the swap: which region is up is a step at the halfway point rather than an
|
|
253
|
-
* effect that has to have happened.
|
|
254
|
-
*/
|
|
255
|
-
spotlightRegion(args: CommandArgs<{
|
|
256
|
-
region: PlotRegion;
|
|
257
|
-
}> & {
|
|
258
|
-
duration?: number;
|
|
259
|
-
}): Command<RegionState>;
|
|
260
|
-
/**
|
|
261
|
-
* Drop the region call-out — the rules retract, the wash fades, and every
|
|
262
|
-
* series comes back to full across its whole length. A no-op when nothing is
|
|
263
|
-
* spotlit.
|
|
264
|
-
*/
|
|
265
|
-
clearRegion(args?: CommandArgs<Record<string, never>> & {
|
|
266
|
-
duration?: number;
|
|
267
|
-
}): Command<RegionState>;
|
|
268
|
-
/**
|
|
269
|
-
* The domain to come back to, captured the first time {@link zoomTo} runs so a
|
|
270
|
-
* later {@link resetZoom} restores the chart as authored — including ticks
|
|
271
|
-
* that were auto-derived rather than given, which the props alone don't
|
|
272
|
-
* record. Cleared by {@link resetZoom}, so a second zoom captures wherever the
|
|
273
|
-
* chart genuinely rests then.
|
|
274
|
-
*/
|
|
275
|
-
private home;
|
|
276
|
-
/**
|
|
277
|
-
* The `region` a document handed a command, or `{}`. A command is added
|
|
278
|
-
* before its arguments are filled in, so an unstated region is ordinary input
|
|
279
|
-
* rather than a malformed one.
|
|
280
|
-
*/
|
|
281
|
-
private static regionArg;
|
|
282
|
-
/** A range read as a span, whichever way round the author wrote it. */
|
|
283
|
-
private static span;
|
|
284
|
-
/**
|
|
285
|
-
* Rescale an axis to `range`, keeping the tick *count* it already has — the
|
|
286
|
-
* axis tween interpolates ticks pairwise by index, so a constant count lets
|
|
287
|
-
* each marker slide from its old value to its new one instead of the row
|
|
288
|
-
* popping.
|
|
289
|
-
*/
|
|
290
|
-
private static rescale;
|
|
291
|
-
/**
|
|
292
|
-
* Zoom the plot to a slice of itself, given in **data units**: the named axes
|
|
293
|
-
* rescale so that slice fills the plot, the grid and both marker rows
|
|
294
|
-
* following the new scale, and every series re-tracing itself into the new
|
|
295
|
-
* frame. All of it tweens, so the move reads as a camera push rather than a
|
|
296
|
-
* cut.
|
|
297
|
-
*
|
|
298
|
-
* An **omitted axis is left as it is** rather than being fitted to what's
|
|
299
|
-
* visible — so a zoom is exactly what was asked for, and two calls compose
|
|
300
|
-
* predictably. A spotlit region, if one is up, follows the zoom: it resolves
|
|
301
|
-
* against the same live scales, so its rules stay on their data bounds.
|
|
302
|
-
*/
|
|
303
|
-
zoomTo(args: CommandArgs<{
|
|
304
|
-
region: PlotRegion;
|
|
305
|
-
}> & {
|
|
306
|
-
duration?: number;
|
|
307
|
-
}): Command<AxisState>;
|
|
308
|
-
/**
|
|
309
|
-
* Pull back out to the domain the chart was authored with — the mirror of
|
|
310
|
-
* {@link zoomTo}, and a no-op if it was never zoomed.
|
|
311
|
-
*/
|
|
312
|
-
resetZoom(args?: CommandArgs<Record<string, never>> & {
|
|
313
|
-
duration?: number;
|
|
314
|
-
}): Command<AxisState>;
|
|
315
|
-
/**
|
|
316
|
-
* Show series `index`: **trace** its line in left-to-right — the same draw as
|
|
317
|
-
* {@link enter}, not an opacity fade — in lockstep with its legend entry
|
|
318
|
-
* growing in.
|
|
319
|
-
*
|
|
320
|
-
* `enabled` is set as part of the command's own value rather than before it,
|
|
321
|
-
* so the line is drawable for every `t` the trace covers and undrawn outside
|
|
322
|
-
* it — which is what makes arriving here backwards show the same thing as
|
|
323
|
-
* arriving forwards.
|
|
324
|
-
*/
|
|
325
|
-
showSeries(args: CommandArgs<{
|
|
326
|
-
seriesIndex: number;
|
|
327
|
-
}> & {
|
|
328
|
-
duration?: number;
|
|
329
|
-
}): Command<Record<string, never>>;
|
|
330
|
-
/**
|
|
331
|
-
* Hide series `index`: **retrace** its line back out (`progress` 1 → 0) as its
|
|
332
|
-
* legend entry shrinks away — the mirror of {@link showSeries}.
|
|
333
|
-
*/
|
|
334
|
-
hideSeries(args: CommandArgs<{
|
|
335
|
-
seriesIndex: number;
|
|
336
|
-
}> & {
|
|
337
|
-
duration?: number;
|
|
338
|
-
}): Command<Record<string, never>>;
|
|
339
|
-
/**
|
|
340
|
-
* Fade out all other series — each line **and its legend entry** — to focus
|
|
341
|
-
* attention on `index`, which comes back to full. The legend dims in place
|
|
342
|
-
* (opacity only), so no entry moves and the row doesn't reflow.
|
|
343
|
-
*/
|
|
344
|
-
spotlightSeries(args: CommandArgs<{
|
|
345
|
-
seriesIndex: number;
|
|
346
|
-
}> & {
|
|
347
|
-
duration?: number;
|
|
348
|
-
}): Command<Record<string, never>>;
|
|
349
|
-
/** Both axes as drawn, so an auto range or tick row is read back as itself. */
|
|
350
|
-
private _domains;
|
|
351
|
-
/** From a resolved `from`: the axis tween steps an auto side at the midpoint, which is a cut. */
|
|
352
|
-
private _tweenAxes;
|
|
353
|
-
}
|
|
354
|
-
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
|
+
}, null, 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
|
+
}>, null>>;
|
|
154
|
+
export type LineChart = NodeOf<typeof LineChart>;
|
|
355
155
|
//# sourceMappingURL=line-chart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-chart.d.ts","sourceRoot":"","sources":["../../src/line-chart/line-chart.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"line-chart.d.ts","sourceRoot":"","sources":["../../src/line-chart/line-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,UAAU,EAEf,KAAK,MAAM,EAEX,KAAK,MAAM,EACX,KAAK,WAAW,EAIjB,MAAM,mBAAmB,CAAA;AAU1B,OAAO,EAWL,KAAK,gBAAgB,EACrB,KAAK,KAAK,EACX,MAAM,eAAe,CAAA;AAItB,OAAO,EAOL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,UAAU,EAEhB,MAAM,UAAU,CAAA;AAGjB,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,kEAAkE;IAClE,IAAI,EAAE,UAAU,EAAE,CAAA;IAClB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAA;IACd,oFAAoF;IACpF,MAAM,EAAE,UAAU,EAAE,CAAA;IACpB,oEAAoE;IACpE,KAAK,CAAC,EAAE,gBAAgB,CAAA;IACxB,oEAAoE;IACpE,KAAK,CAAC,EAAE,gBAAgB,CAAA;IACxB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IAC1B;;;;OAIG;IACH,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,+DAA+D;AAC/D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,CAAC,EAAE,gBAAgB,GAAG;QAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;IAClF,QAAQ,CAAC,CAAC,EAAE,gBAAgB,GAAG;QAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;CACnF;AAED,uDAAuD;AACvD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,CAAA;IAC7B,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAA;IAChC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAA;CACjC;AAsED,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,eAAe,GAAG,gBAAgB,CAKrE;AAoGD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,SAAS;;;;;;;IASlB;;;OAGG;;IAEH;;;;OAIG;;IAEH,oFAAoF;;IAEpF;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAjBH;;;OAGG;;IAEH;;;;OAIG;;IAEH,oFAAoF;;IAEpF;;;;OAIG;;UA4PL,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAA"}
|