@motionscript/charts 0.1.1-alpha.1 → 0.1.1-alpha.2
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 +15 -0
- package/README.md +19 -8
- package/dist/bar-chart/bar-chart.d.ts +97 -65
- package/dist/bar-chart/bar-chart.d.ts.map +1 -1
- package/dist/bar-chart/bar-chart.js +9 -5
- package/dist/bar-chart/bar-chart.js.map +1 -1
- package/dist/bar-chart/chart-bars.d.ts +29 -5
- package/dist/bar-chart/chart-bars.d.ts.map +1 -1
- package/dist/bar-chart/chart-bars.js +33 -8
- package/dist/bar-chart/chart-bars.js.map +1 -1
- package/dist/bar-chart/shared.d.ts +9 -4
- package/dist/bar-chart/shared.d.ts.map +1 -1
- package/dist/bar-chart/shared.js +10 -5
- package/dist/bar-chart/shared.js.map +1 -1
- package/dist/browser/chunks/chunk-7XCRX6GE.js +2 -0
- package/dist/browser/chunks/chunk-7XCRX6GE.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/kit/cartesian.d.ts +6 -4
- package/dist/kit/cartesian.d.ts.map +1 -1
- package/dist/kit/cartesian.js +5 -3
- package/dist/kit/cartesian.js.map +1 -1
- package/dist/kit/style.d.ts +339 -76
- package/dist/kit/style.d.ts.map +1 -1
- package/dist/kit/style.js +196 -101
- package/dist/kit/style.js.map +1 -1
- package/dist/line-chart/line-chart.d.ts +81 -57
- package/dist/line-chart/line-chart.d.ts.map +1 -1
- package/dist/line-chart/line-chart.js +9 -7
- package/dist/line-chart/line-chart.js.map +1 -1
- package/dist/pie-chart/pie-chart.d.ts +43 -43
- package/dist/pie-chart/pie-chart.d.ts.map +1 -1
- package/dist/pie-chart/pie-chart.js +2 -1
- package/dist/pie-chart/pie-chart.js.map +1 -1
- package/dist/pie-chart/shared.d.ts +15 -8
- package/dist/pie-chart/shared.d.ts.map +1 -1
- package/dist/pie-chart/shared.js +21 -20
- package/dist/pie-chart/shared.js.map +1 -1
- package/dist/radar-chart/index.d.ts +1 -1
- package/dist/radar-chart/index.d.ts.map +1 -1
- package/dist/radar-chart/index.js +1 -1
- package/dist/radar-chart/index.js.map +1 -1
- package/dist/radar-chart/radar-chart.d.ts +37 -43
- package/dist/radar-chart/radar-chart.d.ts.map +1 -1
- package/dist/radar-chart/radar-chart.js +12 -12
- package/dist/radar-chart/radar-chart.js.map +1 -1
- package/dist/radar-chart/radar-grid.d.ts +7 -1
- package/dist/radar-chart/radar-grid.d.ts.map +1 -1
- package/dist/radar-chart/radar-grid.js +17 -15
- package/dist/radar-chart/radar-grid.js.map +1 -1
- package/dist/radar-chart/shared.d.ts +7 -2
- package/dist/radar-chart/shared.d.ts.map +1 -1
- package/dist/radar-chart/shared.js +6 -0
- package/dist/radar-chart/shared.js.map +1 -1
- package/dist/radial-chart/radial-chart.d.ts +37 -43
- package/dist/radial-chart/radial-chart.d.ts.map +1 -1
- package/dist/radial-chart/radial-chart.js +2 -1
- package/dist/radial-chart/radial-chart.js.map +1 -1
- package/dist/radial-chart/shared.d.ts +13 -9
- package/dist/radial-chart/shared.d.ts.map +1 -1
- package/dist/radial-chart/shared.js +15 -16
- package/dist/radial-chart/shared.js.map +1 -1
- package/package.json +4 -4
- package/src/bar-chart/bar-chart.ts +17 -6
- package/src/bar-chart/chart-bars.ts +48 -9
- package/src/bar-chart/shared.ts +20 -5
- package/src/kit/cartesian.ts +10 -7
- package/src/kit/style.ts +214 -118
- package/src/line-chart/line-chart.ts +14 -8
- package/src/pie-chart/pie-chart.ts +3 -1
- package/src/pie-chart/shared.ts +30 -22
- package/src/radar-chart/index.ts +1 -1
- package/src/radar-chart/radar-chart.ts +16 -13
- package/src/radar-chart/radar-grid.ts +18 -13
- package/src/radar-chart/shared.ts +9 -2
- package/src/radial-chart/radial-chart.ts +3 -1
- package/src/radial-chart/shared.ts +30 -18
- package/dist/browser/chunks/chunk-R3Q5EE6E.js +0 -2
- package/dist/browser/chunks/chunk-R3Q5EE6E.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @motionscript/charts
|
|
2
2
|
|
|
3
|
+
## 0.1.1-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3050906: **Breaking:** every run of text a chart draws gets its own text style, the palette becomes `seriesFills`, and a chart has a background for the whole chart beside one for its grid.
|
|
8
|
+
|
|
9
|
+
- **`Types.typography(textStyle)`** (core, sdk): one text style as an entry (face, size, weight, style, spacing, paint). A partial is laid over the default or the value it replaces, so `{ fill }` recolours and keeps the rest; it tweens key by key. `describe()` reports `kind: "typography"` with its default.
|
|
10
|
+
- **Chart text** (charts): `foreground`, `muted`, `fontFamily`, `fontSize` and `fontWeight` are gone. Line and bar charts have `xLabelText`, `xTitleText`, `yLabelText`, `yTitleText`, `valueText` and `legendText`; a pie `labelText`, `valueText`, `centerText` and `legendText`; a radar `spokeText`; a radial `labelText` and `centerText`. Spacing that followed the one size now follows the text it sits beside.
|
|
11
|
+
- **Series fills**: `palette` is `seriesFills` (group `series`), each entry a fill that may stack paints.
|
|
12
|
+
- **Backgrounds**: `background` (group `background`) paints behind the whole chart on every chart; line, bar and radar charts add `gridBackground` for the plot (inside the web on a radar). A line or bar chart's old `background`, which painted the plot, is now `gridBackground`.
|
|
13
|
+
- **Bar corners**: `barRadius` is `barCornerRadius`, a `Types.cornerRadius` read as for a bar standing up (top pair at the far end, bottom pair at the base), with `barCornerStyle` (rounded or angled) beside it. `barWidth` reports itself as a percentage.
|
|
14
|
+
- Each chart's `migrate` hook (`migrateChartStyle`) carries a stored style across: the palette, the two inks and the shared type become the new fields as each chart derived them, a plot background becomes `gridBackground`, and a `barRadius` keeps rounding only the far end.
|
|
15
|
+
|
|
16
|
+
Migration: a stored document needs nothing done to it. Each chart's `migrate` hook converts its stored `style` (and a `to` command's) as the document opens: `palette` to `seriesFills`, `foreground`, `muted` and the font fields to the text fields as the chart derived them (titles 1.1× and a weight heavier, values as before), a line, bar or radar chart's `background` to `gridBackground`, and a number `barRadius` to `barCornerRadius` with only the top pair rounded. Code that sets these fields by hand, or a host that reads a chart's stored `style`, uses the new names; `migrateChartStyle(layout)` converts a style object the same way.
|
|
17
|
+
|
|
3
18
|
## 0.1.1-alpha.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -39,8 +39,10 @@ shelved and the box it is seeded at are the host's to keep. `lineChartDomains` a
|
|
|
39
39
|
is out.
|
|
40
40
|
|
|
41
41
|
The style kit exports `CHART_STYLE_FAMILY` (`"chart"`), `CHART_STYLE_PRESETS`,
|
|
42
|
-
`CHART_PALETTE_DEFAULT
|
|
43
|
-
`
|
|
42
|
+
`CHART_PALETTE_DEFAULT`, the shared field groups (`CHART_SERIES`,
|
|
43
|
+
`CHART_BACKGROUND`, `GRID_BACKGROUND`, `CARTESIAN_TEXT`, `LEGEND_TEXT`,
|
|
44
|
+
`CARTESIAN_GRID`, `CHART_LEGEND`) and `migrateChartStyle`, each chart's
|
|
45
|
+
`migrate` hook for styles written before 0.1.1-alpha.2.
|
|
44
46
|
|
|
45
47
|
## Nodes
|
|
46
48
|
|
|
@@ -65,17 +67,26 @@ is above 0.
|
|
|
65
67
|
|
|
66
68
|
Each chart has one look entry, `style`, and nothing else about colour or type:
|
|
67
69
|
no `theme`, no `showLegend`. Its fields come in groups, written grouped and read
|
|
68
|
-
flat (`state.style.
|
|
70
|
+
flat (`state.style.xLabelText`):
|
|
69
71
|
|
|
70
72
|
| Group | Fields | On |
|
|
71
73
|
|---|---|---|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
+
| series | `seriesFills`: a fill per series (per row on a pie or radial), cycled; each may stack paints | every chart |
|
|
75
|
+
| background | `background` (the whole chart), `gridBackground` (the plot, under the grid) | every chart; `gridBackground` on line, bar, radar |
|
|
76
|
+
| text | `xLabelText`, `xTitleText`, `yLabelText`, `yTitleText`, `valueText`, `legendText` | line, bar |
|
|
77
|
+
| text | `labelText`, `valueText`, `centerText`, `legendText` | pie |
|
|
78
|
+
| text | `spokeText`, `legendText` (radar); `labelText`, `centerText`, `legendText` (radial) | radar, radial |
|
|
74
79
|
| grid | `horizontalGrid` (a 2px `white/15` stroke), `verticalGrid` (none), `axisStroke` (none), `showXAxis`, `showYAxis` | line, bar |
|
|
75
80
|
| grid | `gridShape`, `gridLevels`, `gridStroke` (rings), `spokeStroke` (spokes), `spokeLabels` | radar |
|
|
76
|
-
| marks | the chart's own: `strokeWidth`, `curve`, `dots`, `area`, `
|
|
81
|
+
| marks | the chart's own: `strokeWidth`, `curve`, `dots`, `area`, `barCornerRadius`, `barCornerStyle`, `innerRadius`, `sweep`, ... | every chart |
|
|
77
82
|
| labels | `values` (line, bar), `labelPlacement` (pie), `ringLabels` (radial) | |
|
|
78
83
|
|
|
84
|
+
Every run of text is a `Types.typography` field (face, size, weight, style,
|
|
85
|
+
spacing, paint), so each is set like a text node; a partial (`{ fill }`) keeps the
|
|
86
|
+
rest of the field's default. The chart places and aligns the text itself.
|
|
87
|
+
`barCornerRadius` and `barCornerStyle` read as for a bar standing up: the top
|
|
88
|
+
pair round its far end, the bottom pair its base, turned with the bar.
|
|
89
|
+
|
|
79
90
|
A line is a stroke and an area is a fill: `horizontalGrid`, `verticalGrid`, `axisStroke`, `gridStroke`
|
|
80
91
|
and `spokeStroke` are `Types.stroke` entries (weight, colour, dash and caps; empty draws
|
|
81
92
|
nothing), and a radial's `track` is a `Types.fill` (empty draws no track). A series' `label`
|
|
@@ -87,14 +98,14 @@ previous style, and a key the chart does not have is dropped, so one style dress
|
|
|
87
98
|
every chart in the family.
|
|
88
99
|
|
|
89
100
|
`CHART_STYLE_PRESETS` (`midnight`, `paper`, `ember`, `neon`, `ocean`, `sunset`,
|
|
90
|
-
`pastel`, `mono`) are colour-only partials. Spread one into a style and add to it:
|
|
101
|
+
`pastel`, `mono`) are colour-only partials (each text field's `fill`, the rules, the backgrounds). Spread one into a style and add to it:
|
|
91
102
|
|
|
92
103
|
```ts
|
|
93
104
|
import { CHART_STYLE_PRESETS } from '@motionscript/charts';
|
|
94
105
|
|
|
95
106
|
const props = {
|
|
96
107
|
// ...data, series
|
|
97
|
-
style: { ...CHART_STYLE_PRESETS.paper, fontSize: 32, area: 'gradient' },
|
|
108
|
+
style: { ...CHART_STYLE_PRESETS.paper, legendText: { fontSize: 32 }, area: 'gradient' },
|
|
98
109
|
};
|
|
99
110
|
```
|
|
100
111
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { type DataRecord, type NodeOf, type OutOf, type Node2D, type Node2DProps as _Node2DProps, type Fill as _Fill, type FillResolved as _FillResolved, type Stroke as _Stroke, type StrokeResolved as _StrokeResolved, type StyleInput as _StyleInput, type StyleValues as _StyleValues } from "@motionscript/sdk";
|
|
1
|
+
import { type DataRecord, type NodeOf, type OutOf, type Node2D, type Node2DProps as _Node2DProps, type TextStyle as _TextStyle, type CornerRadiusResolved as _CornerRadiusResolved, type CornerStyleResolved as _CornerStyleResolved, type RectCornerRadius as _RectCornerRadius, type RectCornerStyle as _RectCornerStyle, type Fill as _Fill, type FillResolved as _FillResolved, type Stroke as _Stroke, type StrokeResolved as _StrokeResolved, type StyleInput as _StyleInput, type StyleValues as _StyleValues } from "@motionscript/sdk";
|
|
2
2
|
import { type AxisDomainConfig, type ResolvedAxisDomain } from "../kit/shared.js";
|
|
3
3
|
import { type BarSeries, type BarStack } from "./shared.js";
|
|
4
4
|
declare const BAR_STYLE: import("@motionscript/sdk").Type<_StyleInput<{
|
|
5
|
+
gridBackground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
6
|
+
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
7
|
+
} & {
|
|
5
8
|
legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
|
|
6
9
|
swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
|
|
7
10
|
} & {
|
|
@@ -11,21 +14,25 @@ declare const BAR_STYLE: import("@motionscript/sdk").Type<_StyleInput<{
|
|
|
11
14
|
showXAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
12
15
|
showYAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
13
16
|
} & {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
18
|
+
xLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
19
|
+
xTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
20
|
+
yLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
21
|
+
yTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
22
|
+
valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
17
23
|
} & {
|
|
18
|
-
|
|
19
|
-
foreground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
20
|
-
muted: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
21
|
-
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
24
|
+
seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
|
|
22
25
|
} & {
|
|
23
|
-
|
|
26
|
+
barCornerRadius: import("@motionscript/sdk").Type<_RectCornerRadius, _CornerRadiusResolved, false>;
|
|
27
|
+
barCornerStyle: import("@motionscript/sdk").Type<_RectCornerStyle, _CornerStyleResolved, false>;
|
|
24
28
|
barWidth: import("@motionscript/sdk").Type<number, number, false>;
|
|
25
29
|
barGap: import("@motionscript/sdk").Type<number, number, false>;
|
|
26
30
|
} & {
|
|
27
31
|
values: import("@motionscript/sdk").Type<"end" | "inside" | "none", "end" | "inside" | "none", false>;
|
|
28
32
|
}>, _StyleValues<{
|
|
33
|
+
gridBackground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
34
|
+
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
35
|
+
} & {
|
|
29
36
|
legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
|
|
30
37
|
swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
|
|
31
38
|
} & {
|
|
@@ -35,16 +42,17 @@ declare const BAR_STYLE: import("@motionscript/sdk").Type<_StyleInput<{
|
|
|
35
42
|
showXAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
36
43
|
showYAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
37
44
|
} & {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
46
|
+
xLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
47
|
+
xTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
48
|
+
yLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
49
|
+
yTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
50
|
+
valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
41
51
|
} & {
|
|
42
|
-
|
|
43
|
-
foreground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
44
|
-
muted: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
45
|
-
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
52
|
+
seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
|
|
46
53
|
} & {
|
|
47
|
-
|
|
54
|
+
barCornerRadius: import("@motionscript/sdk").Type<_RectCornerRadius, _CornerRadiusResolved, false>;
|
|
55
|
+
barCornerStyle: import("@motionscript/sdk").Type<_RectCornerStyle, _CornerStyleResolved, false>;
|
|
48
56
|
barWidth: import("@motionscript/sdk").Type<number, number, false>;
|
|
49
57
|
barGap: import("@motionscript/sdk").Type<number, number, false>;
|
|
50
58
|
} & {
|
|
@@ -85,6 +93,9 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
|
|
|
85
93
|
readonly valueAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
|
|
86
94
|
readonly categoryAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
|
|
87
95
|
readonly style: import("@motionscript/sdk").Type<_StyleInput<{
|
|
96
|
+
gridBackground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
97
|
+
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
98
|
+
} & {
|
|
88
99
|
legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
|
|
89
100
|
swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
|
|
90
101
|
} & {
|
|
@@ -94,21 +105,25 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
|
|
|
94
105
|
showXAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
95
106
|
showYAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
96
107
|
} & {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
108
|
+
legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
109
|
+
xLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
110
|
+
xTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
111
|
+
yLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
112
|
+
yTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
113
|
+
valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
100
114
|
} & {
|
|
101
|
-
|
|
102
|
-
foreground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
103
|
-
muted: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
104
|
-
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
115
|
+
seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
|
|
105
116
|
} & {
|
|
106
|
-
|
|
117
|
+
barCornerRadius: import("@motionscript/sdk").Type<_RectCornerRadius, _CornerRadiusResolved, false>;
|
|
118
|
+
barCornerStyle: import("@motionscript/sdk").Type<_RectCornerStyle, _CornerStyleResolved, false>;
|
|
107
119
|
barWidth: import("@motionscript/sdk").Type<number, number, false>;
|
|
108
120
|
barGap: import("@motionscript/sdk").Type<number, number, false>;
|
|
109
121
|
} & {
|
|
110
122
|
values: import("@motionscript/sdk").Type<"end" | "inside" | "none", "end" | "inside" | "none", false>;
|
|
111
123
|
}>, _StyleValues<{
|
|
124
|
+
gridBackground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
125
|
+
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
126
|
+
} & {
|
|
112
127
|
legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
|
|
113
128
|
swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
|
|
114
129
|
} & {
|
|
@@ -118,16 +133,17 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
|
|
|
118
133
|
showXAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
119
134
|
showYAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
120
135
|
} & {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
136
|
+
legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
137
|
+
xLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
138
|
+
xTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
139
|
+
yLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
140
|
+
yTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
141
|
+
valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
124
142
|
} & {
|
|
125
|
-
|
|
126
|
-
foreground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
127
|
-
muted: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
128
|
-
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
143
|
+
seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
|
|
129
144
|
} & {
|
|
130
|
-
|
|
145
|
+
barCornerRadius: import("@motionscript/sdk").Type<_RectCornerRadius, _CornerRadiusResolved, false>;
|
|
146
|
+
barCornerStyle: import("@motionscript/sdk").Type<_RectCornerStyle, _CornerStyleResolved, false>;
|
|
131
147
|
barWidth: import("@motionscript/sdk").Type<number, number, false>;
|
|
132
148
|
barGap: import("@motionscript/sdk").Type<number, number, false>;
|
|
133
149
|
} & {
|
|
@@ -168,6 +184,9 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
|
|
|
168
184
|
readonly valueAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
|
|
169
185
|
readonly categoryAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
|
|
170
186
|
readonly style: import("@motionscript/sdk").Type<_StyleInput<{
|
|
187
|
+
gridBackground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
188
|
+
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
189
|
+
} & {
|
|
171
190
|
legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
|
|
172
191
|
swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
|
|
173
192
|
} & {
|
|
@@ -177,21 +196,25 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
|
|
|
177
196
|
showXAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
178
197
|
showYAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
179
198
|
} & {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
199
|
+
legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
200
|
+
xLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
201
|
+
xTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
202
|
+
yLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
203
|
+
yTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
204
|
+
valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
183
205
|
} & {
|
|
184
|
-
|
|
185
|
-
foreground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
186
|
-
muted: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
187
|
-
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
206
|
+
seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
|
|
188
207
|
} & {
|
|
189
|
-
|
|
208
|
+
barCornerRadius: import("@motionscript/sdk").Type<_RectCornerRadius, _CornerRadiusResolved, false>;
|
|
209
|
+
barCornerStyle: import("@motionscript/sdk").Type<_RectCornerStyle, _CornerStyleResolved, false>;
|
|
190
210
|
barWidth: import("@motionscript/sdk").Type<number, number, false>;
|
|
191
211
|
barGap: import("@motionscript/sdk").Type<number, number, false>;
|
|
192
212
|
} & {
|
|
193
213
|
values: import("@motionscript/sdk").Type<"end" | "inside" | "none", "end" | "inside" | "none", false>;
|
|
194
214
|
}>, _StyleValues<{
|
|
215
|
+
gridBackground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
216
|
+
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
217
|
+
} & {
|
|
195
218
|
legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
|
|
196
219
|
swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
|
|
197
220
|
} & {
|
|
@@ -201,16 +224,17 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
|
|
|
201
224
|
showXAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
202
225
|
showYAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
203
226
|
} & {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
227
|
+
legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
228
|
+
xLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
229
|
+
xTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
230
|
+
yLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
231
|
+
yTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
232
|
+
valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
207
233
|
} & {
|
|
208
|
-
|
|
209
|
-
foreground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
210
|
-
muted: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
211
|
-
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
234
|
+
seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
|
|
212
235
|
} & {
|
|
213
|
-
|
|
236
|
+
barCornerRadius: import("@motionscript/sdk").Type<_RectCornerRadius, _CornerRadiusResolved, false>;
|
|
237
|
+
barCornerStyle: import("@motionscript/sdk").Type<_RectCornerStyle, _CornerStyleResolved, false>;
|
|
214
238
|
barWidth: import("@motionscript/sdk").Type<number, number, false>;
|
|
215
239
|
barGap: import("@motionscript/sdk").Type<number, number, false>;
|
|
216
240
|
} & {
|
|
@@ -236,6 +260,9 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
|
|
|
236
260
|
readonly valueAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
|
|
237
261
|
readonly categoryAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
|
|
238
262
|
readonly style: import("@motionscript/sdk").Type<_StyleInput<{
|
|
263
|
+
gridBackground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
264
|
+
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
265
|
+
} & {
|
|
239
266
|
legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
|
|
240
267
|
swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
|
|
241
268
|
} & {
|
|
@@ -245,21 +272,25 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
|
|
|
245
272
|
showXAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
246
273
|
showYAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
247
274
|
} & {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
275
|
+
legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
276
|
+
xLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
277
|
+
xTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
278
|
+
yLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
279
|
+
yTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
280
|
+
valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
251
281
|
} & {
|
|
252
|
-
|
|
253
|
-
foreground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
254
|
-
muted: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
255
|
-
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
282
|
+
seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
|
|
256
283
|
} & {
|
|
257
|
-
|
|
284
|
+
barCornerRadius: import("@motionscript/sdk").Type<_RectCornerRadius, _CornerRadiusResolved, false>;
|
|
285
|
+
barCornerStyle: import("@motionscript/sdk").Type<_RectCornerStyle, _CornerStyleResolved, false>;
|
|
258
286
|
barWidth: import("@motionscript/sdk").Type<number, number, false>;
|
|
259
287
|
barGap: import("@motionscript/sdk").Type<number, number, false>;
|
|
260
288
|
} & {
|
|
261
289
|
values: import("@motionscript/sdk").Type<"end" | "inside" | "none", "end" | "inside" | "none", false>;
|
|
262
290
|
}>, _StyleValues<{
|
|
291
|
+
gridBackground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
292
|
+
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
293
|
+
} & {
|
|
263
294
|
legend: import("@motionscript/sdk").Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
|
|
264
295
|
swatch: import("@motionscript/sdk").Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
|
|
265
296
|
} & {
|
|
@@ -269,16 +300,17 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
|
|
|
269
300
|
showXAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
270
301
|
showYAxis: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
271
302
|
} & {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
303
|
+
legendText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
304
|
+
xLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
305
|
+
xTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
306
|
+
yLabelText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
307
|
+
yTitleText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
308
|
+
valueText: import("@motionscript/sdk").Type<_TextStyle, _TextStyle, false>;
|
|
275
309
|
} & {
|
|
276
|
-
|
|
277
|
-
foreground: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
278
|
-
muted: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
279
|
-
background: import("@motionscript/sdk").Type<_Fill, _FillResolved[], false>;
|
|
310
|
+
seriesFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
|
|
280
311
|
} & {
|
|
281
|
-
|
|
312
|
+
barCornerRadius: import("@motionscript/sdk").Type<_RectCornerRadius, _CornerRadiusResolved, false>;
|
|
313
|
+
barCornerStyle: import("@motionscript/sdk").Type<_RectCornerStyle, _CornerStyleResolved, false>;
|
|
282
314
|
barWidth: import("@motionscript/sdk").Type<number, number, false>;
|
|
283
315
|
barGap: import("@motionscript/sdk").Type<number, number, false>;
|
|
284
316
|
} & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-chart.d.ts","sourceRoot":"","sources":["../../src/bar-chart/bar-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,KAAK,EAEV,KAAK,MAAM,EACX,KAAK,WAAW,IAAI,YAAY,EAChC,KAAK,IAAI,IAAI,KAAK,EAClB,KAAK,YAAY,IAAI,aAAa,EAClC,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,cAAc,IAAI,eAAe,EAEtC,KAAK,UAAU,IAAI,WAAW,EAC9B,KAAK,WAAW,IAAI,YAAY,EACjC,MAAM,mBAAmB,CAAA;AAS1B,OAAO,EAWL,KAAK,gBAAgB,EAErB,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"bar-chart.d.ts","sourceRoot":"","sources":["../../src/bar-chart/bar-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,KAAK,EAEV,KAAK,MAAM,EACX,KAAK,WAAW,IAAI,YAAY,EAChC,KAAK,SAAS,IAAI,UAAU,EAC5B,KAAK,oBAAoB,IAAI,qBAAqB,EAClD,KAAK,mBAAmB,IAAI,oBAAoB,EAChD,KAAK,gBAAgB,IAAI,iBAAiB,EAC1C,KAAK,eAAe,IAAI,gBAAgB,EACxC,KAAK,IAAI,IAAI,KAAK,EAClB,KAAK,YAAY,IAAI,aAAa,EAClC,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,cAAc,IAAI,eAAe,EAEtC,KAAK,UAAU,IAAI,WAAW,EAC9B,KAAK,WAAW,IAAI,YAAY,EACjC,MAAM,mBAAmB,CAAA;AAS1B,OAAO,EAWL,KAAK,gBAAgB,EAErB,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAA;AAkBtB,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,QAAQ,EACd,MAAM,UAAU,CAAA;AAEjB,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAId,CAAA;AAED,oCAAoC;AACpC,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAEnD,sDAAsD;AACtD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,CAAA;IAC5B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;IACxB,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAA;CACrC;AAED,iEAAiE;AACjE,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAA;AAsB/C,gHAAgH;AAChH,wBAAgB,cAAc,CAAC,CAAC,EAAE,cAAc,GAAG,cAAc,CAOhE;AA8HD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ;;;;IAOjB,8GAA8G;;IAE9G,mHAAmH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKnH,gFAAgF;;IAEhF,wFAAwF;;;IAGxF,6HAA6H;;IAE7H,4GAA4G;;;;;;;;;;;;;;;;;;;;;IAd5G,8GAA8G;;IAE9G,mHAAmH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKnH,gFAAgF;;IAEhF,wFAAwF;;;IAGxF,6HAA6H;;IAE7H,4GAA4G;;;;;;IAd5G,8GAA8G;;IAE9G,mHAAmH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKnH,gFAAgF;;IAEhF,wFAAwF;;;IAGxF,6HAA6H;;IAE7H,4GAA4G;;;;;;;;;;;;;;;;;0BAkO9G,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAA"}
|
|
@@ -7,12 +7,12 @@ import { SERIES_ARG, asParts, fresh } from "../kit/entries.js";
|
|
|
7
7
|
import { HorizontalAxis } from "../kit/horizontal-axis.js";
|
|
8
8
|
import { DEFAULT_MARKERS, ENTER_SHARE, beats, legendAway } from "../kit/motion.js";
|
|
9
9
|
import { SPOTLIGHT_DIM, formatMarker, lerpAxisDomain, lerpAxisEntry, markerStep, markerValues, niceTicks, num, resolveAxisDomain, settleAxisDomain, } from "../kit/shared.js";
|
|
10
|
-
import { CARTESIAN_GRID,
|
|
10
|
+
import { CARTESIAN_GRID, CARTESIAN_TEXT, CHART_LEGEND, CHART_SERIES, CHART_STYLE_FAMILY, CHART_STYLE_PRESETS, GRID_BACKGROUND, axisConfigOf, migrateChartStyle, legendConfigOf, seriesFill, valueText, } from "../kit/style.js";
|
|
11
11
|
import { VerticalAxis, axisPads } from "../kit/vertical-axis.js";
|
|
12
12
|
import { CategoryAxis, slotCentre } from "./category-axis.js";
|
|
13
13
|
import { ChartBars } from "./chart-bars.js";
|
|
14
14
|
import { BAR_LABELS, BAR_MARKS, barCategories, barSpans, resolveBarScale, } from "./shared.js";
|
|
15
|
-
const BAR_STYLE = Types.style(CHART_STYLE_FAMILY, {
|
|
15
|
+
const BAR_STYLE = Types.style(CHART_STYLE_FAMILY, { series: CHART_SERIES, background: GRID_BACKGROUND, text: CARTESIAN_TEXT, grid: CARTESIAN_GRID, marks: BAR_MARKS, labels: BAR_LABELS, legend: CHART_LEGEND }, { presets: CHART_STYLE_PRESETS });
|
|
16
16
|
function drawnValue(s, domain) {
|
|
17
17
|
const divisions = (domain.ticks?.length ?? DEFAULT_MARKERS) - 1;
|
|
18
18
|
const range = resolveBarScale(s.data, s.series, s.stack, domain.range, divisions);
|
|
@@ -108,6 +108,7 @@ function seriesBars(s, index, plot) {
|
|
|
108
108
|
from: valueToPx(domain, along, span.from),
|
|
109
109
|
to: valueToPx(domain, along, span.to),
|
|
110
110
|
round: span.outer,
|
|
111
|
+
grounded: !stacked || span.from === 0,
|
|
111
112
|
caption,
|
|
112
113
|
};
|
|
113
114
|
});
|
|
@@ -193,6 +194,7 @@ export const BarChart = component2d({
|
|
|
193
194
|
weights: (state) => state.series.map((s) => ((s.enabled ?? true) ? 1 : 0)),
|
|
194
195
|
showing: (state) => state.series.map((s) => s.enabled ?? true),
|
|
195
196
|
},
|
|
197
|
+
migrate: { style: migrateChartStyle("cartesian") },
|
|
196
198
|
allowedChildren: [],
|
|
197
199
|
children: (state) => {
|
|
198
200
|
const style = () => state.style;
|
|
@@ -262,12 +264,13 @@ export const BarChart = component2d({
|
|
|
262
264
|
baseline: () => valueToPx(domain(), runs(state, plotSize()).along, baselineValue(domain())),
|
|
263
265
|
horizontal,
|
|
264
266
|
fill: () => seriesFill(style(), s, i),
|
|
265
|
-
cornerRadius: () => style().
|
|
267
|
+
cornerRadius: () => style().barCornerRadius,
|
|
268
|
+
cornerStyle: () => style().barCornerStyle,
|
|
266
269
|
growth: () => state.growth,
|
|
267
270
|
dims: () => categoryDims(state),
|
|
268
271
|
// A figure past a stack's end prints the stack's total; a percent stack has none worth printing, so prints its shares inside.
|
|
269
272
|
values: () => (built.values === "end" && state.stack === "percent" ? "inside" : built.values),
|
|
270
|
-
valueStyle: () =>
|
|
273
|
+
valueStyle: () => valueText(style()),
|
|
271
274
|
enabled: () => state.showing[i] ?? (s.enabled ?? true),
|
|
272
275
|
}));
|
|
273
276
|
const legendAt = built.legend;
|
|
@@ -286,7 +289,7 @@ export const BarChart = component2d({
|
|
|
286
289
|
plot = new Rect({
|
|
287
290
|
children: [
|
|
288
291
|
new ChartCanvas({
|
|
289
|
-
fill: () => style().
|
|
292
|
+
fill: () => style().gridBackground,
|
|
290
293
|
xGridStroke: () => style().verticalGrid,
|
|
291
294
|
yGridStroke: () => style().horizontalGrid,
|
|
292
295
|
xMarkers: horizontal ? () => domain().ticks : boundaries,
|
|
@@ -302,6 +305,7 @@ export const BarChart = component2d({
|
|
|
302
305
|
});
|
|
303
306
|
return asParts([
|
|
304
307
|
cartesianFrame({
|
|
308
|
+
background: () => style().background,
|
|
305
309
|
left,
|
|
306
310
|
ghost,
|
|
307
311
|
plot,
|