@motionscript/charts 0.1.0-alpha.7 → 0.1.0-alpha.9
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 +4 -0
- package/LICENSE +201 -201
- package/NOTICE +49 -48
- package/README.md +99 -99
- package/dist/bar-chart/bar-chart.d.ts +2 -2
- package/dist/bar-chart/bar-chart.d.ts.map +1 -1
- package/dist/bar-chart/bar-chart.js +13 -5
- package/dist/bar-chart/bar-chart.js.map +1 -1
- package/dist/bar-chart/category-axis.js.map +1 -1
- package/dist/bar-chart/chart-bars.d.ts.map +1 -1
- package/dist/bar-chart/chart-bars.js +6 -7
- package/dist/bar-chart/chart-bars.js.map +1 -1
- package/dist/bar-chart/index.js.map +1 -1
- package/dist/bar-chart/shared.js.map +1 -1
- package/dist/browser/chunks/{chunk-XROBIRQK.js → chunk-TJNHLQGV.js} +1 -1
- 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 +1 -1
- package/dist/engine.d.ts +1 -1
- package/dist/engine.js +1 -1
- package/dist/engine.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/kit/cartesian.js.map +1 -1
- package/dist/kit/chart-border.js.map +1 -1
- package/dist/kit/chart-canvas.js.map +1 -1
- package/dist/kit/chart-legend.js.map +1 -1
- package/dist/kit/entries.js.map +1 -1
- package/dist/kit/motion.js.map +1 -1
- package/dist/kit/paints.js.map +1 -1
- package/dist/kit/shared.js.map +1 -1
- package/dist/kit/vertical-axis.js.map +1 -1
- package/dist/line-chart/chart-line.js.map +1 -1
- package/dist/line-chart/chart-region.js.map +1 -1
- package/dist/line-chart/horizontal-axis.js.map +1 -1
- package/dist/line-chart/index.d.ts +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 +2 -2
- package/dist/line-chart/line-chart.d.ts.map +1 -1
- package/dist/line-chart/line-chart.js +16 -7
- package/dist/line-chart/line-chart.js.map +1 -1
- package/dist/line-chart/shared.js.map +1 -1
- package/dist/line-chart/x-scale.d.ts +3 -10
- package/dist/line-chart/x-scale.d.ts.map +1 -1
- package/dist/line-chart/x-scale.js +15 -4
- package/dist/line-chart/x-scale.js.map +1 -1
- package/dist/nodes.js.map +1 -1
- package/dist/pie-chart/index.js.map +1 -1
- package/dist/pie-chart/pie-chart.d.ts +2 -2
- package/dist/pie-chart/pie-chart.d.ts.map +1 -1
- package/dist/pie-chart/pie-chart.js +4 -1
- package/dist/pie-chart/pie-chart.js.map +1 -1
- package/dist/pie-chart/pie-legend.js.map +1 -1
- package/dist/pie-chart/pie-ring.js.map +1 -1
- package/dist/pie-chart/shared.d.ts +6 -0
- package/dist/pie-chart/shared.d.ts.map +1 -1
- package/dist/pie-chart/shared.js +8 -2
- package/dist/pie-chart/shared.js.map +1 -1
- package/package.json +5 -4
- package/registry.json +23 -23
- package/src/bar-chart/bar-chart.ts +542 -534
- package/src/bar-chart/category-axis.ts +162 -162
- package/src/bar-chart/chart-bars.ts +287 -288
- package/src/bar-chart/index.ts +31 -31
- package/src/bar-chart/shared.ts +354 -354
- package/src/engine.ts +28 -28
- package/src/index.ts +5 -5
- package/src/kit/cartesian.ts +81 -81
- package/src/kit/chart-border.ts +50 -50
- package/src/kit/chart-canvas.ts +122 -122
- package/src/kit/chart-legend.ts +229 -229
- package/src/kit/entries.ts +20 -20
- package/src/kit/motion.ts +90 -90
- package/src/kit/paints.ts +15 -15
- package/src/kit/shared.ts +782 -782
- package/src/kit/vertical-axis.ts +194 -194
- package/src/line-chart/chart-line.ts +156 -156
- package/src/line-chart/chart-region.ts +90 -90
- package/src/line-chart/horizontal-axis.ts +151 -151
- package/src/line-chart/index.ts +39 -39
- package/src/line-chart/line-chart.ts +598 -585
- package/src/line-chart/shared.ts +473 -473
- package/src/line-chart/x-scale.ts +382 -367
- package/src/nodes.ts +18 -18
- package/src/pie-chart/index.ts +37 -37
- package/src/pie-chart/pie-chart.ts +296 -293
- package/src/pie-chart/pie-legend.ts +169 -169
- package/src/pie-chart/pie-ring.ts +848 -848
- package/src/pie-chart/shared.ts +496 -490
- package/dist/browser/chunks/chunk-XROBIRQK.js.map +0 -7
package/README.md
CHANGED
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
# @motionscript/charts
|
|
2
|
-
|
|
3
|
-
Animated data charts for [Motion Script](https://motionscript.dev): a line chart,
|
|
4
|
-
a bar chart and a pie chart, built from one shared kit (plot panel, value axis,
|
|
5
|
-
legend, number formatting, theme resolution). Written against
|
|
6
|
-
[`@motionscript/sdk`](https://github.com/motionscript-dev/motionscript/tree/main/packages/sdk), which it takes as a peer dependency.
|
|
7
|
-
|
|
8
|
-
```ts
|
|
9
|
-
import { NODES } from '@motionscript/charts';
|
|
10
|
-
|
|
11
|
-
export const nodes = NODES; // [LineChart, BarChart, PieChart]
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Importing registers nothing; the host hands `NODES` to the engine (see
|
|
15
|
-
[`packages/components/CLAUDE.md`](https://github.com/motionscript-dev/motionscript/blob/main/packages/components/CLAUDE.md) for the registration and import rules every kit shares).
|
|
16
|
-
|
|
17
|
-
## Install
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install @motionscript/charts @motionscript/sdk
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Exports
|
|
24
|
-
|
|
25
|
-
| Path | Source | What |
|
|
26
|
-
|---|---|---|
|
|
27
|
-
| `@motionscript/charts` | `src/index.ts` | the three chart barrels, `src/engine.ts` and `NODES` |
|
|
28
|
-
| `@motionscript/charts/kit` | `src/engine.ts` | the shared kit (`src/kit/*`) and all of `@motionscript/sdk/component` |
|
|
29
|
-
|
|
30
|
-
Each chart folder (`line-chart/`, `bar-chart/`, `pie-chart/`) has an `index.ts`
|
|
31
|
-
barrel with the node, its parts, its theme (`DEFAULT_*_THEME`, `resolve*Theme`,
|
|
32
|
-
`lerp*Theme`) and its pure helpers (`resolveXScale`, `barSpans`, `pieArcs`, ...).
|
|
33
|
-
The charts and their parts (`ChartLine`, `ChartBars`, `PieRing`, `VerticalAxis`, ...)
|
|
34
|
-
are components (`component2d`); only the charts are registered node types, so a
|
|
35
|
-
document cannot name a part. A chart tells a host its key, entries and commands;
|
|
36
|
-
where it is shelved and the box it is seeded at are the host's to keep. `lineChartDomains` and `barChartDomain` give the axes as drawn, and
|
|
37
|
-
`isSliceSelected` whether a pie slice is out.
|
|
38
|
-
|
|
39
|
-
## Nodes
|
|
40
|
-
|
|
41
|
-
| Key | Made for (w x h) | Data props | Commands |
|
|
42
|
-
|---|---|---|---|
|
|
43
|
-
| `lineChart` | 760 x 460 | `data`, `xField`, `series`, `xAxis`, `yAxis`, `region` | `enter`, `spotlightRegion`, `clearRegion`, `zoomTo`, `resetZoom`, `showSeries`/`hideSeries`/`spotlightSeries` |
|
|
44
|
-
| `barChart` | 760 x 460 | `data`, `categoryField`, `series`, `valueAxis`, `stacked` | `enter`, `showSeries`/`hideSeries`/`spotlightSeries`, `spotlightCategory`, `clearCategory` |
|
|
45
|
-
| `pieChart` | 680 x 480 | `data`, `categoryField`, `valueField` | `enter`, `revealCenter`, `selectSlice`/`deselectSlice`/`selectOnlySlice`/`clearSelection` |
|
|
46
|
-
|
|
47
|
-
Every command takes the duration its row (or call) gives, and eases out unless
|
|
48
|
-
given an easing. Arguments: `seriesIndex`, `sliceIndex`, `categoryIndex` (each 0
|
|
49
|
-
when left out), and for `spotlightRegion` and `zoomTo` a `region` of
|
|
50
|
-
`{ x?: [min, max], y?: [min, max] }`.
|
|
51
|
-
|
|
52
|
-
## Rules worth knowing
|
|
53
|
-
|
|
54
|
-
- **The kit stays an import.**
|
|
55
|
-
rewrites its kit imports to `@motionscript/charts` (`registry.json`): a second
|
|
56
|
-
copy of `VerticalAxis` would render as nothing, with no error.
|
|
57
|
-
- **Resting state is the finished chart.** `enter` arms every part on its first
|
|
58
|
-
frame: every piece of a component command is built run to its end, and a beat
|
|
59
|
-
ahead of the playhead writes nothing, so the first frame writes what each later
|
|
60
|
-
beat moves from. `duration` is the whole entrance: a beat with nothing to do (no
|
|
61
|
-
legend, no series) holds its share.
|
|
62
|
-
- **A part's command has no duration of its own.** The charts pass every part the
|
|
63
|
-
duration and easing it moves with; called directly, a part's command takes the
|
|
64
|
-
duration it is given, and a part's own frames ease out unless given an easing.
|
|
65
|
-
- **Some props are read once, at construction**: the series list (count, labels,
|
|
66
|
-
`enabled`), `showLegend`, `showValues`, `showCenter`, axis captions, text styles and
|
|
67
|
-
paddings, the bar chart's category captions, the pie's label and legend-row counts,
|
|
68
|
-
`labelMode`, `labelPlacement`, `gap`, `centerLabel`, `centerCaption`. A `set` or `to`
|
|
69
|
-
of them changes nothing; a document edit re-instantiates the node, which does
|
|
70
|
-
refresh them. `data`, scales, ticks, theme paints, `region`, `stacked`, `weights`
|
|
71
|
-
and `pops` are live.
|
|
72
|
-
- **Non-finite cells plot as 0.** `num()` returns a cell only when it is a finite
|
|
73
|
-
number, so a numeric string, `NaN`, `Infinity` and a missing cell all read 0.
|
|
74
|
-
- **x units on the line chart.** `xAxis.range`, `xAxis.ticks` and a region's `x`
|
|
75
|
-
are in the x scale's own units: the number (numeric column), UTC epoch
|
|
76
|
-
milliseconds (time column) or the row index (ordinal column), chosen from the
|
|
77
|
-
column by `resolveXScale` (dates via `parseInstant`).
|
|
78
|
-
- **`zoomTo` remembers the resting domain once** (`home`, a private entry its
|
|
79
|
-
frames write) and `resetZoom`'s frames clear it, so the pair is order dependent
|
|
80
|
-
and a seek back before a zoom forgets it again: a `resetZoom` with no earlier
|
|
81
|
-
`zoomTo`, and a `zoomTo` naming neither axis, write nothing for their duration.
|
|
82
|
-
A zoom keeps the tick count so each marker slides.
|
|
83
|
-
- **A `to` of an axis `range` or `ticks` tweens from the domain as drawn**
|
|
84
|
-
(`lerpAxisEntry`): an auto side is held mid-move as an `AxisDomainBlend`, which
|
|
85
|
-
the chart settles against its data, so a rescale from an auto axis is continuous.
|
|
86
|
-
A restated range without ticks spreads explicit ticks across it; one side of an
|
|
87
|
-
auto axis restated alone leaves the other to the data.
|
|
88
|
-
- **Pie angles** are radians clockwise from 12 o'clock; `startAngle` is degrees.
|
|
89
|
-
|
|
90
|
-
## Development
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
pnpm --filter @motionscript/charts build
|
|
94
|
-
pnpm --filter @motionscript/charts test
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Tests sit beside the code (`*.test.ts`); `src/document.test.ts` runs the commands
|
|
98
|
-
through a compiled document, and `src/tests/harness.ts` supplies the attach, measure
|
|
99
|
-
and record helpers.
|
|
1
|
+
# @motionscript/charts
|
|
2
|
+
|
|
3
|
+
Animated data charts for [Motion Script](https://motionscript.dev): a line chart,
|
|
4
|
+
a bar chart and a pie chart, built from one shared kit (plot panel, value axis,
|
|
5
|
+
legend, number formatting, theme resolution). Written against
|
|
6
|
+
[`@motionscript/sdk`](https://github.com/motionscript-dev/motionscript/tree/main/packages/sdk), which it takes as a peer dependency.
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import { NODES } from '@motionscript/charts';
|
|
10
|
+
|
|
11
|
+
export const nodes = NODES; // [LineChart, BarChart, PieChart]
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Importing registers nothing; the host hands `NODES` to the engine (see
|
|
15
|
+
[`packages/components/CLAUDE.md`](https://github.com/motionscript-dev/motionscript/blob/main/packages/components/CLAUDE.md) for the registration and import rules every kit shares).
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @motionscript/charts @motionscript/sdk
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Exports
|
|
24
|
+
|
|
25
|
+
| Path | Source | What |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| `@motionscript/charts` | `src/index.ts` | the three chart barrels, `src/engine.ts` and `NODES` |
|
|
28
|
+
| `@motionscript/charts/kit` | `src/engine.ts` | the shared kit (`src/kit/*`) and all of `@motionscript/sdk/component` |
|
|
29
|
+
|
|
30
|
+
Each chart folder (`line-chart/`, `bar-chart/`, `pie-chart/`) has an `index.ts`
|
|
31
|
+
barrel with the node, its parts, its theme (`DEFAULT_*_THEME`, `resolve*Theme`,
|
|
32
|
+
`lerp*Theme`) and its pure helpers (`resolveXScale`, `barSpans`, `pieArcs`, ...).
|
|
33
|
+
The charts and their parts (`ChartLine`, `ChartBars`, `PieRing`, `VerticalAxis`, ...)
|
|
34
|
+
are components (`component2d`); only the charts are registered node types, so a
|
|
35
|
+
document cannot name a part. A chart tells a host its key, entries and commands;
|
|
36
|
+
where it is shelved and the box it is seeded at are the host's to keep. `lineChartDomains` and `barChartDomain` give the axes as drawn, and
|
|
37
|
+
`isSliceSelected` whether a pie slice is out.
|
|
38
|
+
|
|
39
|
+
## Nodes
|
|
40
|
+
|
|
41
|
+
| Key | Made for (w x h) | Data props | Commands |
|
|
42
|
+
|---|---|---|---|
|
|
43
|
+
| `lineChart` | 760 x 460 | `data`, `xField`, `series`, `xAxis`, `yAxis`, `region` | `enter`, `spotlightRegion`, `clearRegion`, `zoomTo`, `resetZoom`, `showSeries`/`hideSeries`/`spotlightSeries` |
|
|
44
|
+
| `barChart` | 760 x 460 | `data`, `categoryField`, `series`, `valueAxis`, `stacked` | `enter`, `showSeries`/`hideSeries`/`spotlightSeries`, `spotlightCategory`, `clearCategory` |
|
|
45
|
+
| `pieChart` | 680 x 480 | `data`, `categoryField`, `valueField` | `enter`, `revealCenter`, `selectSlice`/`deselectSlice`/`selectOnlySlice`/`clearSelection` |
|
|
46
|
+
|
|
47
|
+
Every command takes the duration its row (or call) gives, and eases out unless
|
|
48
|
+
given an easing. Arguments: `seriesIndex`, `sliceIndex`, `categoryIndex` (each 0
|
|
49
|
+
when left out), and for `spotlightRegion` and `zoomTo` a `region` of
|
|
50
|
+
`{ x?: [min, max], y?: [min, max] }`.
|
|
51
|
+
|
|
52
|
+
## Rules worth knowing
|
|
53
|
+
|
|
54
|
+
- **The kit stays an import.** A copy of `line-chart` takes only `line-chart/*` and
|
|
55
|
+
rewrites its kit imports to `@motionscript/charts` (`registry.json`): a second
|
|
56
|
+
copy of `VerticalAxis` would render as nothing, with no error.
|
|
57
|
+
- **Resting state is the finished chart.** `enter` arms every part on its first
|
|
58
|
+
frame: every piece of a component command is built run to its end, and a beat
|
|
59
|
+
ahead of the playhead writes nothing, so the first frame writes what each later
|
|
60
|
+
beat moves from. `duration` is the whole entrance: a beat with nothing to do (no
|
|
61
|
+
legend, no series) holds its share.
|
|
62
|
+
- **A part's command has no duration of its own.** The charts pass every part the
|
|
63
|
+
duration and easing it moves with; called directly, a part's command takes the
|
|
64
|
+
duration it is given, and a part's own frames ease out unless given an easing.
|
|
65
|
+
- **Some props are read once, at construction**: the series list (count, labels,
|
|
66
|
+
`enabled`), `showLegend`, `showValues`, `showCenter`, axis captions, text styles and
|
|
67
|
+
paddings, the bar chart's category captions, the pie's label and legend-row counts,
|
|
68
|
+
`labelMode`, `labelPlacement`, `gap`, `centerLabel`, `centerCaption`. A `set` or `to`
|
|
69
|
+
of them changes nothing; a document edit re-instantiates the node, which does
|
|
70
|
+
refresh them. `data`, scales, ticks, theme paints, `region`, `stacked`, `weights`
|
|
71
|
+
and `pops` are live.
|
|
72
|
+
- **Non-finite cells plot as 0.** `num()` returns a cell only when it is a finite
|
|
73
|
+
number, so a numeric string, `NaN`, `Infinity` and a missing cell all read 0.
|
|
74
|
+
- **x units on the line chart.** `xAxis.range`, `xAxis.ticks` and a region's `x`
|
|
75
|
+
are in the x scale's own units: the number (numeric column), UTC epoch
|
|
76
|
+
milliseconds (time column) or the row index (ordinal column), chosen from the
|
|
77
|
+
column by `resolveXScale` (dates via `parseInstant`).
|
|
78
|
+
- **`zoomTo` remembers the resting domain once** (`home`, a private entry its
|
|
79
|
+
frames write) and `resetZoom`'s frames clear it, so the pair is order dependent
|
|
80
|
+
and a seek back before a zoom forgets it again: a `resetZoom` with no earlier
|
|
81
|
+
`zoomTo`, and a `zoomTo` naming neither axis, write nothing for their duration.
|
|
82
|
+
A zoom keeps the tick count so each marker slides.
|
|
83
|
+
- **A `to` of an axis `range` or `ticks` tweens from the domain as drawn**
|
|
84
|
+
(`lerpAxisEntry`): an auto side is held mid-move as an `AxisDomainBlend`, which
|
|
85
|
+
the chart settles against its data, so a rescale from an auto axis is continuous.
|
|
86
|
+
A restated range without ticks spreads explicit ticks across it; one side of an
|
|
87
|
+
auto axis restated alone leaves the other to the data.
|
|
88
|
+
- **Pie angles** are radians clockwise from 12 o'clock; `startAngle` is degrees.
|
|
89
|
+
|
|
90
|
+
## Development
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pnpm --filter @motionscript/charts build
|
|
94
|
+
pnpm --filter @motionscript/charts test
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Tests sit beside the code (`*.test.ts`); `src/document.test.ts` runs the commands
|
|
98
|
+
through a compiled document, and `src/tests/harness.ts` supplies the attach, measure
|
|
99
|
+
and record helpers.
|
|
@@ -113,7 +113,7 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
|
|
|
113
113
|
readonly categoryIndex: import("@motionscript/sdk").Type<number, number, false>;
|
|
114
114
|
};
|
|
115
115
|
readonly clearCategory: {};
|
|
116
|
-
},
|
|
116
|
+
}, readonly [], Node2D<Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
117
117
|
readonly data: import("@motionscript/sdk").Type<DataRecord[], DataRecord[], false>;
|
|
118
118
|
readonly categoryField: "";
|
|
119
119
|
readonly series: import("@motionscript/sdk").Type<import("../index.js").ChartSeries[], import("../index.js").ChartSeries[], false>;
|
|
@@ -142,7 +142,7 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
|
|
|
142
142
|
readonly showValues: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
143
143
|
/** Whether each series' columns are drawn: on for every frame a show or hide covers, off once a hide lands. */
|
|
144
144
|
readonly showing: import("@motionscript/sdk").Type<boolean[], boolean[], false>;
|
|
145
|
-
}>,
|
|
145
|
+
}>, readonly [], import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
146
146
|
readonly data: import("@motionscript/sdk").Type<DataRecord[], DataRecord[], false>;
|
|
147
147
|
readonly categoryField: "";
|
|
148
148
|
readonly series: import("@motionscript/sdk").Type<import("../index.js").ChartSeries[], import("../index.js").ChartSeries[], false>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-chart.d.ts","sourceRoot":"","sources":["../../src/bar-chart/bar-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,UAAU,EAEf,KAAK,MAAM,EAEX,KAAK,MAAM,EACX,KAAK,WAAW,EAGjB,MAAM,mBAAmB,CAAA;AAU1B,OAAO,EAUL,KAAK,gBAAgB,EACrB,KAAK,KAAK,EACX,MAAM,eAAe,CAAA;AAGtB,OAAO,EASL,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,UAAU,CAAA;AAEjB,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,oEAAoE;IACpE,IAAI,EAAE,UAAU,EAAE,CAAA;IAClB;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB,gFAAgF;IAChF,MAAM,EAAE,SAAS,EAAE,CAAA;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,yEAAyE;IACzE,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,qFAAqF;IACrF,YAAY,CAAC,EAAE,gBAAgB,CAAA;IAC/B;;;;OAIG;IACH,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,OAAO,CAAA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
32
|
return { ...domain, range, ticks: domain.ticks ?? markerValues(range, DEFAULT_MARKERS - 1) };
|
|
33
33
|
}
|
|
34
|
+
/** The last domain worked out from each data array, and what else it was read from. */
|
|
35
|
+
const domainsDrawn = new WeakMap();
|
|
34
36
|
/** The value axis as a bar chart draws it now, an auto range or tick row read back as itself. */
|
|
35
37
|
export function barChartDomain(s) {
|
|
36
|
-
|
|
38
|
+
const { data, series, stacked, valueAxis } = s;
|
|
39
|
+
const kept = domainsDrawn.get(data);
|
|
40
|
+
if (kept && kept.series === series && kept.stacked === stacked && kept.valueAxis === valueAxis)
|
|
41
|
+
return kept.domain;
|
|
42
|
+
const domain = settleAxisDomain(valueAxis, (d) => drawnValue(s, d));
|
|
43
|
+
domainsDrawn.set(data, { series, stacked, valueAxis, domain });
|
|
44
|
+
return domain;
|
|
37
45
|
}
|
|
38
46
|
/**
|
|
39
47
|
* A value written down as this chart's value axis says: the ticks and the
|
|
@@ -232,6 +240,7 @@ export const BarChart = component2d({
|
|
|
232
240
|
weights: (state) => state.series.map((s) => ((s.enabled ?? true) ? 1 : 0)),
|
|
233
241
|
showing: (state) => state.series.map((s) => s.enabled ?? true),
|
|
234
242
|
},
|
|
243
|
+
allowedChildren: [],
|
|
235
244
|
children: (state) => {
|
|
236
245
|
const theme = () => state.theme;
|
|
237
246
|
const domain = () => barChartDomain(state);
|
|
@@ -312,10 +321,7 @@ export const BarChart = component2d({
|
|
|
312
321
|
width: "hug",
|
|
313
322
|
height: 0,
|
|
314
323
|
});
|
|
315
|
-
return asParts([
|
|
316
|
-
...state.children,
|
|
317
|
-
cartesianFrame({ axis: vAxis, plot, gutter, below }),
|
|
318
|
-
]);
|
|
324
|
+
return asParts([cartesianFrame({ axis: vAxis, plot, gutter, below })]);
|
|
319
325
|
},
|
|
320
326
|
commands: {
|
|
321
327
|
/**
|
|
@@ -327,6 +333,8 @@ export const BarChart = component2d({
|
|
|
327
333
|
*/
|
|
328
334
|
enter: {
|
|
329
335
|
args: {},
|
|
336
|
+
// Held from the chart's arrival, so it never shows finished ahead of its draw.
|
|
337
|
+
entrance: true,
|
|
330
338
|
easing: easeOut(),
|
|
331
339
|
run: (timeline, _state, children) => {
|
|
332
340
|
const parts = partsOf(children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-chart.js","sourceRoot":"","sources":["../../src/bar-chart/bar-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,KAAK,EACL,WAAW,EACX,OAAO,GAUR,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE1D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAa,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,UAAU,EACV,YAAY,EACZ,GAAG,EACH,iBAAiB,EACjB,gBAAgB,GAGjB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAA;AAC1D,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,QAAQ,EACR,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,aAAa,GAId,MAAM,UAAU,CAAA;AA8CjB,4FAA4F;AAC5F,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAiF,CAAC,EA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C,QAAQ,CAAC,CAAA;gBACvD,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAA;gBAC3B,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;YAC1I,CAAC;SACF;KACF;CACF,CAAC,CAAA","sourcesContent":["import {\r\n Rect,\r\n Types,\r\n component2d,\r\n easeOut,\r\n type ChildView,\r\n type DataRecord,\r\n type EntryOptions,\r\n type NodeOf,\r\n // Named so this component's emitted type reaches `Node2D` through the sdk, not core.\r\n type Node2D,\r\n type Node2DProps,\r\n type Size2D,\r\n type Timeline,\r\n} from \"@motionscript/sdk\"\r\nimport { formatNumber } from \"@motionscript/sdk/component\"\r\n\r\nimport { cartesianFrame, cartesianViews, laidOutSize } from \"../kit/cartesian\"\r\nimport { ChartBorder } from \"../kit/chart-border\"\r\nimport { ChartCanvas } from \"../kit/chart-canvas\"\r\nimport { ChartLegend } from \"../kit/chart-legend\"\r\nimport { asParts, fresh } from \"../kit/entries\"\r\nimport { beats, type Beat } from \"../kit/motion\"\r\nimport { VerticalAxis } from \"../kit/vertical-axis\"\r\nimport {\r\n clampUnit,\r\n formatMarker,\r\n lerpAxisDomain,\r\n lerpAxisEntry,\r\n markerStep,\r\n markerValues,\r\n num,\r\n resolveAxisDomain,\r\n settleAxisDomain,\r\n type AxisDomainConfig,\r\n type Range,\r\n} from \"../kit/shared\"\r\nimport { CategoryAxis } from \"./category-axis\"\r\nimport { ChartBars, type BarGeometry } from \"./chart-bars\"\r\nimport {\r\n DEFAULT_BAR_CHART_THEME,\r\n barCategories,\r\n barSpans,\r\n lerpBarChartTheme,\r\n resolveBarChartTheme,\r\n resolveBarFill,\r\n resolveBarScale,\r\n stackCapIndex,\r\n type BarChartConfig,\r\n type BarChartTheme,\r\n type BarSeries,\r\n} from \"./shared\"\r\n\r\nexport interface BarChartProps extends Node2DProps {\r\n /** One row per category — a plain record of field name to value. */\r\n data: DataRecord[]\r\n /**\r\n * Key into each row for its category caption, drawn beneath the baseline.\r\n * Named `categoryField` rather than `category` for the same reason the line\r\n * chart's is `xField`: it names a *column*, not a value.\r\n */\r\n categoryField: string\r\n /** One entry per bar series: which column it plots, its `label`, its `fill`. */\r\n series: BarSeries[]\r\n /**\r\n * When `true` every category's series stack into one column; when `false`\r\n * (the default) each series gets its own bar, grouped side by side within the\r\n * category's slot.\r\n */\r\n stacked?: boolean\r\n /** The value axis's domain: caption, scale range, and tick placement. */\r\n valueAxis?: AxisDomainConfig\r\n /** The category axis's domain. Only its `label` is read — the slots are the rows. */\r\n categoryAxis?: AxisDomainConfig\r\n /**\r\n * The chart's visual theme — bar palette and geometry, axis furniture, plot\r\n * panel paint, legend, value figures. Every branch is optional and deep-merged\r\n * onto {@link DEFAULT_BAR_CHART_THEME}.\r\n */\r\n theme?: BarChartTheme\r\n /** Whether the legend row below the plot is drawn at all. */\r\n showLegend?: boolean\r\n /** Whether each column prints the figure it plots. */\r\n showValues?: boolean\r\n}\r\n\r\n/** What a bar chart plots, as its entries hold it. */\r\nexport interface BarChartValues {\r\n readonly data: DataRecord[]\r\n readonly series: BarSeries[]\r\n readonly stacked: boolean\r\n readonly valueAxis: AxisDomainConfig\r\n}\r\n\r\n/** The value axis's domain with its range and ticks resolved. */\r\nexport type BarChartDomain = AxisDomainConfig & { readonly range: Range; readonly ticks: number[] }\r\n\r\n/** The argument every per-series command takes: an index into `series`, offered by name. */\r\nconst SERIES_ARG = Types.custom<number, number, EntryOptions & { readonly min: number; readonly step: number }>(0, { kind: \"series\", min: 0, step: 1 })\r\n\r\n/** How far the legend starts below its slot when it enters, in px. */\r\nconst LEGEND_SLIDE = 20\r\n\r\n/** Fallback marker count when the value axis states no ticks. */\r\nconst DEFAULT_MARKERS = 5\r\n\r\n/**\r\n * How `enter` divides its duration between its three beats: the axes arriving,\r\n * the columns rising, and the legend coming up. Shares of the whole, so they\r\n * must sum to 1.\r\n */\r\nconst AXES_SHARE = 0.35\r\nconst BARS_SHARE = 0.5\r\nconst LEGEND_SHARE = 0.15\r\n\r\n/** What the geometry reads: what the chart plots, its theme and the signals its commands move. */\r\ninterface BarState extends BarChartValues {\r\n readonly theme: BarChartConfig\r\n readonly weights: number[]\r\n readonly spotlight: number | null\r\n readonly spotlightReveal: number\r\n}\r\n\r\n/** The value axis with its range and ticks resolved: the explicit ones, else five across the scale. */\r\nfunction drawnValue(s: BarChartValues, domain: AxisDomainConfig): AxisDomainConfig {\r\n const divisions = (domain.ticks?.length ?? DEFAULT_MARKERS) - 1\r\n const range = resolveBarScale(s.data, s.series, s.stacked, domain.range, divisions)\r\n return { ...domain, range, ticks: domain.ticks ?? markerValues(range, DEFAULT_MARKERS - 1) }\r\n}\r\n\r\n/** The value axis as a bar chart draws it now, an auto range or tick row read back as itself. */\r\nexport function barChartDomain(s: BarChartValues): BarChartDomain {\r\n return settleAxisDomain(s.valueAxis, (d) => drawnValue(s, d)) as BarChartDomain\r\n}\r\n\r\n/**\r\n * A value written down as this chart's value axis says: the ticks and the\r\n * figures printed on the columns both read through here, so the two cannot\r\n * disagree about what a number looks like.\r\n */\r\nfunction valueLabel(s: BarChartValues, domain: BarChartDomain, value: number): string {\r\n const pattern = s.valueAxis.format\r\n return pattern === undefined ? formatMarker(value, markerStep(domain.ticks)) : formatNumber(value, pattern)\r\n}\r\n\r\n/** A value on the plot's **centred** pixel space (origin at its centre, y-up). */\r\nfunction valueToY(domain: BarChartDomain, plot: Size2D, value: number): number {\r\n const [min, max] = domain.range\r\n if (max <= min) return -plot.height / 2\r\n return ((value - min) / (max - min) - 0.5) * plot.height\r\n}\r\n\r\n/**\r\n * Pixel y of the line every column grows from: zero clamped onto the scale, so\r\n * a cropped axis grows its columns from the plot floor.\r\n */\r\nfunction baselinePx(domain: BarChartDomain, plot: Size2D): number {\r\n const [min, max] = domain.range\r\n return valueToY(domain, plot, Math.min(Math.max(0, min), max))\r\n}\r\n\r\n/** Series `i`'s live share of the slot; 0 once it has been hidden. */\r\nfunction weightAt(s: BarState, index: number): number {\r\n return Math.max(0, s.weights[index] ?? 1)\r\n}\r\n\r\n/** `row` with each series' value scaled by its live weight: what the stacked spans are measured from. */\r\nfunction weightedRow(s: BarState, row: DataRecord): DataRecord {\r\n const scaled: DataRecord = { ...row }\r\n s.series.forEach((series, i) => {\r\n const value = row[series.field]\r\n if (typeof value === \"number\") scaled[series.field] = value * weightAt(s, i)\r\n })\r\n return scaled\r\n}\r\n\r\n/**\r\n * Series `index`'s columns, mapped into the plot's centred pixel space. A\r\n * grouped series divides the slot with its siblings by their live weights, a\r\n * stacked one takes the whole slot and runs from the running total below it,\r\n * so hiding a series reflows rather than punching a hole.\r\n */\r\nfunction seriesBars(s: BarState, index: number, plot: Size2D, captioned: boolean): BarGeometry[] {\r\n const series = s.series[index]\r\n if (!series) return []\r\n const domain = barChartDomain(s)\r\n const n = s.data.length\r\n const slotWidth = n > 0 ? plot.width / n : 0\r\n const slotCenter = (i: number) => -plot.width / 2 + slotWidth * (i + 0.5)\r\n const inner = slotWidth * clampUnit(s.theme.bar.slotFill)\r\n const gap = s.theme.bar.groupGap\r\n let total = 0\r\n for (let i = 0; i < s.series.length; i++) total += weightAt(s, i)\r\n const unit = inner / (total > 0 ? total : 1)\r\n const weight = weightAt(s, index)\r\n let before = 0\r\n for (let i = 0; i < index; i++) before += weightAt(s, i)\r\n\r\n return s.data.map((row, rowIndex) => {\r\n // The stack is built from the *live* contributions, so a series fading out\r\n // lowers the segments above it as it goes.\r\n const spans = barSpans(s.stacked ? weightedRow(s, row) : row, s.series, s.stacked)\r\n const span = spans[index] ?? { from: 0, to: 0, value: 0 }\r\n const cap = s.stacked ? stackCapIndex(row, s.series) : index\r\n const slotLeft = slotCenter(rowIndex) - inner / 2\r\n const x = s.stacked ? slotCenter(rowIndex) : slotLeft + unit * before + (unit * weight) / 2\r\n const width = s.stacked ? inner : Math.max(0, unit * weight - (s.series.length > 1 ? gap : 0))\r\n // The figure printed is the row's own value, not the weighted one.\r\n const value = num(row, series.field)\r\n return {\r\n x,\r\n width,\r\n from: valueToY(domain, plot, span.from),\r\n to: valueToY(domain, plot, span.to),\r\n round: cap === index,\r\n value,\r\n ...(captioned && { caption: valueLabel(s, domain, value) }),\r\n }\r\n })\r\n}\r\n\r\n/**\r\n * How far each category is dimmed by the spotlight, one entry per row: 1 while\r\n * nothing is spotlit, falling to the theme's `dimOpacity` for every category but\r\n * the chosen one as the reveal climbs.\r\n */\r\nfunction categoryDims(s: BarState): number[] {\r\n const focus = clampUnit(s.spotlightReveal)\r\n const dim = s.theme.spotlight.dimOpacity\r\n const chosen = s.spotlight\r\n return s.data.map((_, i) => (focus <= 0 || chosen === i ? 1 : 1 - (1 - dim) * focus))\r\n}\r\n\r\ntype AnyTimeline = Timeline<any, any>\r\n\r\n/** The parts a bar chart's commands drive, found through its children. */\r\nfunction partsOf(children: readonly ChildView[]) {\r\n const frame = cartesianViews(children)\r\n if (!frame) return null\r\n const cAxis = frame.below.find(CategoryAxis.is)\r\n if (!VerticalAxis.is(frame.axis) || !cAxis) return null\r\n return {\r\n vAxis: frame.axis,\r\n cAxis,\r\n bars: frame.plot.filter(ChartBars.is),\r\n legend: frame.below.find(ChartLegend.is) ?? null,\r\n }\r\n}\r\n\r\n/**\r\n * Move series `index`'s slot share to `target` with its legend entry, the group\r\n * reflowing. Its columns are drawn for every frame the move covers, and switch\r\n * off only once a hide has landed, so arriving at a time backwards shows what\r\n * arriving forwards does.\r\n */\r\nfunction toggling(timeline: AnyTimeline, state: BarState & { readonly showing: boolean[] }, children: readonly ChildView[], index: number, target: number) {\r\n const parts = partsOf(children)\r\n if (!parts || !parts.bars[index]) return timeline.wait(timeline.duration)\r\n // Read through `weightAt`, so a chart whose stored weights are short still\r\n // tweens from the 1 it is drawing at.\r\n const from = state.series.map((_, i) => weightAt(state, i))\r\n const start = from[index] ?? 1\r\n const showing = state.series.map((s, i) => state.showing[i] ?? (s.enabled ?? true))\r\n return timeline.together([\r\n timeline.animate((t) => {\r\n const weights = [...from]\r\n weights[index] = start + (target - start) * timeline.ease(t)\r\n const shown = [...showing]\r\n shown[index] = target > 0 || t < 1\r\n return { weights, showing: shown }\r\n }, { eased: false }),\r\n ...(parts.legend ? [parts.legend.run(target > 0 ? \"showSeries\" : \"hideSeries\", { index })] : []),\r\n ])\r\n}\r\n\r\n/**\r\n * A grouped or stacked bar chart, the sibling of the line chart and built the\r\n * same way, out of several of the same pieces:\r\n *\r\n * - `ChartCanvas` — the plot panel with a horizontal grid, under everything.\r\n * - `VerticalAxis` — the numeric value markers, staggering in bottom-to-top.\r\n * - {@link CategoryAxis} — the row of names beneath the baseline, one per row.\r\n * - {@link ChartBars} (one per series) — that series' column in every category,\r\n * plus the figures printed on them.\r\n * - `ChartLegend` — a row of entries below the chart, one per series.\r\n *\r\n * Every part reads the chart's entries through bindings, and the columns map\r\n * across the plot panel's own laid-out box, so a column's end lands exactly on\r\n * its marker. **Zero is always on the scale**, and the columns grow about it, so\r\n * a negative value draws downward out of the same `growth` signal.\r\n *\r\n * **Resting state is the finished chart**; `enter` arms every part on its first\r\n * frame. `showSeries`/`hideSeries`/`spotlightSeries` pick out a *series* (hiding\r\n * one reflows the group), `spotlightCategory`/`clearCategory` a *column of the\r\n * table*. A `to` of the value axis's `range` or `ticks` tweens from the domain\r\n * as drawn, so an auto axis rescales the columns continuously.\r\n */\r\nexport const BarChart = component2d({\r\n key: \"barChart\",\r\n state: {\r\n data: fresh<DataRecord[]>(() => []),\r\n categoryField: \"\",\r\n series: fresh<BarSeries[]>(() => []),\r\n stacked: false,\r\n valueAxis: Types.custom<AxisDomainConfig>({}, { resolve: resolveAxisDomain, lerp: lerpAxisEntry }),\r\n categoryAxis: Types.custom<AxisDomainConfig>({}, { resolve: resolveAxisDomain, lerp: lerpAxisDomain }),\r\n theme: Types.custom<BarChartTheme, BarChartConfig>(DEFAULT_BAR_CHART_THEME, { resolve: resolveBarChartTheme, lerp: lerpBarChartTheme }),\r\n /**\r\n * Global rise of every column in `[0, 1]`, measured about the baseline: 0\r\n * collapses them all onto it, 1 draws them at full length.\r\n */\r\n growth: 1,\r\n /**\r\n * How much of the slot each series claims, one entry per series: a weight\r\n * rather than a switch, so hiding one is the others widening into the space.\r\n * Seeded from each series' `enabled`.\r\n */\r\n weights: fresh<number[]>(() => []),\r\n /** The category spotlit, or `null` for none. The choice snaps; `spotlightReveal` is the animation. */\r\n spotlight: Types.custom<number | null>(null),\r\n /** How far the category spotlight is drawn in, `[0, 1]`. */\r\n spotlightReveal: 0,\r\n /** Read as the chart is built: the legend is a part the chart builds or doesn't. */\r\n showLegend: Types.boolean(true, { animatable: false }),\r\n /** Read as the chart is built: whether each column prints the figure it plots. */\r\n showValues: Types.boolean(false, { animatable: false }),\r\n /** Whether each series' columns are drawn: on for every frame a show or hide covers, off once a hide lands. */\r\n showing: Types.custom<boolean[]>([], { private: true }),\r\n },\r\n defaults: {\r\n // Its parts fill it; a node made of them would hug them.\r\n width: \"fill\",\r\n height: \"fill\",\r\n weights: (state) => state.series.map((s) => ((s.enabled ?? true) ? 1 : 0)),\r\n showing: (state) => state.series.map((s) => s.enabled ?? true),\r\n },\r\n children: (state) => {\r\n const theme = () => state.theme\r\n const domain = () => barChartDomain(state)\r\n let plot: Node2D | undefined\r\n // Before the panel is built or laid out it has no size, and the columns map onto nothing.\r\n const plotSize = () => laidOutSize(plot)\r\n const captioned = state.showValues === true\r\n\r\n const vAxis = new VerticalAxis({\r\n range: () => domain().range,\r\n markers: () => domain().ticks,\r\n captions: () => {\r\n const d = domain()\r\n return d.ticks.map((value) => valueLabel(state, d, value))\r\n },\r\n axis: () => theme().yAxis,\r\n label: state.valueAxis.label ?? \"\",\r\n width: \"hug\",\r\n height: \"fill\",\r\n })\r\n\r\n const cAxis = new CategoryAxis({\r\n categories: barCategories(state.data, state.categoryField),\r\n axis: () => theme().xAxis,\r\n label: state.categoryAxis.label ?? \"\",\r\n dims: () => categoryDims(state),\r\n width: \"fill\",\r\n height: \"hug\",\r\n }) as unknown as Node2D\r\n\r\n const barSets = state.series.map(\r\n (s, i) =>\r\n new ChartBars({\r\n bars: () => seriesBars(state, i, plotSize(), captioned),\r\n baseline: () => baselinePx(domain(), plotSize()),\r\n fill: () => resolveBarFill(theme().seriesFills, s, i),\r\n barStroke: () => theme().bar.stroke,\r\n barShadow: () => theme().bar.shadow,\r\n cornerRadius: () => theme().bar.cornerRadius,\r\n growth: () => state.growth,\r\n dims: () => categoryDims(state),\r\n showValues: captioned,\r\n valueStyle: state.theme.valueStyle,\r\n enabled: () => state.showing[i] ?? (s.enabled ?? true),\r\n }) as unknown as Node2D\r\n )\r\n\r\n const below: Node2D[] = [cAxis]\r\n if (state.showLegend !== false) {\r\n below.push(\r\n new ChartLegend({\r\n series: state.series,\r\n swatches: () => state.series.map((s, i) => resolveBarFill(theme().seriesFills, s, i)),\r\n legend: () => theme().legend,\r\n // The row's spacing is the theme's as the chart was built, like the\r\n // entries' type and chips: a theme tween re-paints the swatches only.\r\n gap: state.theme.legend.itemGap,\r\n padding: state.theme.legend.padding,\r\n }) as unknown as Node2D\r\n )\r\n }\r\n\r\n plot = new Rect({\r\n clip: true,\r\n children: [\r\n new ChartCanvas({\r\n fill: () => theme().plotArea.fill,\r\n shadow: () => theme().plotArea.shadow,\r\n xGridStroke: () => theme().xAxis.lineStyle,\r\n yGridStroke: () => theme().yAxis.lineStyle,\r\n // No vertical rules: the horizontal axis is categorical, so there is no\r\n // numeric position along it for a grid line to mark.\r\n xMarkers: [],\r\n yMarkers: () => domain().ticks,\r\n xExtent: () => [0, 1] as Range,\r\n yExtent: () => domain().range,\r\n }),\r\n ...barSets,\r\n new ChartBorder({ stroke: () => theme().plotArea.stroke }),\r\n ],\r\n }) as unknown as Node2D\r\n\r\n const gutter = new VerticalAxis({\r\n opacity: 0,\r\n range: () => domain().range,\r\n markers: () => domain().ticks,\r\n axis: () => theme().yAxis,\r\n label: state.valueAxis.label ?? \"\",\r\n width: \"hug\",\r\n height: 0,\r\n }) as unknown as Node2D\r\n\r\n return asParts([\r\n ...(state.children as unknown as Node2D[]),\r\n cartesianFrame({ axis: vAxis as unknown as Node2D, plot, gutter, below }),\r\n ])\r\n },\r\n commands: {\r\n /**\r\n * Animate the whole chart in: the two axes stagger their markers and\r\n * captions in, the columns rise from the baseline, and the legend fades up\r\n * last. Its first frame arms every part: markers and captions shifted and\r\n * transparent, columns collapsed, the legend dropped and transparent.\r\n * `duration` is the **whole** entrance; the beats are shares of it.\r\n */\r\n enter: {\r\n args: {},\r\n easing: easeOut(),\r\n run: (timeline, _state, children) => {\r\n const parts = partsOf(children)\r\n if (!parts) return timeline.wait(timeline.duration)\r\n const duration = timeline.duration\r\n const axes = duration * AXES_SHARE\r\n const rise = duration * BARS_SHARE\r\n const { legend } = parts\r\n const at0 = (piece: Beat[\"piece\"]): Beat => ({ at: 0, duration: 0, piece })\r\n // Without a legend the beat is still its share of the whole.\r\n return beats(timeline, [\r\n at0(timeline.animate(() => ({ growth: 0 }))),\r\n ...(legend ? [at0(legend.to({ opacity: 0, y: -LEGEND_SLIDE }))] : []),\r\n { at: 0, duration: axes, piece: parts.vAxis.run(\"enter\", { slide: 24 }) },\r\n { at: 0, duration: axes, piece: parts.cAxis.run(\"enter\", { slide: 24 }) },\r\n // No priming to 0 first: the value at `t` is a function of `t`.\r\n { at: axes, duration: rise, piece: timeline.animate((t) => ({ growth: t })) },\r\n ...(legend ? [{ at: axes + rise, duration: duration * LEGEND_SHARE, piece: legend.to({ opacity: 1, y: 0 }) }] : []),\r\n ])\r\n },\r\n },\r\n /** Show series `index`: its columns come back, the group reflowing to make room, with its legend entry. */\r\n showSeries: {\r\n args: { seriesIndex: SERIES_ARG },\r\n easing: easeOut(),\r\n run: (timeline, state, children) => toggling(timeline, state, children, timeline.args.seriesIndex, 1),\r\n },\r\n /**\r\n * Hide series `index`: its columns narrow away (or, stacked, sink out of the\r\n * stack) while the rest of the group widens into the space — the mirror of\r\n * `showSeries`.\r\n */\r\n hideSeries: {\r\n args: { seriesIndex: SERIES_ARG },\r\n easing: easeOut(),\r\n run: (timeline, state, children) => toggling(timeline, state, children, timeline.args.seriesIndex, 0),\r\n },\r\n /**\r\n * Fade every other series — its columns **and its legend entry** — to focus\r\n * on `index`, which comes back to full. Nothing moves, so the group doesn't\r\n * reflow.\r\n */\r\n spotlightSeries: {\r\n args: { seriesIndex: SERIES_ARG },\r\n easing: easeOut(),\r\n run: (timeline, state, children) => {\r\n const parts = partsOf(children)\r\n if (!parts) return timeline.wait(timeline.duration)\r\n const index = timeline.args.seriesIndex\r\n const dim = state.theme.spotlight.dimOpacity\r\n return timeline.together([\r\n ...parts.bars.map((bars, i) => bars.to({ opacity: i === index ? 1 : dim })),\r\n ...(parts.legend ? [parts.legend.run(\"spotlightSeries\", { index })] : []),\r\n ])\r\n },\r\n },\r\n /**\r\n * Spotlight one **category**: every other category's columns and caption\r\n * fade to the theme's `dimOpacity`. Called while another is lit, the focus\r\n * moves directly: only the dimming changes, so nothing retracts first. A\r\n * category that is not there takes its slot and changes nothing.\r\n */\r\n spotlightCategory: {\r\n args: { categoryIndex: Types.number(0, { min: 0, step: 1 }) },\r\n easing: easeOut(),\r\n run: (timeline, state) => {\r\n const index = timeline.args.categoryIndex\r\n if (index < 0 || index >= state.data.length) return timeline.wait(timeline.duration)\r\n const from = state.spotlightReveal\r\n return timeline.animate((t) => ({ spotlight: index, spotlightReveal: from + (1 - from) * t }))\r\n },\r\n },\r\n /**\r\n * Drop the category spotlight, every category back to full. The lit\r\n * category is held until the fade lands; a no-op when nothing is lit, which\r\n * still takes its slot.\r\n */\r\n clearCategory: {\r\n args: {},\r\n easing: easeOut(),\r\n run: (timeline, state) => {\r\n const from = state.spotlightReveal\r\n if (from === 0) return timeline.wait(timeline.duration)\r\n const lit = state.spotlight\r\n return timeline.animate((t) => (t >= 1 ? { spotlight: null, spotlightReveal: 0 } : { spotlight: lit, spotlightReveal: from * (1 - t) }))\r\n },\r\n },\r\n },\r\n})\r\n\r\nexport type BarChart = NodeOf<typeof BarChart>\r\n"]}
|
|
1
|
+
{"version":3,"file":"bar-chart.js","sourceRoot":"","sources":["../../src/bar-chart/bar-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,KAAK,EACL,WAAW,EACX,OAAO,GAUR,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE1D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAa,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,UAAU,EACV,YAAY,EACZ,GAAG,EACH,iBAAiB,EACjB,gBAAgB,GAGjB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAA;AAC1D,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,QAAQ,EACR,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,aAAa,GAId,MAAM,UAAU,CAAA;AA8CjB,4FAA4F;AAC5F,MAAM,UAAU,GAAG,K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C,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;gBACpF,MAAM,IAAI,GAAG,KAAK,CAAC,eAAe,CAAA;gBAClC,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;YAChG,CAAC;SACF;QACD;;;;WAIG;QACH,aAAa,EAAE;YACb,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,OAAO,EAAE;YACjB,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;gBACvB,MAAM,IAAI,GAAG,KAAK,CAAC,eAAe,CAAA;gBAClC,IAAI,IAAI,KAAK,CAAC;oBAAE,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;gBACvD,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAA;gBAC3B,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;YAC1I,CAAC;SACF;KACF;CACF,CAAC,CAAA","sourcesContent":["import {\n Rect,\n Types,\n component2d,\n easeOut,\n type ChildView,\n type DataRecord,\n type EntryOptions,\n type NodeOf,\n // Named so this component's emitted type reaches `Node2D` through the sdk, not core.\n type Node2D,\n type Node2DProps,\n type Size2D,\n type Timeline,\n} from \"@motionscript/sdk\"\nimport { formatNumber } from \"@motionscript/sdk/component\"\n\nimport { cartesianFrame, cartesianViews, laidOutSize } from \"../kit/cartesian\"\nimport { ChartBorder } from \"../kit/chart-border\"\nimport { ChartCanvas } from \"../kit/chart-canvas\"\nimport { ChartLegend } from \"../kit/chart-legend\"\nimport { asParts, fresh } from \"../kit/entries\"\nimport { beats, type Beat } from \"../kit/motion\"\nimport { VerticalAxis } from \"../kit/vertical-axis\"\nimport {\n clampUnit,\n formatMarker,\n lerpAxisDomain,\n lerpAxisEntry,\n markerStep,\n markerValues,\n num,\n resolveAxisDomain,\n settleAxisDomain,\n type AxisDomainConfig,\n type Range,\n} from \"../kit/shared\"\nimport { CategoryAxis } from \"./category-axis\"\nimport { ChartBars, type BarGeometry } from \"./chart-bars\"\nimport {\n DEFAULT_BAR_CHART_THEME,\n barCategories,\n barSpans,\n lerpBarChartTheme,\n resolveBarChartTheme,\n resolveBarFill,\n resolveBarScale,\n stackCapIndex,\n type BarChartConfig,\n type BarChartTheme,\n type BarSeries,\n} from \"./shared\"\n\nexport interface BarChartProps extends Node2DProps {\n /** One row per category — a plain record of field name to value. */\n data: DataRecord[]\n /**\n * Key into each row for its category caption, drawn beneath the baseline.\n * Named `categoryField` rather than `category` for the same reason the line\n * chart's is `xField`: it names a *column*, not a value.\n */\n categoryField: string\n /** One entry per bar series: which column it plots, its `label`, its `fill`. */\n series: BarSeries[]\n /**\n * When `true` every category's series stack into one column; when `false`\n * (the default) each series gets its own bar, grouped side by side within the\n * category's slot.\n */\n stacked?: boolean\n /** The value axis's domain: caption, scale range, and tick placement. */\n valueAxis?: AxisDomainConfig\n /** The category axis's domain. Only its `label` is read — the slots are the rows. */\n categoryAxis?: AxisDomainConfig\n /**\n * The chart's visual theme — bar palette and geometry, axis furniture, plot\n * panel paint, legend, value figures. Every branch is optional and deep-merged\n * onto {@link DEFAULT_BAR_CHART_THEME}.\n */\n theme?: BarChartTheme\n /** Whether the legend row below the plot is drawn at all. */\n showLegend?: boolean\n /** Whether each column prints the figure it plots. */\n showValues?: boolean\n}\n\n/** What a bar chart plots, as its entries hold it. */\nexport interface BarChartValues {\n readonly data: DataRecord[]\n readonly series: BarSeries[]\n readonly stacked: boolean\n readonly valueAxis: AxisDomainConfig\n}\n\n/** The value axis's domain with its range and ticks resolved. */\nexport type BarChartDomain = AxisDomainConfig & { readonly range: Range; readonly ticks: number[] }\n\n/** The argument every per-series command takes: an index into `series`, offered by name. */\nconst SERIES_ARG = Types.custom<number, number, EntryOptions & { readonly min: number; readonly step: number }>(0, { kind: \"series\", min: 0, step: 1 })\n\n/** How far the legend starts below its slot when it enters, in px. */\nconst LEGEND_SLIDE = 20\n\n/** Fallback marker count when the value axis states no ticks. */\nconst DEFAULT_MARKERS = 5\n\n/**\n * How `enter` divides its duration between its three beats: the axes arriving,\n * the columns rising, and the legend coming up. Shares of the whole, so they\n * must sum to 1.\n */\nconst AXES_SHARE = 0.35\nconst BARS_SHARE = 0.5\nconst LEGEND_SHARE = 0.15\n\n/** What the geometry reads: what the chart plots, its theme and the signals its commands move. */\ninterface BarState extends BarChartValues {\n readonly theme: BarChartConfig\n readonly weights: number[]\n readonly spotlight: number | null\n readonly spotlightReveal: number\n}\n\n/** The value axis with its range and ticks resolved: the explicit ones, else five across the scale. */\nfunction drawnValue(s: BarChartValues, domain: AxisDomainConfig): AxisDomainConfig {\n const divisions = (domain.ticks?.length ?? DEFAULT_MARKERS) - 1\n const range = resolveBarScale(s.data, s.series, s.stacked, domain.range, divisions)\n return { ...domain, range, ticks: domain.ticks ?? markerValues(range, DEFAULT_MARKERS - 1) }\n}\n\n/** The last domain worked out from each data array, and what else it was read from. */\nconst domainsDrawn = new WeakMap<DataRecord[], Omit<BarChartValues, \"data\"> & { readonly domain: BarChartDomain }>()\n\n/** The value axis as a bar chart draws it now, an auto range or tick row read back as itself. */\nexport function barChartDomain(s: BarChartValues): BarChartDomain {\n const { data, series, stacked, valueAxis } = s\n const kept = domainsDrawn.get(data)\n if (kept && kept.series === series && kept.stacked === stacked && kept.valueAxis === valueAxis) return kept.domain\n const domain = settleAxisDomain(valueAxis, (d) => drawnValue(s, d)) as BarChartDomain\n domainsDrawn.set(data, { series, stacked, valueAxis, domain })\n return domain\n}\n\n/**\n * A value written down as this chart's value axis says: the ticks and the\n * figures printed on the columns both read through here, so the two cannot\n * disagree about what a number looks like.\n */\nfunction valueLabel(s: BarChartValues, domain: BarChartDomain, value: number): string {\n const pattern = s.valueAxis.format\n return pattern === undefined ? formatMarker(value, markerStep(domain.ticks)) : formatNumber(value, pattern)\n}\n\n/** A value on the plot's **centred** pixel space (origin at its centre, y-up). */\nfunction valueToY(domain: BarChartDomain, plot: Size2D, value: number): number {\n const [min, max] = domain.range\n if (max <= min) return -plot.height / 2\n return ((value - min) / (max - min) - 0.5) * plot.height\n}\n\n/**\n * Pixel y of the line every column grows from: zero clamped onto the scale, so\n * a cropped axis grows its columns from the plot floor.\n */\nfunction baselinePx(domain: BarChartDomain, plot: Size2D): number {\n const [min, max] = domain.range\n return valueToY(domain, plot, Math.min(Math.max(0, min), max))\n}\n\n/** Series `i`'s live share of the slot; 0 once it has been hidden. */\nfunction weightAt(s: BarState, index: number): number {\n return Math.max(0, s.weights[index] ?? 1)\n}\n\n/** `row` with each series' value scaled by its live weight: what the stacked spans are measured from. */\nfunction weightedRow(s: BarState, row: DataRecord): DataRecord {\n const scaled: DataRecord = { ...row }\n s.series.forEach((series, i) => {\n const value = row[series.field]\n if (typeof value === \"number\") scaled[series.field] = value * weightAt(s, i)\n })\n return scaled\n}\n\n/**\n * Series `index`'s columns, mapped into the plot's centred pixel space. A\n * grouped series divides the slot with its siblings by their live weights, a\n * stacked one takes the whole slot and runs from the running total below it,\n * so hiding a series reflows rather than punching a hole.\n */\nfunction seriesBars(s: BarState, index: number, plot: Size2D, captioned: boolean): BarGeometry[] {\n const series = s.series[index]\n if (!series) return []\n const domain = barChartDomain(s)\n const n = s.data.length\n const slotWidth = n > 0 ? plot.width / n : 0\n const slotCenter = (i: number) => -plot.width / 2 + slotWidth * (i + 0.5)\n const inner = slotWidth * clampUnit(s.theme.bar.slotFill)\n const gap = s.theme.bar.groupGap\n let total = 0\n for (let i = 0; i < s.series.length; i++) total += weightAt(s, i)\n const unit = inner / (total > 0 ? total : 1)\n const weight = weightAt(s, index)\n let before = 0\n for (let i = 0; i < index; i++) before += weightAt(s, i)\n\n return s.data.map((row, rowIndex) => {\n // The stack is built from the *live* contributions, so a series fading out\n // lowers the segments above it as it goes.\n const spans = barSpans(s.stacked ? weightedRow(s, row) : row, s.series, s.stacked)\n const span = spans[index] ?? { from: 0, to: 0, value: 0 }\n const cap = s.stacked ? stackCapIndex(row, s.series) : index\n const slotLeft = slotCenter(rowIndex) - inner / 2\n const x = s.stacked ? slotCenter(rowIndex) : slotLeft + unit * before + (unit * weight) / 2\n const width = s.stacked ? inner : Math.max(0, unit * weight - (s.series.length > 1 ? gap : 0))\n // The figure printed is the row's own value, not the weighted one.\n const value = num(row, series.field)\n return {\n x,\n width,\n from: valueToY(domain, plot, span.from),\n to: valueToY(domain, plot, span.to),\n round: cap === index,\n value,\n ...(captioned && { caption: valueLabel(s, domain, value) }),\n }\n })\n}\n\n/**\n * How far each category is dimmed by the spotlight, one entry per row: 1 while\n * nothing is spotlit, falling to the theme's `dimOpacity` for every category but\n * the chosen one as the reveal climbs.\n */\nfunction categoryDims(s: BarState): number[] {\n const focus = clampUnit(s.spotlightReveal)\n const dim = s.theme.spotlight.dimOpacity\n const chosen = s.spotlight\n return s.data.map((_, i) => (focus <= 0 || chosen === i ? 1 : 1 - (1 - dim) * focus))\n}\n\ntype AnyTimeline = Timeline<any, any>\n\n/** The parts a bar chart's commands drive, found through its children. */\nfunction partsOf(children: readonly ChildView[]) {\n const frame = cartesianViews(children)\n if (!frame) return null\n const cAxis = frame.below.find(CategoryAxis.is)\n if (!VerticalAxis.is(frame.axis) || !cAxis) return null\n return {\n vAxis: frame.axis,\n cAxis,\n bars: frame.plot.filter(ChartBars.is),\n legend: frame.below.find(ChartLegend.is) ?? null,\n }\n}\n\n/**\n * Move series `index`'s slot share to `target` with its legend entry, the group\n * reflowing. Its columns are drawn for every frame the move covers, and switch\n * off only once a hide has landed, so arriving at a time backwards shows what\n * arriving forwards does.\n */\nfunction toggling(timeline: AnyTimeline, state: BarState & { readonly showing: boolean[] }, children: readonly ChildView[], index: number, target: number) {\n const parts = partsOf(children)\n if (!parts || !parts.bars[index]) return timeline.wait(timeline.duration)\n // Read through `weightAt`, so a chart whose stored weights are short still\n // tweens from the 1 it is drawing at.\n const from = state.series.map((_, i) => weightAt(state, i))\n const start = from[index] ?? 1\n const showing = state.series.map((s, i) => state.showing[i] ?? (s.enabled ?? true))\n return timeline.together([\n timeline.animate((t) => {\n const weights = [...from]\n weights[index] = start + (target - start) * timeline.ease(t)\n const shown = [...showing]\n shown[index] = target > 0 || t < 1\n return { weights, showing: shown }\n }, { eased: false }),\n ...(parts.legend ? [parts.legend.run(target > 0 ? \"showSeries\" : \"hideSeries\", { index })] : []),\n ])\n}\n\n/**\n * A grouped or stacked bar chart, the sibling of the line chart and built the\n * same way, out of several of the same pieces:\n *\n * - `ChartCanvas` — the plot panel with a horizontal grid, under everything.\n * - `VerticalAxis` — the numeric value markers, staggering in bottom-to-top.\n * - {@link CategoryAxis} — the row of names beneath the baseline, one per row.\n * - {@link ChartBars} (one per series) — that series' column in every category,\n * plus the figures printed on them.\n * - `ChartLegend` — a row of entries below the chart, one per series.\n *\n * Every part reads the chart's entries through bindings, and the columns map\n * across the plot panel's own laid-out box, so a column's end lands exactly on\n * its marker. **Zero is always on the scale**, and the columns grow about it, so\n * a negative value draws downward out of the same `growth` signal.\n *\n * **Resting state is the finished chart**; `enter` arms every part on its first\n * frame. `showSeries`/`hideSeries`/`spotlightSeries` pick out a *series* (hiding\n * one reflows the group), `spotlightCategory`/`clearCategory` a *column of the\n * table*. A `to` of the value axis's `range` or `ticks` tweens from the domain\n * as drawn, so an auto axis rescales the columns continuously.\n */\nexport const BarChart = component2d({\n key: \"barChart\",\n state: {\n data: fresh<DataRecord[]>(() => []),\n categoryField: \"\",\n series: fresh<BarSeries[]>(() => []),\n stacked: false,\n valueAxis: Types.custom<AxisDomainConfig>({}, { resolve: resolveAxisDomain, lerp: lerpAxisEntry }),\n categoryAxis: Types.custom<AxisDomainConfig>({}, { resolve: resolveAxisDomain, lerp: lerpAxisDomain }),\n theme: Types.custom<BarChartTheme, BarChartConfig>(DEFAULT_BAR_CHART_THEME, { resolve: resolveBarChartTheme, lerp: lerpBarChartTheme }),\n /**\n * Global rise of every column in `[0, 1]`, measured about the baseline: 0\n * collapses them all onto it, 1 draws them at full length.\n */\n growth: 1,\n /**\n * How much of the slot each series claims, one entry per series: a weight\n * rather than a switch, so hiding one is the others widening into the space.\n * Seeded from each series' `enabled`.\n */\n weights: fresh<number[]>(() => []),\n /** The category spotlit, or `null` for none. The choice snaps; `spotlightReveal` is the animation. */\n spotlight: Types.custom<number | null>(null),\n /** How far the category spotlight is drawn in, `[0, 1]`. */\n spotlightReveal: 0,\n /** Read as the chart is built: the legend is a part the chart builds or doesn't. */\n showLegend: Types.boolean(true, { animatable: false }),\n /** Read as the chart is built: whether each column prints the figure it plots. */\n showValues: Types.boolean(false, { animatable: false }),\n /** Whether each series' columns are drawn: on for every frame a show or hide covers, off once a hide lands. */\n showing: Types.custom<boolean[]>([], { private: true }),\n },\n defaults: {\n // Its parts fill it; a node made of them would hug them.\n width: \"fill\",\n height: \"fill\",\n weights: (state) => state.series.map((s) => ((s.enabled ?? true) ? 1 : 0)),\n showing: (state) => state.series.map((s) => s.enabled ?? true),\n },\n allowedChildren: [],\n children: (state) => {\n const theme = () => state.theme\n const domain = () => barChartDomain(state)\n let plot: Node2D | undefined\n // Before the panel is built or laid out it has no size, and the columns map onto nothing.\n const plotSize = () => laidOutSize(plot)\n const captioned = state.showValues === true\n\n const vAxis = new VerticalAxis({\n range: () => domain().range,\n markers: () => domain().ticks,\n captions: () => {\n const d = domain()\n return d.ticks.map((value) => valueLabel(state, d, value))\n },\n axis: () => theme().yAxis,\n label: state.valueAxis.label ?? \"\",\n width: \"hug\",\n height: \"fill\",\n })\n\n const cAxis = new CategoryAxis({\n categories: barCategories(state.data, state.categoryField),\n axis: () => theme().xAxis,\n label: state.categoryAxis.label ?? \"\",\n dims: () => categoryDims(state),\n width: \"fill\",\n height: \"hug\",\n }) as unknown as Node2D\n\n const barSets = state.series.map(\n (s, i) =>\n new ChartBars({\n bars: () => seriesBars(state, i, plotSize(), captioned),\n baseline: () => baselinePx(domain(), plotSize()),\n fill: () => resolveBarFill(theme().seriesFills, s, i),\n barStroke: () => theme().bar.stroke,\n barShadow: () => theme().bar.shadow,\n cornerRadius: () => theme().bar.cornerRadius,\n growth: () => state.growth,\n dims: () => categoryDims(state),\n showValues: captioned,\n valueStyle: state.theme.valueStyle,\n enabled: () => state.showing[i] ?? (s.enabled ?? true),\n }) as unknown as Node2D\n )\n\n const below: Node2D[] = [cAxis]\n if (state.showLegend !== false) {\n below.push(\n new ChartLegend({\n series: state.series,\n swatches: () => state.series.map((s, i) => resolveBarFill(theme().seriesFills, s, i)),\n legend: () => theme().legend,\n // The row's spacing is the theme's as the chart was built, like the\n // entries' type and chips: a theme tween re-paints the swatches only.\n gap: state.theme.legend.itemGap,\n padding: state.theme.legend.padding,\n }) as unknown as Node2D\n )\n }\n\n plot = new Rect({\n clip: true,\n children: [\n new ChartCanvas({\n fill: () => theme().plotArea.fill,\n shadow: () => theme().plotArea.shadow,\n xGridStroke: () => theme().xAxis.lineStyle,\n yGridStroke: () => theme().yAxis.lineStyle,\n // No vertical rules: the horizontal axis is categorical, so there is no\n // numeric position along it for a grid line to mark.\n xMarkers: [],\n yMarkers: () => domain().ticks,\n xExtent: () => [0, 1] as Range,\n yExtent: () => domain().range,\n }),\n ...barSets,\n new ChartBorder({ stroke: () => theme().plotArea.stroke }),\n ],\n }) as unknown as Node2D\n\n const gutter = new VerticalAxis({\n opacity: 0,\n range: () => domain().range,\n markers: () => domain().ticks,\n axis: () => theme().yAxis,\n label: state.valueAxis.label ?? \"\",\n width: \"hug\",\n height: 0,\n }) as unknown as Node2D\n\n return asParts([cartesianFrame({ axis: vAxis as unknown as Node2D, plot, gutter, below })])\n },\n commands: {\n /**\n * Animate the whole chart in: the two axes stagger their markers and\n * captions in, the columns rise from the baseline, and the legend fades up\n * last. Its first frame arms every part: markers and captions shifted and\n * transparent, columns collapsed, the legend dropped and transparent.\n * `duration` is the **whole** entrance; the beats are shares of it.\n */\n enter: {\n args: {},\n // Held from the chart's arrival, so it never shows finished ahead of its draw.\n entrance: true,\n easing: easeOut(),\n run: (timeline, _state, children) => {\n const parts = partsOf(children)\n if (!parts) return timeline.wait(timeline.duration)\n const duration = timeline.duration\n const axes = duration * AXES_SHARE\n const rise = duration * BARS_SHARE\n const { legend } = parts\n const at0 = (piece: Beat[\"piece\"]): Beat => ({ at: 0, duration: 0, piece })\n // Without a legend the beat is still its share of the whole.\n return beats(timeline, [\n at0(timeline.animate(() => ({ growth: 0 }))),\n ...(legend ? [at0(legend.to({ opacity: 0, y: -LEGEND_SLIDE }))] : []),\n { at: 0, duration: axes, piece: parts.vAxis.run(\"enter\", { slide: 24 }) },\n { at: 0, duration: axes, piece: parts.cAxis.run(\"enter\", { slide: 24 }) },\n // No priming to 0 first: the value at `t` is a function of `t`.\n { at: axes, duration: rise, piece: timeline.animate((t) => ({ growth: t })) },\n ...(legend ? [{ at: axes + rise, duration: duration * LEGEND_SHARE, piece: legend.to({ opacity: 1, y: 0 }) }] : []),\n ])\n },\n },\n /** Show series `index`: its columns come back, the group reflowing to make room, with its legend entry. */\n showSeries: {\n args: { seriesIndex: SERIES_ARG },\n easing: easeOut(),\n run: (timeline, state, children) => toggling(timeline, state, children, timeline.args.seriesIndex, 1),\n },\n /**\n * Hide series `index`: its columns narrow away (or, stacked, sink out of the\n * stack) while the rest of the group widens into the space — the mirror of\n * `showSeries`.\n */\n hideSeries: {\n args: { seriesIndex: SERIES_ARG },\n easing: easeOut(),\n run: (timeline, state, children) => toggling(timeline, state, children, timeline.args.seriesIndex, 0),\n },\n /**\n * Fade every other series — its columns **and its legend entry** — to focus\n * on `index`, which comes back to full. Nothing moves, so the group doesn't\n * reflow.\n */\n spotlightSeries: {\n args: { seriesIndex: SERIES_ARG },\n easing: easeOut(),\n run: (timeline, state, children) => {\n const parts = partsOf(children)\n if (!parts) return timeline.wait(timeline.duration)\n const index = timeline.args.seriesIndex\n const dim = state.theme.spotlight.dimOpacity\n return timeline.together([\n ...parts.bars.map((bars, i) => bars.to({ opacity: i === index ? 1 : dim })),\n ...(parts.legend ? [parts.legend.run(\"spotlightSeries\", { index })] : []),\n ])\n },\n },\n /**\n * Spotlight one **category**: every other category's columns and caption\n * fade to the theme's `dimOpacity`. Called while another is lit, the focus\n * moves directly: only the dimming changes, so nothing retracts first. A\n * category that is not there takes its slot and changes nothing.\n */\n spotlightCategory: {\n args: { categoryIndex: Types.number(0, { min: 0, step: 1 }) },\n easing: easeOut(),\n run: (timeline, state) => {\n const index = timeline.args.categoryIndex\n if (index < 0 || index >= state.data.length) return timeline.wait(timeline.duration)\n const from = state.spotlightReveal\n return timeline.animate((t) => ({ spotlight: index, spotlightReveal: from + (1 - from) * t }))\n },\n },\n /**\n * Drop the category spotlight, every category back to full. The lit\n * category is held until the fade lands; a no-op when nothing is lit, which\n * still takes its slot.\n */\n clearCategory: {\n args: {},\n easing: easeOut(),\n run: (timeline, state) => {\n const from = state.spotlightReveal\n if (from === 0) return timeline.wait(timeline.duration)\n const lit = state.spotlight\n return timeline.animate((t) => (t >= 1 ? { spotlight: null, spotlightReveal: 0 } : { spotlight: lit, spotlightReveal: from * (1 - t) }))\n },\n },\n },\n})\n\nexport type BarChart = NodeOf<typeof BarChart>\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category-axis.js","sourceRoot":"","sources":["../../src/bar-chart/category-axis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,WAAW,EACX,SAAS,EACT,OAAO,GAIR,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,OAA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,CAAC,GAAG,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YAC3E,CAAC;SACF;KACF;CACF,CAAC,CAAA","sourcesContent":["import {\r\n Rect,\r\n Text,\r\n Types,\r\n component2d,\r\n insetsOps,\r\n textOps,\r\n type NodeOf,\r\n type Node2D,\r\n type Node2DProps,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport { asParts, fresh } from \"../kit/entries\"\r\nimport { armed, arrival, arrivalOf, arrivalsEntry, beats, frameEase, type Arrival } from \"../kit/motion\"\r\nimport {\r\n DEFAULT_X_AXIS,\r\n clampUnit,\r\n enterBudget,\r\n type AxisConfig,\r\n} from \"../kit/shared\"\r\n\r\nexport interface CategoryAxisProps extends Node2DProps {\r\n /** One caption per category slot, left to right — the chart's rows, in order. */\r\n categories: string[]\r\n /** Caption/title text style and gutters — see {@link AxisConfig}. */\r\n axis: AxisConfig\r\n /**\r\n * Caption drawn centred in the gutter beneath the category row. Empty string\r\n * (the default) hides it.\r\n */\r\n label: string\r\n /**\r\n * Per-category opacity multiplier — how the chart's category spotlight reaches\r\n * the captions, so the name under a dimmed column dims with it. Missing\r\n * entries read as 1.\r\n */\r\n dims: number[]\r\n}\r\n\r\n/** How far a caption starts above its slot when it enters, in px. */\r\nconst SLIDE = 24\r\n\r\n/**\r\n * The **categorical** horizontal axis of a {@link BarChart}: a row of\r\n * {@link Text} captions, one per row of the data, each centred on its slot\r\n * beneath the baseline.\r\n *\r\n * Not a variant of the line chart's `HorizontalAxis` and deliberately not\r\n * folded into it: that axis places markers by *value* across a numeric range,\r\n * this one divides its width into equal slots and centres a name in each. The\r\n * two look alike on screen and share nothing underneath — one reads a scale,\r\n * the other counts rows.\r\n *\r\n * The slot arithmetic is the same as the plot's, because this node is laid out\r\n * to exactly the plot's width (the chart reserves the axis gutter with an\r\n * invisible twin of the value axis, as the line chart does), so a caption lands\r\n * under the columns it names without either side being told about the other.\r\n *\r\n * `enter` staggers the captions in left-to-right, each lifted a little above\r\n * its slot and transparent; the resting state is the landed one, so a chart\r\n * that is never told to enter still reads as finished.\r\n */\r\nexport const CategoryAxis = component2d({\r\n key: \"categoryAxis\",\r\n state: {\r\n categories: fresh<string[]>(() => []),\r\n axis: Types.custom<AxisConfig>(DEFAULT_X_AXIS),\r\n label: \"\",\r\n dims: fresh<number[]>(() => []),\r\n arrivals: arrivalsEntry(),\r\n },\r\n // A plain node filled its parent; one made of its captions would hug them.\r\n defaults: { width: \"fill\", height: \"fill\" },\r\n children: (state) => {\r\n const tickPad = insetsOps.resolve(state.axis.tickPadding).top\r\n const titlePad = insetsOps.resolve(state.axis.titlePadding).top\r\n\r\n const column: Node2D[] = []\r\n // The column's parent is the axis: its box is what the slots divide.\r\n const width = () => (column[0]?.parent as Node2D | null | undefined)?.layoutBounds.width ?? 0\r\n /** Centre x of slot `i`, in the node's centred space. */\r\n const slotCenter = (index: number) => {\r\n const n = state.categories.length\r\n if (n <= 0) return 0\r\n return -width() / 2 + (width() / n) * (index + 0.5)\r\n }\r\n\r\n // Each caption sits in a hug box carrying the spotlight dim, so the\r\n // entrance can animate the text's own opacity without the two fighting over\r\n // one value — opacity multiplies down the tree, which is exactly the\r\n // composition wanted here.\r\n const slots = state.categories.map((caption, i) =>\r\n new Rect({\r\n width: \"hug\",\r\n height: \"hug\",\r\n flow: \"freeform\",\r\n opacity: () => clampUnit(state.dims[i] ?? 1),\r\n x: () => slotCenter(i),\r\n children: [\r\n new Text({\r\n ...textOps.styleProps(state.axis.labelStyle),\r\n text: caption,\r\n opacity: () => arrivalOf(state.arrivals, i).opacity,\r\n y: () => arrivalOf(state.arrivals, i).shift,\r\n }),\r\n ],\r\n })\r\n )\r\n\r\n const children: Node2D[] = [new Rect({ width: \"fill\", height: \"hug\", padding: { top: tickPad }, children: slots })]\r\n if (state.label !== \"\") {\r\n children.push(\r\n new Text({\r\n ...textOps.styleProps(state.axis.titleStyle),\r\n text: state.label,\r\n opacity: () => arrivalOf(state.arrivals, \"label\").opacity,\r\n y: () => arrivalOf(state.arrivals, \"label\").shift,\r\n })\r\n )\r\n }\r\n\r\n column.push(new Rect({ flow: \"vertical\", gap: titlePad, height: \"hug\", width: \"fill\", children }))\r\n return asParts(column)\r\n },\r\n commands: {\r\n /**\r\n * Slide + fade every caption in from above, staggered left-to-right, then\r\n * bring the title down behind them. Its first frame arms them all: lifted\r\n * by `slide` and transparent.\r\n *\r\n * The timeline's duration is the **whole** entrance — the stagger and the\r\n * title are carved out of it rather than added on top. See {@link enterBudget}.\r\n *\r\n * `stagger` is seconds between successive captions (derived when omitted);\r\n * `slide` is the starting upward offset in px (node space is y-up, so a\r\n * positive start slides *down* into place).\r\n */\r\n enter: {\r\n args: {\r\n stagger: Types.custom<number | undefined>(undefined),\r\n slide: Types.number(SLIDE),\r\n },\r\n run: (timeline, state) => {\r\n const { stagger, slide } = timeline.args\r\n const count = state.categories.length\r\n const captioned = state.label !== \"\"\r\n const from: Arrival = { opacity: 0, shift: slide }\r\n const keys = [...state.categories.keys(), ...(captioned ? [\"label\"] : [])]\r\n const arm = timeline.animate(() => ({ arrivals: armed(keys, from) }))\r\n if (count === 0) return arm\r\n const { step, per, caption } = enterBudget(timeline.duration, count, captioned, stagger)\r\n const ease = frameEase(timeline)\r\n const lastCaptionEnds = (count - 1) * step + per\r\n const captions = state.categories.map((_, i) => ({ at: i * step, duration: per, piece: arrival(timeline, i, from, ease) }))\r\n const label = captioned ? [{ at: lastCaptionEnds, duration: caption, piece: arrival(timeline, \"label\", from, ease) }] : []\r\n return timeline.together([arm, beats(timeline, [...captions, ...label])])\r\n },\r\n },\r\n },\r\n})\r\n\r\nexport type CategoryAxis = NodeOf<typeof CategoryAxis>\r\n"]}
|
|
1
|
+
{"version":3,"file":"category-axis.js","sourceRoot":"","sources":["../../src/bar-chart/category-axis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,WAAW,EACX,SAAS,EACT,OAAO,GAIR,MAAM,mBAAm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,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,GAAG,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YAC3E,CAAC;SACF;KACF;CACF,CAAC,CAAA","sourcesContent":["import {\n Rect,\n Text,\n Types,\n component2d,\n insetsOps,\n textOps,\n type NodeOf,\n type Node2D,\n type Node2DProps,\n} from \"@motionscript/sdk\"\n\nimport { asParts, fresh } from \"../kit/entries\"\nimport { armed, arrival, arrivalOf, arrivalsEntry, beats, frameEase, type Arrival } from \"../kit/motion\"\nimport {\n DEFAULT_X_AXIS,\n clampUnit,\n enterBudget,\n type AxisConfig,\n} from \"../kit/shared\"\n\nexport interface CategoryAxisProps extends Node2DProps {\n /** One caption per category slot, left to right — the chart's rows, in order. */\n categories: string[]\n /** Caption/title text style and gutters — see {@link AxisConfig}. */\n axis: AxisConfig\n /**\n * Caption drawn centred in the gutter beneath the category row. Empty string\n * (the default) hides it.\n */\n label: string\n /**\n * Per-category opacity multiplier — how the chart's category spotlight reaches\n * the captions, so the name under a dimmed column dims with it. Missing\n * entries read as 1.\n */\n dims: number[]\n}\n\n/** How far a caption starts above its slot when it enters, in px. */\nconst SLIDE = 24\n\n/**\n * The **categorical** horizontal axis of a {@link BarChart}: a row of\n * {@link Text} captions, one per row of the data, each centred on its slot\n * beneath the baseline.\n *\n * Not a variant of the line chart's `HorizontalAxis` and deliberately not\n * folded into it: that axis places markers by *value* across a numeric range,\n * this one divides its width into equal slots and centres a name in each. The\n * two look alike on screen and share nothing underneath — one reads a scale,\n * the other counts rows.\n *\n * The slot arithmetic is the same as the plot's, because this node is laid out\n * to exactly the plot's width (the chart reserves the axis gutter with an\n * invisible twin of the value axis, as the line chart does), so a caption lands\n * under the columns it names without either side being told about the other.\n *\n * `enter` staggers the captions in left-to-right, each lifted a little above\n * its slot and transparent; the resting state is the landed one, so a chart\n * that is never told to enter still reads as finished.\n */\nexport const CategoryAxis = component2d({\n key: \"categoryAxis\",\n state: {\n categories: fresh<string[]>(() => []),\n axis: Types.custom<AxisConfig>(DEFAULT_X_AXIS),\n label: \"\",\n dims: fresh<number[]>(() => []),\n arrivals: arrivalsEntry(),\n },\n // A plain node filled its parent; one made of its captions would hug them.\n defaults: { width: \"fill\", height: \"fill\" },\n children: (state) => {\n const tickPad = insetsOps.resolve(state.axis.tickPadding).top\n const titlePad = insetsOps.resolve(state.axis.titlePadding).top\n\n const column: Node2D[] = []\n // The column's parent is the axis: its box is what the slots divide.\n const width = () => (column[0]?.parent as Node2D | null | undefined)?.layoutBounds.width ?? 0\n /** Centre x of slot `i`, in the node's centred space. */\n const slotCenter = (index: number) => {\n const n = state.categories.length\n if (n <= 0) return 0\n return -width() / 2 + (width() / n) * (index + 0.5)\n }\n\n // Each caption sits in a hug box carrying the spotlight dim, so the\n // entrance can animate the text's own opacity without the two fighting over\n // one value — opacity multiplies down the tree, which is exactly the\n // composition wanted here.\n const slots = state.categories.map((caption, i) =>\n new Rect({\n width: \"hug\",\n height: \"hug\",\n flow: \"freeform\",\n opacity: () => clampUnit(state.dims[i] ?? 1),\n x: () => slotCenter(i),\n children: [\n new Text({\n ...textOps.styleProps(state.axis.labelStyle),\n text: caption,\n opacity: () => arrivalOf(state.arrivals, i).opacity,\n y: () => arrivalOf(state.arrivals, i).shift,\n }),\n ],\n })\n )\n\n const children: Node2D[] = [new Rect({ width: \"fill\", height: \"hug\", padding: { top: tickPad }, children: slots })]\n if (state.label !== \"\") {\n children.push(\n new Text({\n ...textOps.styleProps(state.axis.titleStyle),\n text: state.label,\n opacity: () => arrivalOf(state.arrivals, \"label\").opacity,\n y: () => arrivalOf(state.arrivals, \"label\").shift,\n })\n )\n }\n\n column.push(new Rect({ flow: \"vertical\", gap: titlePad, height: \"hug\", width: \"fill\", children }))\n return asParts(column)\n },\n commands: {\n /**\n * Slide + fade every caption in from above, staggered left-to-right, then\n * bring the title down behind them. Its first frame arms them all: lifted\n * by `slide` and transparent.\n *\n * The timeline's duration is the **whole** entrance — the stagger and the\n * title are carved out of it rather than added on top. See {@link enterBudget}.\n *\n * `stagger` is seconds between successive captions (derived when omitted);\n * `slide` is the starting upward offset in px (node space is y-up, so a\n * positive start slides *down* into place).\n */\n enter: {\n args: {\n stagger: Types.custom<number | undefined>(undefined),\n slide: Types.number(SLIDE),\n },\n run: (timeline, state) => {\n const { stagger, slide } = timeline.args\n const count = state.categories.length\n const captioned = state.label !== \"\"\n const from: Arrival = { opacity: 0, shift: slide }\n const keys = [...state.categories.keys(), ...(captioned ? [\"label\"] : [])]\n const arm = timeline.animate(() => ({ arrivals: armed(keys, from) }))\n if (count === 0) return arm\n const { step, per, caption } = enterBudget(timeline.duration, count, captioned, stagger)\n const ease = frameEase(timeline)\n const lastCaptionEnds = (count - 1) * step + per\n const captions = state.categories.map((_, i) => ({ at: i * step, duration: per, piece: arrival(timeline, i, from, ease) }))\n const label = captioned ? [{ at: lastCaptionEnds, duration: caption, piece: arrival(timeline, \"label\", from, ease) }] : []\n return timeline.together([arm, beats(timeline, [...captions, ...label])])\n },\n },\n },\n})\n\nexport type CategoryAxis = NodeOf<typeof CategoryAxis>\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-bars.d.ts","sourceRoot":"","sources":["../../src/bar-chart/chart-bars.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,MAAM,EAEX,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,mBAAmB,CAAA;AAQ1B;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,8BAA8B;IAC9B,CAAC,EAAE,MAAM,CAAA;IACT,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,oGAAoG;IACpG,IAAI,EAAE,MAAM,CAAA;IACZ,qEAAqE;IACrE,EAA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A0B;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,oGAAoG;IACpG,IAAI,EAAE,MAAM,CAAA;IACZ,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAA;IACV,6EAA6E;IAC7E,KAAK,EAAE,OAAO,CAAA;IACd,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AASD,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,6DAA6D;IAC7D,IAAI,EAAE,WAAW,EAAE,CAAA;IACnB,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAA;IAChB,mFAAmF;IACnF,IAAI,EAAE,IAAI,CAAA;IACV,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAA;IACjB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAA;IACjB,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAA;IACpB;;;;;;;;;OASG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,6DAA6D;IAC7D,UAAU,EAAE,OAAO,CAAA;IACnB,oCAAoC;IACpC,UAAU,EAAE,SAAS,CAAA;IACrB;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAA;CACjB;AA6ED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAuFpB,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAA"}
|
|
@@ -159,15 +159,14 @@ export const ChartBars = component2d({
|
|
|
159
159
|
y: (ends.base + ends.end) / 2,
|
|
160
160
|
width: bar.width,
|
|
161
161
|
height,
|
|
162
|
-
//
|
|
163
|
-
//
|
|
164
|
-
//
|
|
165
|
-
//
|
|
166
|
-
// single capped column.
|
|
162
|
+
// Corner keys are visual (the renderer keeps them in y-up author space),
|
|
163
|
+
// so a column reaching *up* rounds its `top*` corners and one reaching
|
|
164
|
+
// down its `bottom*` ones. Only the far end rounds, which is what makes
|
|
165
|
+
// a stack read as a single capped column.
|
|
167
166
|
cornerRadius: radius > 0
|
|
168
167
|
? ends.end >= ends.base
|
|
169
|
-
? {
|
|
170
|
-
: {
|
|
168
|
+
? { topLeft: radius, topRight: radius, bottomLeft: 0, bottomRight: 0 }
|
|
169
|
+
: { bottomLeft: radius, bottomRight: radius, topLeft: 0, topRight: 0 }
|
|
171
170
|
: 0,
|
|
172
171
|
});
|
|
173
172
|
rect.shadow(state.barShadow);
|