@motionscript/charts 0.1.0-alpha.0 → 0.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +105 -0
- package/NOTICE +49 -0
- package/README.md +99 -0
- package/dist/bar-chart/bar-chart.d.ts +133 -228
- package/dist/bar-chart/bar-chart.d.ts.map +1 -1
- package/dist/bar-chart/bar-chart.js +386 -565
- package/dist/bar-chart/bar-chart.js.map +1 -1
- package/dist/bar-chart/category-axis.d.ts +35 -41
- package/dist/bar-chart/category-axis.d.ts.map +1 -1
- package/dist/bar-chart/category-axis.js +93 -115
- package/dist/bar-chart/category-axis.js.map +1 -1
- package/dist/bar-chart/chart-bars.d.ts +50 -70
- package/dist/bar-chart/chart-bars.d.ts.map +1 -1
- package/dist/bar-chart/chart-bars.js +155 -210
- package/dist/bar-chart/chart-bars.js.map +1 -1
- package/dist/bar-chart/index.d.ts +2 -2
- package/dist/bar-chart/index.d.ts.map +1 -1
- package/dist/bar-chart/index.js +1 -1
- package/dist/bar-chart/index.js.map +1 -1
- package/dist/bar-chart/shared.d.ts +7 -7
- package/dist/bar-chart/shared.d.ts.map +1 -1
- package/dist/bar-chart/shared.js +7 -7
- package/dist/bar-chart/shared.js.map +1 -1
- package/dist/browser/chunks/chunk-TJNHLQGV.js +2 -0
- package/dist/browser/chunks/chunk-TJNHLQGV.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/browser/kit.js +1 -1
- package/dist/browser/manifest.json +4 -3
- package/dist/engine.d.ts +10 -8
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +10 -8
- package/dist/engine.js.map +1 -1
- package/dist/kit/cartesian.d.ts +44 -0
- package/dist/kit/cartesian.d.ts.map +1 -0
- package/dist/kit/cartesian.js +59 -0
- package/dist/kit/cartesian.js.map +1 -0
- package/dist/kit/chart-border.d.ts +10 -11
- package/dist/kit/chart-border.d.ts.map +1 -1
- package/dist/kit/chart-border.js +15 -32
- package/dist/kit/chart-border.js.map +1 -1
- package/dist/kit/chart-canvas.d.ts +32 -21
- package/dist/kit/chart-canvas.d.ts.map +1 -1
- package/dist/kit/chart-canvas.js +33 -90
- package/dist/kit/chart-canvas.js.map +1 -1
- package/dist/kit/chart-legend.d.ts +123 -85
- package/dist/kit/chart-legend.d.ts.map +1 -1
- package/dist/kit/chart-legend.js +137 -186
- package/dist/kit/chart-legend.js.map +1 -1
- package/dist/kit/entries.d.ts +17 -0
- package/dist/kit/entries.d.ts.map +1 -0
- package/dist/kit/entries.js +19 -0
- package/dist/kit/entries.js.map +1 -0
- package/dist/kit/motion.d.ts +48 -0
- package/dist/kit/motion.d.ts.map +1 -0
- package/dist/kit/motion.js +63 -0
- package/dist/kit/motion.js.map +1 -0
- package/dist/kit/paints.d.ts +10 -0
- package/dist/kit/paints.d.ts.map +1 -0
- package/dist/kit/paints.js +12 -0
- package/dist/kit/paints.js.map +1 -0
- package/dist/kit/shared.d.ts +61 -10
- package/dist/kit/shared.d.ts.map +1 -1
- package/dist/kit/shared.js +108 -13
- package/dist/kit/shared.js.map +1 -1
- package/dist/kit/vertical-axis.d.ts +48 -61
- package/dist/kit/vertical-axis.d.ts.map +1 -1
- package/dist/kit/vertical-axis.js +97 -132
- package/dist/kit/vertical-axis.js.map +1 -1
- package/dist/line-chart/chart-line.d.ts +60 -77
- package/dist/line-chart/chart-line.d.ts.map +1 -1
- package/dist/line-chart/chart-line.js +100 -121
- package/dist/line-chart/chart-line.js.map +1 -1
- package/dist/line-chart/chart-region.d.ts +32 -33
- package/dist/line-chart/chart-region.d.ts.map +1 -1
- package/dist/line-chart/chart-region.js +31 -65
- package/dist/line-chart/chart-region.js.map +1 -1
- package/dist/line-chart/horizontal-axis.d.ts +58 -64
- package/dist/line-chart/horizontal-axis.d.ts.map +1 -1
- package/dist/line-chart/horizontal-axis.js +94 -123
- package/dist/line-chart/horizontal-axis.js.map +1 -1
- package/dist/line-chart/index.d.ts +3 -3
- package/dist/line-chart/index.d.ts.map +1 -1
- package/dist/line-chart/index.js +2 -2
- package/dist/line-chart/index.js.map +1 -1
- package/dist/line-chart/line-chart.d.ts +156 -303
- package/dist/line-chart/line-chart.d.ts.map +1 -1
- package/dist/line-chart/line-chart.js +410 -638
- package/dist/line-chart/line-chart.js.map +1 -1
- package/dist/line-chart/shared.d.ts +7 -7
- package/dist/line-chart/shared.d.ts.map +1 -1
- package/dist/line-chart/shared.js +23 -8
- package/dist/line-chart/shared.js.map +1 -1
- package/dist/line-chart/x-scale.d.ts +4 -11
- package/dist/line-chart/x-scale.d.ts.map +1 -1
- package/dist/line-chart/x-scale.js +16 -5
- package/dist/line-chart/x-scale.js.map +1 -1
- package/dist/nodes.d.ts +6 -9
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js +7 -9
- package/dist/nodes.js.map +1 -1
- package/dist/pie-chart/index.d.ts +2 -2
- package/dist/pie-chart/index.d.ts.map +1 -1
- package/dist/pie-chart/index.js +1 -1
- package/dist/pie-chart/index.js.map +1 -1
- package/dist/pie-chart/pie-chart.d.ts +108 -126
- package/dist/pie-chart/pie-chart.d.ts.map +1 -1
- package/dist/pie-chart/pie-chart.js +202 -271
- package/dist/pie-chart/pie-chart.js.map +1 -1
- package/dist/pie-chart/pie-legend.d.ts +84 -31
- package/dist/pie-chart/pie-legend.d.ts.map +1 -1
- package/dist/pie-chart/pie-legend.js +93 -107
- package/dist/pie-chart/pie-legend.js.map +1 -1
- package/dist/pie-chart/pie-ring.d.ts +160 -122
- package/dist/pie-chart/pie-ring.d.ts.map +1 -1
- package/dist/pie-chart/pie-ring.js +333 -361
- package/dist/pie-chart/pie-ring.js.map +1 -1
- package/dist/pie-chart/shared.d.ts +12 -6
- package/dist/pie-chart/shared.d.ts.map +1 -1
- package/dist/pie-chart/shared.js +14 -8
- package/dist/pie-chart/shared.js.map +1 -1
- package/package.json +7 -4
- package/src/bar-chart/bar-chart.ts +424 -686
- package/src/bar-chart/category-axis.ts +96 -111
- package/src/bar-chart/chart-bars.ts +178 -201
- package/src/bar-chart/index.ts +2 -2
- package/src/bar-chart/shared.ts +7 -7
- package/src/engine.ts +10 -8
- package/src/kit/cartesian.ts +81 -0
- package/src/kit/chart-border.ts +23 -34
- package/src/kit/chart-canvas.ts +45 -80
- package/src/kit/chart-legend.ts +185 -206
- package/src/kit/entries.ts +20 -0
- package/src/kit/motion.ts +90 -0
- package/src/kit/paints.ts +15 -0
- package/src/kit/shared.ts +120 -13
- package/src/kit/vertical-axis.ts +111 -141
- package/src/line-chart/chart-line.ts +103 -155
- package/src/line-chart/chart-region.ts +36 -81
- package/src/line-chart/horizontal-axis.ts +102 -153
- package/src/line-chart/index.ts +3 -3
- package/src/line-chart/line-chart.ts +463 -759
- package/src/line-chart/shared.ts +22 -8
- package/src/line-chart/x-scale.ts +20 -5
- package/src/nodes.ts +8 -10
- package/src/pie-chart/index.ts +2 -2
- package/src/pie-chart/pie-chart.ts +225 -303
- package/src/pie-chart/pie-legend.ts +125 -115
- package/src/pie-chart/pie-ring.ts +388 -443
- package/src/pie-chart/shared.ts +14 -8
- package/dist/browser/chunks/chunk-ZMBOBHYL.js +0 -2
- package/dist/browser/chunks/chunk-ZMBOBHYL.js.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-canvas.js","sourceRoot":"","sources":["../../src/kit/chart-canvas.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chart-canvas.js","sourceRoot":"","sources":["../../src/kit/chart-canvas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,SAAS,GAWV,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,cAAc,GAEf,MAAM,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,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;QACpC,CAAC;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\n Graphics2D,\n Types,\n component2d,\n fillOps,\n shadowOps,\n strokeOps,\n type Fill,\n type FillResolved,\n type NodeOf,\n // Named so this component's emitted type reaches `Node2D` through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps,\n type Shadow,\n type ShadowResolved,\n type Stroke,\n type StrokeResolved,\n} from \"@motionscript/sdk\"\n\nimport { fresh } from \"./entries\"\nimport { loadPaints } from \"./paints\"\nimport {\n DEFAULT_PLOT_AREA,\n DEFAULT_X_AXIS,\n DEFAULT_Y_AXIS,\n type Range,\n} from \"./shared\"\n\nexport interface ChartCanvasProps extends Node2DProps {\n /** Fill of the plot panel behind the marks. */\n fill: Fill\n /** Drop shadow of the panel. Default none. */\n shadow: Shadow\n /** Stroke of the vertical grid lines (one per {@link xMarkers}). */\n xGridStroke: Stroke\n /** Stroke of the horizontal grid lines (one per {@link yMarkers}). */\n yGridStroke: Stroke\n /**\n * Data-unit x positions to draw a vertical grid line at — one per horizontal\n * axis marker, so a line lands under every marker regardless of spacing.\n * Positions at (or past) an {@link xExtent} edge coincide with the border and\n * are skipped. Pass an empty list for a chart whose horizontal axis is\n * categorical and so has no numeric position to rule at.\n */\n xMarkers: number[]\n /** Data-unit y positions to draw a horizontal grid line at. */\n yMarkers: number[]\n /** `[min, max]` of the horizontal scale — maps {@link xMarkers} into the panel. */\n xExtent: Range\n /** `[min, max]` of the vertical scale — maps {@link yMarkers} into the panel. */\n yExtent: Range\n}\n\nconst strokeEntry = (initial: Stroke) =>\n Types.custom<Stroke, StrokeResolved[]>(initial, { resolve: strokeOps.resolve, lerp: strokeOps.lerp })\n\n/**\n * The plot **backdrop** of a cartesian chart: a filled panel with a grid of\n * faint lines spanning both directions across it, sized from its box and centred\n * on its origin.\n *\n * The thick frame is a **separate** {@link ChartBorder} node so it can be drawn\n * *over* the marks while this panel sits under them. Grid lines are placed from\n * the axis marker positions (in data units) mapped into the panel through\n * {@link ChartCanvasProps.xExtent}/`yExtent` — so each line lands under its\n * marker whether or not the markers are evenly spaced.\n */\nexport const ChartCanvas = component2d({\n key: \"chartCanvas\",\n state: {\n fill: Types.custom<Fill, FillResolved[]>(DEFAULT_PLOT_AREA.fill, { resolve: fillOps.resolve, lerp: fillOps.lerp }),\n shadow: Types.custom<Shadow, ShadowResolved[]>(DEFAULT_PLOT_AREA.shadow, { resolve: shadowOps.resolve, lerp: shadowOps.lerp }),\n xGridStroke: strokeEntry(DEFAULT_X_AXIS.lineStyle),\n yGridStroke: strokeEntry(DEFAULT_Y_AXIS.lineStyle),\n xMarkers: fresh<number[]>(() => []),\n yMarkers: fresh<number[]>(() => []),\n xExtent: fresh<Range>(() => [0, 1]),\n yExtent: fresh<Range>(() => [0, 1]),\n },\n // The grid strokes are named past the conventional slots, so they are named here.\n load: (loader, state) =>\n loadPaints(loader, { fills: [state.fill], shadows: [state.shadow], strokes: [state.xGridStroke, state.yGridStroke] }),\n render: (ctx, state) => {\n const { width: W, height: H } = ctx.size\n if (W <= 0 || H <= 0) return\n\n // Plot panel, centred on the origin (node space is y-up, origin centre).\n ctx.draw(new Graphics2D().rect({ x: 0, y: 0, width: W, height: H }).shadow(state.shadow).fill(state.fill))\n\n const [xMin, xMax] = state.xExtent\n const [yMin, yMax] = state.yExtent\n // Fraction of a marker across its extent; guard a zero-width extent.\n const xFrac = (v: number) => (xMax <= xMin ? 0 : (v - xMin) / (xMax - xMin))\n const yFrac = (v: number) => (yMax <= yMin ? 0 : (v - yMin) / (yMax - yMin))\n // Skip markers landing on (or outside) the edges — they'd sit under the border.\n const interior = (f: number) => f > 1e-6 && f < 1 - 1e-6\n\n const xStroke = state.xGridStroke[0]\n if (xStroke) {\n const xGrid = new Graphics2D()\n for (const v of state.xMarkers) {\n const f = xFrac(v)\n if (!interior(f)) continue\n xGrid.rect({ x: -W / 2 + f * W, y: 0, width: xStroke.weight, height: H })\n }\n ctx.draw(xGrid.fill(xStroke.fill))\n }\n\n const yStroke = state.yGridStroke[0]\n if (yStroke) {\n const yGrid = new Graphics2D()\n for (const v of state.yMarkers) {\n const f = yFrac(v)\n if (!interior(f)) continue\n yGrid.rect({ x: 0, y: -H / 2 + f * H, width: W, height: yStroke.weight })\n }\n ctx.draw(yGrid.fill(yStroke.fill))\n }\n },\n})\n\nexport type ChartCanvas = NodeOf<typeof ChartCanvas>\n"]}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type Seekable } from "@motionscript/core/component";
|
|
1
|
+
import { type Fill, type NodeOf, type RectProps, type Alignment as _Alignment, type CornerRadiusResolved as _CornerRadiusResolved, type CornerStyleResolved as _CornerStyleResolved, type FillResolved as _FillResolved, type FlowMode as _FlowMode, type FlowResolved as _FlowResolved, type GapSize as _GapSize, type Node2D as _Node2D, type Node2DProps as _Node2DProps, type RectCornerRadius as _RectCornerRadius, type RectCornerStyle as _RectCornerStyle, type Shadow as _Shadow, type ShadowResolved as _ShadowResolved, type Stroke as _Stroke, type StrokeResolved as _StrokeResolved, type Vector2 as _Vector2 } from "@motionscript/sdk";
|
|
3
2
|
import { type ChartSeries, type LegendConfig } from "./shared.js";
|
|
4
3
|
export interface ChartLegendProps extends RectProps {
|
|
5
4
|
/**
|
|
6
5
|
* One entry per series: legend `label`, its `enabled` default, and — through
|
|
7
6
|
* {@link ChartLegendProps.swatches} — the colour its chip is painted. A series
|
|
8
7
|
* that starts enabled (the default) is added to the row up front; one that
|
|
9
|
-
* starts `false` is hidden until a later
|
|
8
|
+
* starts `false` is hidden until a later `showSeries`.
|
|
10
9
|
*/
|
|
11
10
|
series: ChartSeries[];
|
|
12
11
|
/**
|
|
@@ -25,102 +24,141 @@ export interface ChartLegendProps extends RectProps {
|
|
|
25
24
|
* with a rounded colour swatch; only the swatch carries the series colour, the
|
|
26
25
|
* caption reads in the legend's neutral ink.
|
|
27
26
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
27
|
+
* `showSeries`/`hideSeries` flip a series on or off — showing one grows its
|
|
28
|
+
* entry back in at its stable series position, hiding one shrinks it away. So
|
|
29
|
+
* the row only ever shows the currently-enabled series, in series order, and
|
|
30
|
+
* closes the gap when one leaves.
|
|
32
31
|
*
|
|
33
32
|
* This node *is* the row, so the parent places it (centred below the chart) and
|
|
34
33
|
* it hugs its entries.
|
|
35
34
|
*/
|
|
36
|
-
export declare
|
|
37
|
-
series: ChartSeries[]
|
|
38
|
-
swatches: Fill[]
|
|
39
|
-
legend: LegendConfig
|
|
40
|
-
/** One entry per series. **Every** entry is a child — see {@link reveal}. */
|
|
41
|
-
private items;
|
|
35
|
+
export declare const ChartLegend: import("@motionscript/sdk").Component<"chartLegend", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
36
|
+
readonly series: import("@motionscript/sdk").Type<ChartSeries[], ChartSeries[], false>;
|
|
37
|
+
readonly swatches: import("@motionscript/sdk").Type<Fill[], Fill[], false>;
|
|
38
|
+
readonly legend: import("@motionscript/sdk").Type<LegendConfig, LegendConfig, false>;
|
|
42
39
|
/**
|
|
43
40
|
* How far each entry is shown, `0`–`1`. Drives its width, opacity and gap
|
|
44
41
|
* together, so `0` is an entry that takes no room and `1` is one at its
|
|
45
42
|
* natural size.
|
|
46
43
|
*
|
|
47
|
-
* This replaces adding and removing the entry from the row
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* getting there means having run the add. Collapsed-but-present is the same
|
|
52
|
-
* picture reached by a route that *is* a function of `t`.
|
|
53
|
-
*
|
|
54
|
-
* A plain array rather than reactive props because the count is the series
|
|
55
|
-
* count, which is data. The entries' props are bound to it, so writing one
|
|
56
|
-
* still moves the layout.
|
|
57
|
-
*/
|
|
58
|
-
private reveal;
|
|
59
|
-
/**
|
|
60
|
-
* Each entry's natural width, last time it was fully shown.
|
|
61
|
-
*
|
|
62
|
-
* A collapse needs numeric endpoints — `lerpSizeInput` snaps between a token
|
|
63
|
-
* and a number rather than interpolating — and `"hug"` is not a number until
|
|
64
|
-
* something measures it. Refreshed on every frame an entry is at full reveal
|
|
65
|
-
* (see {@link widthFor}), so it is current by the time a hide starts, and it
|
|
66
|
-
* tracks a relabelled series or a restyled legend without being told.
|
|
67
|
-
*/
|
|
68
|
-
private natural;
|
|
69
|
-
constructor(props?: NodeConfig<ChartLegend, ChartLegendProps>);
|
|
70
|
-
/**
|
|
71
|
-
* An entry's width for its current reveal.
|
|
72
|
-
*
|
|
73
|
-
* `"hug"` at full reveal rather than the pinned number, so a shown entry stays
|
|
74
|
-
* responsive to its own content; the number only takes over while it is
|
|
75
|
-
* collapsing, which is the only time a token cannot express it.
|
|
76
|
-
*
|
|
77
|
-
* Records the natural width as a side effect, which is the honest place for it:
|
|
78
|
-
* this runs inside a binding, so it is already reading the layout every frame,
|
|
79
|
-
* and the value it wants is the one the layout just produced. It writes a plain
|
|
80
|
-
* array rather than a signal, so nothing is invalidated by it.
|
|
44
|
+
* This replaces adding and removing the entry from the row: a command is
|
|
45
|
+
* asked what it looks like at a time, and "is this node a child" is not a
|
|
46
|
+
* value a time can produce. Collapsed-but-present is the same picture reached
|
|
47
|
+
* by a route that *is* a function of `t`.
|
|
81
48
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
49
|
+
readonly reveal: import("@motionscript/sdk").Type<number[] | Readonly<Record<number, number>>, number[], false>;
|
|
50
|
+
readonly cornerRadius: import("@motionscript/sdk").Attribute<_RectCornerRadius, _CornerRadiusResolved>;
|
|
51
|
+
readonly cornerStyle: import("@motionscript/sdk").Attribute<_RectCornerStyle, _CornerStyleResolved>;
|
|
52
|
+
readonly flow: import("@motionscript/sdk").Type<_FlowMode, _FlowResolved, false>;
|
|
53
|
+
readonly gap: import("@motionscript/sdk").Type<_GapSize, _GapSize, false>;
|
|
54
|
+
readonly wrap: boolean;
|
|
55
|
+
readonly crossGap: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
56
|
+
readonly columns: import("@motionscript/sdk").Type<number, number, false>;
|
|
57
|
+
readonly align: import("@motionscript/sdk").Attribute<_Alignment, _Vector2>;
|
|
58
|
+
readonly fill: import("@motionscript/sdk").Attribute<Fill, _FillResolved[]>;
|
|
59
|
+
readonly stroke: import("@motionscript/sdk").Attribute<_Stroke, _StrokeResolved[]>;
|
|
60
|
+
readonly shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
|
|
61
|
+
readonly overlay: import("@motionscript/sdk").Attribute<Fill, _FillResolved[]>;
|
|
62
|
+
readonly start: import("@motionscript/sdk").Type<number, number, false>;
|
|
63
|
+
readonly end: import("@motionscript/sdk").Type<number, number, false>;
|
|
64
|
+
}>, {
|
|
65
|
+
readonly showSeries: {
|
|
66
|
+
readonly index: import("@motionscript/sdk").Type<number, number, false>;
|
|
67
|
+
};
|
|
68
|
+
readonly hideSeries: {
|
|
69
|
+
readonly index: import("@motionscript/sdk").Type<number, number, false>;
|
|
70
|
+
};
|
|
71
|
+
readonly spotlightSeries: {
|
|
72
|
+
readonly index: import("@motionscript/sdk").Type<number, number, false>;
|
|
73
|
+
};
|
|
74
|
+
readonly fillTo: readonly ["fill"];
|
|
75
|
+
readonly strokeTo: readonly ["stroke"];
|
|
76
|
+
readonly shadowTo: readonly ["shadow"];
|
|
77
|
+
readonly overlayTo: readonly ["overlay"];
|
|
78
|
+
readonly progressTo: readonly ["start", "end"];
|
|
79
|
+
readonly flash: {
|
|
80
|
+
readonly portion: import("@motionscript/sdk").Type<number, number, false>;
|
|
81
|
+
};
|
|
82
|
+
}, null, _Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
83
|
+
readonly series: import("@motionscript/sdk").Type<ChartSeries[], ChartSeries[], false>;
|
|
84
|
+
readonly swatches: import("@motionscript/sdk").Type<Fill[], Fill[], false>;
|
|
85
|
+
readonly legend: import("@motionscript/sdk").Type<LegendConfig, LegendConfig, false>;
|
|
87
86
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* A reveal tween rather than an animated `addChildAt`. The entry never left —
|
|
92
|
-
* see {@link reveal} — so there is no add to have happened, and the whole
|
|
93
|
-
* thing is a function of `t`.
|
|
94
|
-
*/
|
|
95
|
-
showSeries(args: CommandArgs<{
|
|
96
|
-
index: number;
|
|
97
|
-
}>): Seekable;
|
|
98
|
-
/**
|
|
99
|
-
* Shrink series `index`'s entry away, the gap closing behind it — the mirror
|
|
100
|
-
* of {@link showSeries}.
|
|
101
|
-
*/
|
|
102
|
-
hideSeries(args: CommandArgs<{
|
|
103
|
-
index: number;
|
|
104
|
-
}>): Seekable;
|
|
105
|
-
/**
|
|
106
|
-
* Ramp one entry's reveal to `target`.
|
|
87
|
+
* How far each entry is shown, `0`–`1`. Drives its width, opacity and gap
|
|
88
|
+
* together, so `0` is an entry that takes no room and `1` is one at its
|
|
89
|
+
* natural size.
|
|
107
90
|
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
91
|
+
* This replaces adding and removing the entry from the row: a command is
|
|
92
|
+
* asked what it looks like at a time, and "is this node a child" is not a
|
|
93
|
+
* value a time can produce. Collapsed-but-present is the same picture reached
|
|
94
|
+
* by a route that *is* a function of `t`.
|
|
112
95
|
*/
|
|
113
|
-
|
|
96
|
+
readonly reveal: import("@motionscript/sdk").Type<number[] | Readonly<Record<number, number>>, number[], false>;
|
|
97
|
+
readonly cornerRadius: import("@motionscript/sdk").Attribute<_RectCornerRadius, _CornerRadiusResolved>;
|
|
98
|
+
readonly cornerStyle: import("@motionscript/sdk").Attribute<_RectCornerStyle, _CornerStyleResolved>;
|
|
99
|
+
readonly flow: import("@motionscript/sdk").Type<_FlowMode, _FlowResolved, false>;
|
|
100
|
+
readonly gap: import("@motionscript/sdk").Type<_GapSize, _GapSize, false>;
|
|
101
|
+
readonly wrap: boolean;
|
|
102
|
+
readonly crossGap: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
103
|
+
readonly columns: import("@motionscript/sdk").Type<number, number, false>;
|
|
104
|
+
readonly align: import("@motionscript/sdk").Attribute<_Alignment, _Vector2>;
|
|
105
|
+
readonly fill: import("@motionscript/sdk").Attribute<Fill, _FillResolved[]>;
|
|
106
|
+
readonly stroke: import("@motionscript/sdk").Attribute<_Stroke, _StrokeResolved[]>;
|
|
107
|
+
readonly shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
|
|
108
|
+
readonly overlay: import("@motionscript/sdk").Attribute<Fill, _FillResolved[]>;
|
|
109
|
+
readonly start: import("@motionscript/sdk").Type<number, number, false>;
|
|
110
|
+
readonly end: import("@motionscript/sdk").Type<number, number, false>;
|
|
111
|
+
}>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
112
|
+
readonly series: import("@motionscript/sdk").Type<ChartSeries[], ChartSeries[], false>;
|
|
113
|
+
readonly swatches: import("@motionscript/sdk").Type<Fill[], Fill[], false>;
|
|
114
|
+
readonly legend: import("@motionscript/sdk").Type<LegendConfig, LegendConfig, false>;
|
|
114
115
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
116
|
+
* How far each entry is shown, `0`–`1`. Drives its width, opacity and gap
|
|
117
|
+
* together, so `0` is an entry that takes no room and `1` is one at its
|
|
118
|
+
* natural size.
|
|
118
119
|
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
120
|
+
* This replaces adding and removing the entry from the row: a command is
|
|
121
|
+
* asked what it looks like at a time, and "is this node a child" is not a
|
|
122
|
+
* value a time can produce. Collapsed-but-present is the same picture reached
|
|
123
|
+
* by a route that *is* a function of `t`.
|
|
121
124
|
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
readonly reveal: import("@motionscript/sdk").Type<number[] | Readonly<Record<number, number>>, number[], false>;
|
|
126
|
+
readonly cornerRadius: import("@motionscript/sdk").Attribute<_RectCornerRadius, _CornerRadiusResolved>;
|
|
127
|
+
readonly cornerStyle: import("@motionscript/sdk").Attribute<_RectCornerStyle, _CornerStyleResolved>;
|
|
128
|
+
readonly flow: import("@motionscript/sdk").Type<_FlowMode, _FlowResolved, false>;
|
|
129
|
+
readonly gap: import("@motionscript/sdk").Type<_GapSize, _GapSize, false>;
|
|
130
|
+
readonly wrap: boolean;
|
|
131
|
+
readonly crossGap: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
132
|
+
readonly columns: import("@motionscript/sdk").Type<number, number, false>;
|
|
133
|
+
readonly align: import("@motionscript/sdk").Attribute<_Alignment, _Vector2>;
|
|
134
|
+
readonly fill: import("@motionscript/sdk").Attribute<Fill, _FillResolved[]>;
|
|
135
|
+
readonly stroke: import("@motionscript/sdk").Attribute<_Stroke, _StrokeResolved[]>;
|
|
136
|
+
readonly shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
|
|
137
|
+
readonly overlay: import("@motionscript/sdk").Attribute<Fill, _FillResolved[]>;
|
|
138
|
+
readonly start: import("@motionscript/sdk").Type<number, number, false>;
|
|
139
|
+
readonly end: import("@motionscript/sdk").Type<number, number, false>;
|
|
140
|
+
}>, {
|
|
141
|
+
readonly showSeries: {
|
|
142
|
+
readonly index: import("@motionscript/sdk").Type<number, number, false>;
|
|
143
|
+
};
|
|
144
|
+
readonly hideSeries: {
|
|
145
|
+
readonly index: import("@motionscript/sdk").Type<number, number, false>;
|
|
146
|
+
};
|
|
147
|
+
readonly spotlightSeries: {
|
|
148
|
+
readonly index: import("@motionscript/sdk").Type<number, number, false>;
|
|
149
|
+
};
|
|
150
|
+
readonly fillTo: readonly ["fill"];
|
|
151
|
+
readonly strokeTo: readonly ["stroke"];
|
|
152
|
+
readonly shadowTo: readonly ["shadow"];
|
|
153
|
+
readonly overlayTo: readonly ["overlay"];
|
|
154
|
+
readonly progressTo: readonly ["start", "end"];
|
|
155
|
+
readonly flash: {
|
|
156
|
+
readonly portion: import("@motionscript/sdk").Type<number, number, false>;
|
|
157
|
+
};
|
|
158
|
+
}, _Node2D<_Node2DProps>>>>;
|
|
159
|
+
/** Whether series `index` is showing at all on `legend`. */
|
|
160
|
+
export declare function legendShows(legend: {
|
|
161
|
+
readonly reveal: readonly number[];
|
|
162
|
+
}, index: number): boolean;
|
|
163
|
+
export type ChartLegend = NodeOf<typeof ChartLegend>;
|
|
126
164
|
//# sourceMappingURL=chart-legend.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-legend.d.ts","sourceRoot":"","sources":["../../src/kit/chart-legend.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"chart-legend.d.ts","sourceRoot":"","sources":["../../src/kit/chart-legend.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,IAAI,EACT,KAAK,MAAM,EACX,KAAK,SAAS,EAEd,KAAK,SAAS,IAAI,UAAU,EAC5B,KAAK,oBAAoB,IAAI,qBAAqB,EAClD,KAAK,mBAAmB,IAAI,oBAAoB,EAChD,KAAK,YAAY,IAAI,aAAa,EAClC,KAAK,QAAQ,IAAI,SAAS,EAC1B,KAAK,YAAY,IAAI,aAAa,EAClC,KAAK,OAAO,IAAI,QAAQ,EACxB,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,IAAI,YAAY,EAChC,KAAK,gBAAgB,IAAI,iBAAiB,EAC1C,KAAK,eAAe,IAAI,gBAAgB,EACxC,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,cAAc,IAAI,eAAe,EACtC,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,cAAc,IAAI,eAAe,EACtC,KAAK,OAAO,IAAI,QAAQ,EACzB,MAAM,mBAAmB,CAAA;AAI1B,OAAO,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