@motionscript/charts 0.0.0-stage → 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/LICENSE +201 -0
- package/dist/bar-chart/bar-chart.d.ts +286 -0
- package/dist/bar-chart/bar-chart.d.ts.map +1 -0
- package/dist/bar-chart/bar-chart.js +610 -0
- package/dist/bar-chart/bar-chart.js.map +1 -0
- package/dist/bar-chart/category-axis.d.ts +77 -0
- package/dist/bar-chart/category-axis.d.ts.map +1 -0
- package/dist/bar-chart/category-axis.js +141 -0
- package/dist/bar-chart/category-axis.js.map +1 -0
- package/dist/bar-chart/chart-bars.d.ts +149 -0
- package/dist/bar-chart/chart-bars.d.ts.map +1 -0
- package/dist/bar-chart/chart-bars.js +236 -0
- package/dist/bar-chart/chart-bars.js.map +1 -0
- package/dist/bar-chart/index.d.ts +16 -0
- package/dist/bar-chart/index.d.ts.map +1 -0
- package/dist/bar-chart/index.js +12 -0
- package/dist/bar-chart/index.js.map +1 -0
- package/dist/bar-chart/shared.d.ts +146 -0
- package/dist/bar-chart/shared.d.ts.map +1 -0
- package/dist/bar-chart/shared.js +182 -0
- package/dist/bar-chart/shared.js.map +1 -0
- package/dist/browser/chunks/chunk-ZMBOBHYL.js +2 -0
- package/dist/browser/chunks/chunk-ZMBOBHYL.js.map +7 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/browser/kit.js +2 -0
- package/dist/browser/kit.js.map +7 -0
- package/dist/browser/manifest.json +12 -0
- package/dist/engine.d.ts +27 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +27 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/kit/chart-border.d.ts +28 -0
- package/dist/kit/chart-border.d.ts.map +1 -0
- package/dist/kit/chart-border.js +45 -0
- package/dist/kit/chart-border.js.map +1 -0
- package/dist/kit/chart-canvas.d.ts +56 -0
- package/dist/kit/chart-canvas.d.ts.map +1 -0
- package/dist/kit/chart-canvas.js +125 -0
- package/dist/kit/chart-canvas.js.map +1 -0
- package/dist/kit/chart-legend.d.ts +126 -0
- package/dist/kit/chart-legend.d.ts.map +1 -0
- package/dist/kit/chart-legend.js +212 -0
- package/dist/kit/chart-legend.js.map +1 -0
- package/dist/kit/shared.d.ts +251 -0
- package/dist/kit/shared.d.ts.map +1 -0
- package/dist/kit/shared.js +401 -0
- package/dist/kit/shared.js.map +1 -0
- package/dist/kit/vertical-axis.d.ts +99 -0
- package/dist/kit/vertical-axis.d.ts.map +1 -0
- package/dist/kit/vertical-axis.js +176 -0
- package/dist/kit/vertical-axis.js.map +1 -0
- package/dist/line-chart/chart-line.d.ts +91 -0
- package/dist/line-chart/chart-line.d.ts.map +1 -0
- package/dist/line-chart/chart-line.js +156 -0
- package/dist/line-chart/chart-line.js.map +1 -0
- package/dist/line-chart/chart-region.d.ts +47 -0
- package/dist/line-chart/chart-region.d.ts.map +1 -0
- package/dist/line-chart/chart-region.js +101 -0
- package/dist/line-chart/chart-region.js.map +1 -0
- package/dist/line-chart/horizontal-axis.d.ts +85 -0
- package/dist/line-chart/horizontal-axis.d.ts.map +1 -0
- package/dist/line-chart/horizontal-axis.js +158 -0
- package/dist/line-chart/horizontal-axis.js.map +1 -0
- package/dist/line-chart/index.d.ts +22 -0
- package/dist/line-chart/index.d.ts.map +1 -0
- package/dist/line-chart/index.js +19 -0
- package/dist/line-chart/index.js.map +1 -0
- package/dist/line-chart/line-chart.d.ts +347 -0
- package/dist/line-chart/line-chart.d.ts.map +1 -0
- package/dist/line-chart/line-chart.js +701 -0
- package/dist/line-chart/line-chart.js.map +1 -0
- package/dist/line-chart/shared.d.ts +171 -0
- package/dist/line-chart/shared.d.ts.map +1 -0
- package/dist/line-chart/shared.js +270 -0
- package/dist/line-chart/shared.js.map +1 -0
- package/dist/line-chart/x-scale.d.ts +84 -0
- package/dist/line-chart/x-scale.d.ts.map +1 -0
- package/dist/line-chart/x-scale.js +302 -0
- package/dist/line-chart/x-scale.js.map +1 -0
- package/dist/nodes.d.ts +20 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +20 -0
- package/dist/nodes.js.map +1 -0
- package/dist/pie-chart/index.d.ts +18 -0
- package/dist/pie-chart/index.d.ts.map +1 -0
- package/dist/pie-chart/index.js +14 -0
- package/dist/pie-chart/index.js.map +1 -0
- package/dist/pie-chart/pie-chart.d.ts +170 -0
- package/dist/pie-chart/pie-chart.d.ts.map +1 -0
- package/dist/pie-chart/pie-chart.js +291 -0
- package/dist/pie-chart/pie-chart.js.map +1 -0
- package/dist/pie-chart/pie-legend.d.ts +60 -0
- package/dist/pie-chart/pie-legend.d.ts.map +1 -0
- package/dist/pie-chart/pie-legend.js +131 -0
- package/dist/pie-chart/pie-legend.js.map +1 -0
- package/dist/pie-chart/pie-ring.d.ts +266 -0
- package/dist/pie-chart/pie-ring.d.ts.map +1 -0
- package/dist/pie-chart/pie-ring.js +708 -0
- package/dist/pie-chart/pie-ring.js.map +1 -0
- package/dist/pie-chart/shared.d.ts +210 -0
- package/dist/pie-chart/shared.d.ts.map +1 -0
- package/dist/pie-chart/shared.js +240 -0
- package/dist/pie-chart/shared.js.map +1 -0
- package/package.json +69 -3
- package/registry.json +23 -0
- package/src/bar-chart/bar-chart.ts +804 -0
- package/src/bar-chart/category-axis.ts +177 -0
- package/src/bar-chart/chart-bars.ts +310 -0
- package/src/bar-chart/index.ts +31 -0
- package/src/bar-chart/shared.ts +354 -0
- package/src/engine.ts +26 -0
- package/src/index.ts +5 -0
- package/src/kit/chart-border.ts +61 -0
- package/src/kit/chart-canvas.ts +157 -0
- package/src/kit/chart-legend.ts +250 -0
- package/src/kit/shared.ts +675 -0
- package/src/kit/vertical-axis.ts +224 -0
- package/src/line-chart/chart-line.ts +208 -0
- package/src/line-chart/chart-region.ts +135 -0
- package/src/line-chart/horizontal-axis.ts +202 -0
- package/src/line-chart/index.ts +39 -0
- package/src/line-chart/line-chart.ts +894 -0
- package/src/line-chart/shared.ts +459 -0
- package/src/line-chart/x-scale.ts +367 -0
- package/src/nodes.ts +20 -0
- package/src/pie-chart/index.ts +37 -0
- package/src/pie-chart/pie-chart.ts +374 -0
- package/src/pie-chart/pie-legend.ts +159 -0
- package/src/pie-chart/pie-ring.ts +903 -0
- package/src/pie-chart/shared.ts +490 -0
- package/README.md +0 -4
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { Node2D, type Command, type CommandArgs, type DataRecord, type NodeConfig, type Node2DProps } from "@motionscript/core";
|
|
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";
|
|
5
|
+
export interface LineChartProps extends Node2DProps {
|
|
6
|
+
/** One row per sample — a plain record of field name to value. */
|
|
7
|
+
data: DataRecord[];
|
|
8
|
+
/**
|
|
9
|
+
* Key into each row for its x value, shared by every series. Named `xField`
|
|
10
|
+
* rather than `x` because every node already has an `x` — its position.
|
|
11
|
+
*/
|
|
12
|
+
xField: string;
|
|
13
|
+
/** One polyline per entry: which field it plots, its legend `label`, its `fill`. */
|
|
14
|
+
series: LineSeries[];
|
|
15
|
+
/** X-axis data domain: caption, scale range, and tick placement. */
|
|
16
|
+
xAxis?: AxisDomainConfig;
|
|
17
|
+
/** Y-axis data domain: caption, scale range, and tick placement. */
|
|
18
|
+
yAxis?: AxisDomainConfig;
|
|
19
|
+
/**
|
|
20
|
+
* A slice of the plot to spotlight, in **data units**. Dashed rules mark the
|
|
21
|
+
* bounded edges and every series fades outside the box — see
|
|
22
|
+
* {@link LineChart.spotlightRegion}, which animates the same thing. `null`
|
|
23
|
+
* (the default) is no region.
|
|
24
|
+
*/
|
|
25
|
+
region?: PlotRegion | null;
|
|
26
|
+
/**
|
|
27
|
+
* The chart's visual theme — series palette, axis text/grid/gutters, plot
|
|
28
|
+
* panel paint, and legend styling. Every branch is optional and deep-merged
|
|
29
|
+
* onto {@link DEFAULT_CHART_THEME}, so pass only what you want to override.
|
|
30
|
+
*/
|
|
31
|
+
theme?: ChartTheme;
|
|
32
|
+
/** Whether the legend row below the plot is drawn at all. */
|
|
33
|
+
showLegend?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The two signals the region call-out is made of, as a props type for the
|
|
37
|
+
* commands that move them.
|
|
38
|
+
*
|
|
39
|
+
* Written out rather than reusing `LineChartProps` because the pair is what
|
|
40
|
+
* those commands actually touch, and because `regionReveal` is a signal of the
|
|
41
|
+
* chart's own rather than part of its authored props.
|
|
42
|
+
*/
|
|
43
|
+
type RegionState = {
|
|
44
|
+
region: PlotRegion | null;
|
|
45
|
+
regionReveal: number;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* A multi-series line chart, composed from five independent parts rather than
|
|
49
|
+
* one monolithic draw:
|
|
50
|
+
*
|
|
51
|
+
* - {@link ChartCanvas} — the plot panel with a two-way grid, under everything.
|
|
52
|
+
* - {@link VerticalAxis} / {@link HorizontalAxis} — columns/rows of real text
|
|
53
|
+
* markers that stagger in, each carrying its own axis caption.
|
|
54
|
+
* - {@link ChartRegion} — the optional call-out marking a spotlit slice of the
|
|
55
|
+
* plot: dashed rules on its bounded edges, and every series faded outside it.
|
|
56
|
+
* - {@link ChartLine} (one per series) — the traced polylines over the canvas.
|
|
57
|
+
* - {@link ChartLegend} — a row of entries below the chart, one per series.
|
|
58
|
+
*
|
|
59
|
+
* The parts are laid out from this node's `layoutBounds`: a left gutter for the
|
|
60
|
+
* vertical axis, a bottom gutter for the horizontal axis, the plot filling
|
|
61
|
+
* what's left, and the legend row beneath the whole chart. Every child's
|
|
62
|
+
* position/size is bound reactively, so the chart re-flows if its box changes,
|
|
63
|
+
* and the series lines read the same resolved scales as the axes, so points land
|
|
64
|
+
* exactly on their markers.
|
|
65
|
+
*
|
|
66
|
+
* **Resting state is the finished chart.** Unlike the standalone component this
|
|
67
|
+
* was ported from, nothing is built hidden: the studio paints a node's Initial
|
|
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.
|
|
71
|
+
*
|
|
72
|
+
* Past the entrance, three things move the chart around:
|
|
73
|
+
* {@link showSeries}/{@link hideSeries}/{@link spotlightSeries} pick out a
|
|
74
|
+
* *series*, {@link spotlightRegion} marks a *slice of the plot* without changing
|
|
75
|
+
* the scale, and {@link zoomTo} rescales the axes so a slice fills the plot. The
|
|
76
|
+
* last two take the same {@link PlotRegion} and compose — a spotlit region
|
|
77
|
+
* resolves against the live scales, so it travels with a zoom.
|
|
78
|
+
*/
|
|
79
|
+
export declare class LineChart extends Node2D<LineChartProps> {
|
|
80
|
+
data: DataRecord[];
|
|
81
|
+
xField: string;
|
|
82
|
+
series: LineSeries[];
|
|
83
|
+
/**
|
|
84
|
+
* X/Y-axis data domain (label/range/ticks), tweenable and mappable like
|
|
85
|
+
* `theme`: the mapper merges a partial input onto the previous resolved
|
|
86
|
+
* domain (leaving `range`/`ticks` `undefined` — the auto-derive signal — on
|
|
87
|
+
* first resolution), and the tween interpolates them numerically, so
|
|
88
|
+
* `chart.to({ yAxis: { range: [0, 10] } }, 1)` smoothly rescales the plotted
|
|
89
|
+
* lines. Like `theme`, the axis *label* text is captured once at construction.
|
|
90
|
+
*/
|
|
91
|
+
xAxis: AxisDomainConfig;
|
|
92
|
+
yAxis: AxisDomainConfig;
|
|
93
|
+
/**
|
|
94
|
+
* The chart's visual theme, tweenable and mappable like a `stroke`/`fill`
|
|
95
|
+
* prop: the mapper merges the author's partial input onto the previous
|
|
96
|
+
* resolved theme (or {@link DEFAULT_CHART_THEME} the first time) and resolves
|
|
97
|
+
* every leaf; the tween interpolates two resolved themes leaf-by-leaf, so
|
|
98
|
+
* `chart.to({ theme: next }, 1)` animates smoothly.
|
|
99
|
+
*/
|
|
100
|
+
theme: ChartTheme;
|
|
101
|
+
/**
|
|
102
|
+
* The spotlit slice of the plot in data units, or `null` for none. Held as a
|
|
103
|
+
* plain reactive value rather than a tweened one: the box itself snaps, and
|
|
104
|
+
* the *animation* is {@link regionReveal} drawing the rules on and the lines
|
|
105
|
+
* dimming outside it.
|
|
106
|
+
*/
|
|
107
|
+
region: PlotRegion | null;
|
|
108
|
+
/**
|
|
109
|
+
* How far the {@link region} call-out is drawn in, `[0, 1]` — the single
|
|
110
|
+
* signal behind both halves of the effect: the rules grow out and the wash
|
|
111
|
+
* fades up as it climbs, while every line's out-of-region stretch fades from
|
|
112
|
+
* full down to the theme's `region.dimOpacity`. At 0 a chart with a `region`
|
|
113
|
+
* set looks exactly like one without.
|
|
114
|
+
*/
|
|
115
|
+
regionReveal: number;
|
|
116
|
+
/**
|
|
117
|
+
* Read once, in the constructor, like `series`: the legend is a part the
|
|
118
|
+
* chart builds or doesn't, so a change reaches it by rebuilding the node.
|
|
119
|
+
*/
|
|
120
|
+
showLegend: boolean;
|
|
121
|
+
private vAxis;
|
|
122
|
+
private hAxis;
|
|
123
|
+
/** The plot panel — the box the grid, the lines and the region all share. */
|
|
124
|
+
private plotRect;
|
|
125
|
+
private legend;
|
|
126
|
+
private lines;
|
|
127
|
+
/**
|
|
128
|
+
* `this.theme` read back through its *resolved* shape: the property's declared
|
|
129
|
+
* type is the loose author-facing {@link ChartTheme} (so a partial theme is
|
|
130
|
+
* accepted), but the mapper always stores the fully-resolved
|
|
131
|
+
* {@link ChartConfig} at runtime — the same loose-declared/resolved-stored
|
|
132
|
+
* idiom as a shape's `fill`/`stroke`.
|
|
133
|
+
*/
|
|
134
|
+
private get resolvedTheme();
|
|
135
|
+
/** Fallback marker count when neither axis's ticks are given. */
|
|
136
|
+
private static readonly DEFAULT_MARKERS;
|
|
137
|
+
/**
|
|
138
|
+
* What the x column *is* — a number, an instant, or a place in the file — and
|
|
139
|
+
* with it how each row is positioned, ticked and captioned. See `x-scale.ts`.
|
|
140
|
+
*/
|
|
141
|
+
private get xColumn();
|
|
142
|
+
private get xScale();
|
|
143
|
+
private get yScale();
|
|
144
|
+
/** The vertical axis ticks: the explicit ones, else five across the scale. */
|
|
145
|
+
private get resolvedYMarkers();
|
|
146
|
+
/**
|
|
147
|
+
* The horizontal axis ticks: the explicit ones, else five across the scale.
|
|
148
|
+
*
|
|
149
|
+
* Asked of the column rather than spaced evenly, because only a numeric column
|
|
150
|
+
* has round numbers between its samples. On a month column, five evenly spaced
|
|
151
|
+
* values land two-thirds of the way through four different months; the ticks
|
|
152
|
+
* a reader wants are Jan/Apr/Jul/Oct/Dec, which are rows.
|
|
153
|
+
*/
|
|
154
|
+
private get resolvedXMarkers();
|
|
155
|
+
/**
|
|
156
|
+
* The plot panel's size, **as laid out**.
|
|
157
|
+
*
|
|
158
|
+
* This used to be computed: six constants estimating what the axis gutters and
|
|
159
|
+
* the legend row would take, subtracted from the node's box. The estimate was
|
|
160
|
+
* never the layout — the vertical axis is `width: "hug"`, so its real width is
|
|
161
|
+
* whatever its widest marker needs — and everything downstream inherited the
|
|
162
|
+
* gap. The grid is drawn by {@link ChartCanvas} across its *own* allocation,
|
|
163
|
+
* while the lines were mapped across the estimate, so a series sat a few
|
|
164
|
+
* percent off the grid line it was supposed to touch, silently and by an
|
|
165
|
+
* amount that changed with the theme.
|
|
166
|
+
*
|
|
167
|
+
* Asking the panel is exact by construction and cannot drift: the lines, the
|
|
168
|
+
* region rules and the grid all resolve against one box, and it is the box
|
|
169
|
+
* they are drawn in. Zero until the first layout pass, like any other
|
|
170
|
+
* `layoutBounds` read — the bindings that call this re-run on the next frame.
|
|
171
|
+
*/
|
|
172
|
+
private plotSize;
|
|
173
|
+
/**
|
|
174
|
+
* Map one series' data points into the plot's **centred** pixel space (origin
|
|
175
|
+
* at the plot centre, y-up) — the local frame of the clip/line box that fills
|
|
176
|
+
* the plot. x runs `[-w/2, +w/2]`, y runs `[-h/2, +h/2]`.
|
|
177
|
+
*/
|
|
178
|
+
private seriesPixels;
|
|
179
|
+
/**
|
|
180
|
+
* {@link region} mapped into the plot's **centred** pixel space — the same
|
|
181
|
+
* frame {@link seriesPixels} returns, so the region's rules and each line's
|
|
182
|
+
* clip resolve against one box from one place. Reads the live scales, so it
|
|
183
|
+
* re-maps when `xAxis`/`yAxis` tween.
|
|
184
|
+
*/
|
|
185
|
+
/**
|
|
186
|
+
* Whether a call-out is authored at all — the question {@link enter} and
|
|
187
|
+
* {@link spotlightRegion} branch on.
|
|
188
|
+
*
|
|
189
|
+
* Deliberately **not** `hasRegion(this.regionBox())`, which they used to ask.
|
|
190
|
+
* That resolves the region into pixels, so it answers "and has the chart been
|
|
191
|
+
* laid out yet" as well, and comes back false for a perfectly real region on a
|
|
192
|
+
* chart that has not been measured. A generator never noticed, because it only
|
|
193
|
+
* ever ran mid-playback; a command is *built* before the first layout pass, and
|
|
194
|
+
* would have quietly dropped the region beat every time.
|
|
195
|
+
*
|
|
196
|
+
* What is left once the pixels are taken out is the same test
|
|
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 {};
|
|
347
|
+
//# sourceMappingURL=line-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line-chart.d.ts","sourceRoot":"","sources":["../../src/line-chart/line-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,EAIN,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,WAAW,EAEjB,MAAM,oBAAoB,CAAA;AAM3B,OAAO,EAQL,KAAK,gBAAgB,EAEtB,MAAM,eAAe,CAAA;AAKtB,OAAO,EAQL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,UAAU,EAEhB,MAAM,UAAU,CAAA;AAEjB,OAAO,EAA0C,KAAK,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAEpG,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;AAuBD;;;;;;;GAOG;AACH,KAAK,WAAW,GAAG;IAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IAAC,YAAY,EAAE,MAA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