@motionscript/charts 0.1.0-alpha.6 → 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 +18 -0
- package/dist/bar-chart/bar-chart.d.ts +45 -1
- package/dist/bar-chart/bar-chart.d.ts.map +1 -1
- package/dist/bar-chart/category-axis.d.ts +12 -1
- package/dist/bar-chart/category-axis.d.ts.map +1 -1
- package/dist/bar-chart/chart-bars.d.ts +15 -1
- package/dist/bar-chart/chart-bars.d.ts.map +1 -1
- package/dist/browser/index.js.map +2 -2
- package/dist/browser/manifest.json +1 -1
- package/dist/kit/chart-border.d.ts +3 -1
- package/dist/kit/chart-border.d.ts.map +1 -1
- package/dist/kit/chart-canvas.d.ts +10 -1
- package/dist/kit/chart-canvas.d.ts.map +1 -1
- package/dist/kit/chart-legend.d.ts +48 -1
- package/dist/kit/chart-legend.d.ts.map +1 -1
- package/dist/kit/vertical-axis.d.ts +13 -1
- package/dist/kit/vertical-axis.d.ts.map +1 -1
- package/dist/line-chart/chart-line.d.ts +46 -37
- package/dist/line-chart/chart-line.d.ts.map +1 -1
- package/dist/line-chart/chart-line.js +11 -1
- package/dist/line-chart/chart-line.js.map +1 -1
- package/dist/line-chart/chart-region.d.ts +21 -22
- package/dist/line-chart/chart-region.d.ts.map +1 -1
- package/dist/line-chart/chart-region.js +5 -1
- package/dist/line-chart/chart-region.js.map +1 -1
- package/dist/line-chart/horizontal-axis.d.ts +43 -25
- package/dist/line-chart/horizontal-axis.d.ts.map +1 -1
- package/dist/line-chart/horizontal-axis.js +10 -1
- package/dist/line-chart/horizontal-axis.js.map +1 -1
- package/dist/line-chart/line-chart.d.ts +46 -1
- package/dist/line-chart/line-chart.d.ts.map +1 -1
- package/dist/pie-chart/pie-chart.d.ts +34 -1
- package/dist/pie-chart/pie-chart.d.ts.map +1 -1
- package/dist/pie-chart/pie-legend.d.ts +31 -1
- package/dist/pie-chart/pie-legend.d.ts.map +1 -1
- package/dist/pie-chart/pie-ring.d.ts +19 -1
- package/dist/pie-chart/pie-ring.d.ts.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/line-chart/chart-line.ts +11 -36
- package/src/line-chart/chart-region.ts +5 -21
- package/src/line-chart/horizontal-axis.ts +10 -25
- package/src/pie-chart/shared.ts +2 -2
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
type NodeOf,
|
|
10
10
|
// Named so this component's emitted type reaches `Node2D` through the sdk, not core.
|
|
11
11
|
type Node2D as _Node2D,
|
|
12
|
-
type Node2DProps,
|
|
13
12
|
type Stroke,
|
|
14
13
|
type StrokeResolved,
|
|
15
14
|
} from "@motionscript/sdk"
|
|
@@ -23,29 +22,10 @@ import {
|
|
|
23
22
|
type RegionBox,
|
|
24
23
|
} from "./shared"
|
|
25
24
|
|
|
26
|
-
export interface ChartRegionProps extends Node2DProps {
|
|
27
|
-
/**
|
|
28
|
-
* The highlighted slice, already resolved into this node's local pixel space
|
|
29
|
-
* (origin at centre, y-up) by the parent {@link LineChart}. A degenerate box
|
|
30
|
-
* draws nothing.
|
|
31
|
-
*/
|
|
32
|
-
box: RegionBox
|
|
33
|
-
/** Dashed rule marking each *bounded* edge of the box. */
|
|
34
|
-
stroke: Stroke
|
|
35
|
-
/** Wash filling the box, under the series lines. */
|
|
36
|
-
fill: Fill
|
|
37
|
-
/**
|
|
38
|
-
* Reveal of the annotation in `[0, 1]`: 0 hides it, 1 draws it fully. Driven
|
|
39
|
-
* by the chart's own `regionReveal`, so the rules and the series' dimming move
|
|
40
|
-
* as one.
|
|
41
|
-
*/
|
|
42
|
-
reveal: number
|
|
43
|
-
}
|
|
44
|
-
|
|
45
25
|
/**
|
|
46
26
|
* The **region call-out** of a {@link LineChart}: a washed rectangle over the
|
|
47
27
|
* plot with a dashed rule down each edge the author actually bounded. Sized and
|
|
48
|
-
* positioned entirely from the pre-mapped
|
|
28
|
+
* positioned entirely from the pre-mapped `box` rather
|
|
49
29
|
* than its own box — the region already carries the plot geometry.
|
|
50
30
|
*
|
|
51
31
|
* It draws only the *marking*; fading the series outside the region is
|
|
@@ -59,9 +39,13 @@ export interface ChartRegionProps extends Node2DProps {
|
|
|
59
39
|
export const ChartRegion = component2d({
|
|
60
40
|
key: "chartRegion",
|
|
61
41
|
state: {
|
|
42
|
+
/** The highlighted slice, already resolved into this node's local pixel space (origin at centre, y-up) by the parent {@link LineChart}. A degenerate box draws nothing. */
|
|
62
43
|
box: fresh<RegionBox>(() => EMPTY_REGION_BOX),
|
|
44
|
+
/** Dashed rule marking each *bounded* edge of the box. */
|
|
63
45
|
stroke: Types.custom<Stroke, StrokeResolved[]>(DEFAULT_CHART_THEME.region.stroke, { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),
|
|
46
|
+
/** Wash filling the box, under the series lines. */
|
|
64
47
|
fill: Types.custom<Fill, FillResolved[]>(DEFAULT_CHART_THEME.region.fill, { resolve: fillOps.resolve, lerp: fillOps.lerp }),
|
|
48
|
+
/** Reveal of the annotation in `[0, 1]`, driven by the chart's own `regionReveal` so the rules and the series' dimming move as one. */
|
|
65
49
|
reveal: 0,
|
|
66
50
|
},
|
|
67
51
|
load: (loader, state) => loadPaints(loader, { fills: [state.fill], strokes: [state.stroke] }),
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
textOps,
|
|
8
8
|
type NodeOf,
|
|
9
9
|
type Node2D,
|
|
10
|
-
type Node2DProps,
|
|
11
10
|
} from "@motionscript/sdk";
|
|
12
11
|
|
|
13
12
|
import { asParts, fresh } from "../kit/entries";
|
|
@@ -20,32 +19,9 @@ import {
|
|
|
20
19
|
} from "../kit/shared";
|
|
21
20
|
import { markerCaption } from "../kit/vertical-axis";
|
|
22
21
|
|
|
23
|
-
export interface HorizontalAxisProps extends Node2DProps {
|
|
24
|
-
/** `[min, max]` of the horizontal scale the markers are positioned within. */
|
|
25
|
-
range: Range;
|
|
26
|
-
/** Tick values (in data units) to draw along the axis. */
|
|
27
|
-
markers: number[];
|
|
28
|
-
/**
|
|
29
|
-
* How each marker is captioned, one per entry of `markers` and in its order.
|
|
30
|
-
* Empty (the default), or short, captions a marker with its bare numeric
|
|
31
|
-
* reading; a chart whose x column names months or categories writes those.
|
|
32
|
-
*/
|
|
33
|
-
captions: string[];
|
|
34
|
-
/** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */
|
|
35
|
-
axis: AxisConfig;
|
|
36
|
-
/**
|
|
37
|
-
* Caption drawn centred in the gutter beneath the marker row. Empty string
|
|
38
|
-
* (the default) hides it.
|
|
39
|
-
*/
|
|
40
|
-
label: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
22
|
/** How far a marker starts above its slot when it enters, in px. */
|
|
44
23
|
const SLIDE = 24;
|
|
45
24
|
|
|
46
|
-
/** How a tick value is captioned — see {@link HorizontalAxisProps.captions}. */
|
|
47
|
-
export type MarkerLabel = (value: number) => string;
|
|
48
|
-
|
|
49
25
|
/**
|
|
50
26
|
* The horizontal axis of a {@link LineChart}: a **row of {@link Text} nodes**,
|
|
51
27
|
* one per marker value, running left-to-right. Pure layout — the mirror of the
|
|
@@ -56,7 +32,7 @@ export type MarkerLabel = (value: number) => string;
|
|
|
56
32
|
* `2026-03` sits three months along, not three slots along. That is what keeps
|
|
57
33
|
* it distinct from a bar chart's bottom axis, which centres a caption on each
|
|
58
34
|
* slot and has no scale at all — the two only look alike. What the values are
|
|
59
|
-
* captioned *as* is the chart's to decide
|
|
35
|
+
* captioned *as* is the chart's to decide, in `captions`.
|
|
60
36
|
*
|
|
61
37
|
* `enter` staggers the markers in **left-to-right**: each starts lifted a
|
|
62
38
|
* little above its slot and transparent, then fades and slides down into place.
|
|
@@ -64,10 +40,19 @@ export type MarkerLabel = (value: number) => string;
|
|
|
64
40
|
export const HorizontalAxis = component2d({
|
|
65
41
|
key: "horizontalAxis",
|
|
66
42
|
state: {
|
|
43
|
+
/** `[min, max]` of the horizontal scale the markers are positioned within. */
|
|
67
44
|
range: fresh<Range>(() => [0, 1]),
|
|
45
|
+
/** Tick values (in data units) to draw along the axis. */
|
|
68
46
|
markers: fresh<number[]>(() => []),
|
|
47
|
+
/**
|
|
48
|
+
* How each marker is captioned, one per entry of `markers` and in its order.
|
|
49
|
+
* Empty (the default), or short, captions a marker with its bare numeric
|
|
50
|
+
* reading; a chart whose x column names months or categories writes those.
|
|
51
|
+
*/
|
|
69
52
|
captions: fresh<string[]>(() => []),
|
|
53
|
+
/** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */
|
|
70
54
|
axis: Types.custom<AxisConfig>(DEFAULT_X_AXIS),
|
|
55
|
+
/** Caption drawn centred in the gutter beneath the marker row; empty (the default) hides it. */
|
|
71
56
|
label: "",
|
|
72
57
|
arrivals: arrivalsEntry(),
|
|
73
58
|
},
|
package/src/pie-chart/shared.ts
CHANGED
|
@@ -442,7 +442,7 @@ function lerpCenterConfig(
|
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
/**
|
|
445
|
-
* {@link PieChart}'s `theme`
|
|
445
|
+
* {@link PieChart}'s `theme` property mapper: merges the author's partial
|
|
446
446
|
* {@link PieChartTheme} onto `previous` (falling back to
|
|
447
447
|
* {@link DEFAULT_PIE_CHART_THEME} on first resolution), fully resolving every
|
|
448
448
|
* leaf so the tween below always has resolved data to interpolate.
|
|
@@ -464,7 +464,7 @@ export function resolvePieChartTheme(
|
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
466
|
|
|
467
|
-
/** {@link PieChart}'s `theme`
|
|
467
|
+
/** {@link PieChart}'s `theme` property tween — leaf by leaf. */
|
|
468
468
|
export function lerpPieChartTheme(
|
|
469
469
|
from: PieChartConfig,
|
|
470
470
|
to: PieChartConfig,
|