@ac-kit/model-chart 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +117 -0
- package/README.md +68 -4
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/render/capabilities.d.ts +13 -0
- package/dist/render/capabilities.d.ts.map +1 -1
- package/dist/render/capabilities.js +8 -0
- package/dist/render/capabilities.js.map +1 -1
- package/dist/resolve/__fixtures__/vega-lite-views.json +4727 -0
- package/dist/resolve/_guides.d.ts +4 -1
- package/dist/resolve/_guides.d.ts.map +1 -1
- package/dist/resolve/_guides.js +12 -3
- package/dist/resolve/_guides.js.map +1 -1
- package/dist/resolve/color-scheme.d.ts +21 -0
- package/dist/resolve/color-scheme.d.ts.map +1 -0
- package/dist/resolve/color-scheme.js +42 -0
- package/dist/resolve/color-scheme.js.map +1 -0
- package/dist/resolve/mark-geometry.d.ts +154 -0
- package/dist/resolve/mark-geometry.d.ts.map +1 -0
- package/dist/resolve/mark-geometry.js +517 -0
- package/dist/resolve/mark-geometry.js.map +1 -0
- package/dist/resolve/scale-tick-labels.d.ts +39 -0
- package/dist/resolve/scale-tick-labels.d.ts.map +1 -0
- package/dist/resolve/scale-tick-labels.js +158 -0
- package/dist/resolve/scale-tick-labels.js.map +1 -0
- package/dist/resolve/scale.d.ts +10 -2
- package/dist/resolve/scale.d.ts.map +1 -1
- package/dist/resolve/scale.js +24 -4
- package/dist/resolve/scale.js.map +1 -1
- package/dist/resolve/view-types.d.ts +6 -3
- package/dist/resolve/view-types.d.ts.map +1 -1
- package/dist/resolve/view.d.ts.map +1 -1
- package/dist/resolve/view.js +88 -0
- package/dist/resolve/view.js.map +1 -1
- package/dist/spec/channel.d.ts +1 -1
- package/dist/spec/channel.d.ts.map +1 -1
- package/dist/spec/channel.js +2 -0
- package/dist/spec/channel.js.map +1 -1
- package/dist/testing/__fixtures__/vega-geometry.json +1434 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +2 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/vega-lite-cases.d.ts +164 -0
- package/dist/testing/vega-lite-cases.d.ts.map +1 -0
- package/dist/testing/vega-lite-cases.js +143 -0
- package/dist/testing/vega-lite-cases.js.map +1 -0
- package/package.json +18 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,122 @@
|
|
|
1
1
|
# @ac-kit/model-chart
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5c203e7: `RendererCapabilities.coordMarks` maps a coordinate system to the marks a
|
|
8
|
+
renderer draws in it: a spec with a mark its coordinate system leaves out
|
|
9
|
+
(`mark "polygon" in polar coordinates`) falls back or declines like any
|
|
10
|
+
other unsupported feature, instead of reaching a renderer that cannot draw
|
|
11
|
+
it. A coordinate system the map leaves out, and a renderer that does not
|
|
12
|
+
declare the map, keep every mark of `marks`.
|
|
13
|
+
|
|
14
|
+
Theta and radius axes now default to gridlines (spokes and rings), discrete
|
|
15
|
+
or continuous; `axis.grid: false` still turns them off. A nominal or ordinal
|
|
16
|
+
field on theta or radius now gets a position scale as on x and y — `band`
|
|
17
|
+
for bars, rectangles and arcs, `point` for the other marks — instead of an
|
|
18
|
+
`ordinal` one, so radial bars and radars of categories have their places.
|
|
19
|
+
|
|
20
|
+
`@ac-kit/model-chart/testing` adds two polar Vega-Lite cases, `donut` and
|
|
21
|
+
`radial`, with the sectors Vega drew (`VegaLiteCase.arcs`), and
|
|
22
|
+
`VEGA_HIERARCHY_CASES` with `vegaHierarchyFrame()`: Vega's squarified
|
|
23
|
+
treemap, partition, tidy tree and cluster over one tree, as fractions of the
|
|
24
|
+
layout box.
|
|
25
|
+
- 5c203e7: `RendererCapabilities.dimensionMarks` declares the marks a renderer draws in
|
|
26
|
+
each dimension: a spec encoding `z` with a mark its renderer draws only in 2D
|
|
27
|
+
(an `area`, say) now declines with the reason `mark "area" in 3D` and falls
|
|
28
|
+
back along its chain, instead of reaching the renderer.
|
|
29
|
+
- 5c203e7: `@ac-kit/model-chart/testing` adds maps recorded from Vega-Lite
|
|
30
|
+
(`VEGA_LITE_MAPS`): eight cities and three regions (one across the
|
|
31
|
+
antimeridian, one with a hole) through Equal Earth, Mercator, Natural Earth, a
|
|
32
|
+
rotated equirectangular, a conformal conic, Albers and two globes, each with
|
|
33
|
+
the places and shape bounds Vega-Lite drew, fitted to the data; and their
|
|
34
|
+
frames (`vegaLiteMapCitiesFrame`, `vegaLiteMapRegionsFrame`), for a renderer
|
|
35
|
+
of geographic panels to check its maps against.
|
|
36
|
+
- 5c203e7: Mark geometry, tick labels and colour scheme names for renderers, in the
|
|
37
|
+
panel's unit square as the rest of the pipeline.
|
|
38
|
+
|
|
39
|
+
- `layerPositions(layer, channel, { part, edge })`: a position channel's
|
|
40
|
+
normalised position per mark — band and point scales at the `start`,
|
|
41
|
+
`center` or `end` of their band, `xOffset`/`yOffset` fields laid across the
|
|
42
|
+
parent's band (a point parent's step, a continuous parent's
|
|
43
|
+
`CONTINUOUS_BAND_FILL` of its least gap), a constant on its axis' scale, an
|
|
44
|
+
offset without a parent across the plot; `undefined` without a position.
|
|
45
|
+
`layerChannelNumbers` gives a channel's numbers in data units (a grid's
|
|
46
|
+
lattice at cell centres, shifted by `edge` cells), `scaleValuePosition` one
|
|
47
|
+
value's position, `layerBaseline` where a value axis' bars start (0 when the
|
|
48
|
+
domain holds it, else its low end).
|
|
49
|
+
- `layerBoxes(layer)`: the box of every `bar`, `rect` and `arc` mark drawn
|
|
50
|
+
(`rows`, `boxes` as `x0, y0, x1, y1`, `grows`): bands, `2` channels, bars
|
|
51
|
+
from their baseline, a grid's cells, a continuous rect's share of the least
|
|
52
|
+
gap; marks with a missing side, or a NaN grid cell, left out; `{ rows }`
|
|
53
|
+
limits it to the marks shown, the least gap taken among them.
|
|
54
|
+
`layerSegments(layer)` gives every rule's segment. `polarSpaceLayer(layer)`
|
|
55
|
+
reads theta and radius as x and y so both apply to polar panels.
|
|
56
|
+
- `scaleTickPositions(scale, ticks)` places the ticks `scaleTicks` returns
|
|
57
|
+
(band centres, ordinal slots, thresholds along a binning domain) and
|
|
58
|
+
`scaleTickFormatter(scale, ticks, { locale, timeZone })` labels them: the
|
|
59
|
+
field's own format, numeric ticks at their step's precision, time ticks at
|
|
60
|
+
their unit with d3's multi-scale labels ("2024", "Feb", "Mar 12").
|
|
61
|
+
- `namedColorScheme(name)`: the `@ac-kit/math-color` palette or ramp a
|
|
62
|
+
`ColorSchemeSpec.name` names, compared without case or separators, Vega's
|
|
63
|
+
and ColorBrewer's short names included (`"rdbu"`, `"ylgnbu"`); `undefined`
|
|
64
|
+
for an unknown name. model-chart now depends on `@ac-kit/math-color`.
|
|
65
|
+
- 5c203e7: Grouped bars within one band: the `xOffset` and `yOffset` channels (Vega-Lite
|
|
66
|
+
5's) place a mark within the band of `x` or `y`. Each resolves a scale of its
|
|
67
|
+
own (`ScaleChannel` gains `"xOffset"` and `"yOffset"`): a band scale for a
|
|
68
|
+
nominal or ordinal field, its sub-bands touching unless a `padding` is given,
|
|
69
|
+
or a continuous one that jitters marks; offsets get no guide. A categorical
|
|
70
|
+
axis whose offset is encoded takes a band scale whatever the mark
|
|
71
|
+
(`ScaleInput.offset`). A renderer that does not declare the channels declines
|
|
72
|
+
the spec with `channel "xOffset"` and falls back as before.
|
|
73
|
+
- 5c203e7: In cartesian coordinates, a layer's `geometry` field is planar: the x and y
|
|
74
|
+
coordinates of its shapes now join the continuous `x` and `y` domains of its
|
|
75
|
+
panel, so polygons layered with points, lines or other marks are drawn whole
|
|
76
|
+
instead of being cut at the other layers' extent.
|
|
77
|
+
- 5c203e7: `@ac-kit/model-chart/testing` holds Vega-Lite's examples as Vega-Lite and
|
|
78
|
+
Vega computed them — each case's spec, its rows and its scale domains
|
|
79
|
+
(`VEGA_LITE_CASES`) — and `vegaLiteCaseFrame(name)`, the rows as a data
|
|
80
|
+
frame, so a renderer of model-chart can check what it draws against them.
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [5c203e7]
|
|
85
|
+
- Updated dependencies [5c203e7]
|
|
86
|
+
- Updated dependencies [5c203e7]
|
|
87
|
+
- Updated dependencies [5c203e7]
|
|
88
|
+
- Updated dependencies [5c203e7]
|
|
89
|
+
- Updated dependencies [5c203e7]
|
|
90
|
+
- Updated dependencies [5c203e7]
|
|
91
|
+
- Updated dependencies [5c203e7]
|
|
92
|
+
- Updated dependencies [5c203e7]
|
|
93
|
+
- Updated dependencies [5c203e7]
|
|
94
|
+
- Updated dependencies [5c203e7]
|
|
95
|
+
- Updated dependencies [5c203e7]
|
|
96
|
+
- Updated dependencies [5c203e7]
|
|
97
|
+
- Updated dependencies [5c203e7]
|
|
98
|
+
- Updated dependencies [5c203e7]
|
|
99
|
+
- Updated dependencies [5c203e7]
|
|
100
|
+
- Updated dependencies [5c203e7]
|
|
101
|
+
- Updated dependencies [5c203e7]
|
|
102
|
+
- Updated dependencies [5c203e7]
|
|
103
|
+
- Updated dependencies [5c203e7]
|
|
104
|
+
- Updated dependencies [5c203e7]
|
|
105
|
+
- Updated dependencies [5c203e7]
|
|
106
|
+
- Updated dependencies [5c203e7]
|
|
107
|
+
- Updated dependencies [5c203e7]
|
|
108
|
+
- Updated dependencies [5c203e7]
|
|
109
|
+
- @ac-kit/algo@0.7.0
|
|
110
|
+
- @ac-kit/core@0.14.0
|
|
111
|
+
- @ac-kit/math-color@0.4.0
|
|
112
|
+
- @ac-kit/math-geometry@0.5.0
|
|
113
|
+
- @ac-kit/math-linear@0.5.0
|
|
114
|
+
- @ac-kit/math-map-projection@0.3.0
|
|
115
|
+
- @ac-kit/math-scalar@0.5.0
|
|
116
|
+
- @ac-kit/math-stats@0.7.0
|
|
117
|
+
- @ac-kit/math-graph@0.2.1
|
|
118
|
+
- @ac-kit/model-dataset@0.3.1
|
|
119
|
+
|
|
3
120
|
## 0.3.0
|
|
4
121
|
|
|
5
122
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -29,6 +29,12 @@ the primitive rather than the picture is what keeps the catalogue open: a chart
|
|
|
29
29
|
nobody anticipated is a combination of marks and channels that already exist,
|
|
30
30
|
not a new type someone has to add.
|
|
31
31
|
|
|
32
|
+
A grouped bar chart is `mark: "bar"` with a categorical `x` and the
|
|
33
|
+
subcategory on `xOffset` (or `y` and `yOffset`): the offset has a band scale of
|
|
34
|
+
its own, its sub-bands touching, that a renderer lays across each band of the
|
|
35
|
+
parent axis; it has no guide, the parent's axis and the colour legend telling
|
|
36
|
+
the bars apart. A quantitative offset jitters marks within the band.
|
|
37
|
+
|
|
32
38
|
## Contents
|
|
33
39
|
|
|
34
40
|
| Group | Exports |
|
|
@@ -45,9 +51,11 @@ not a new type someone has to add.
|
|
|
45
51
|
| Rendering | `RendererCapabilities`, `canRender`, `resolvePlot`, `unsupportedFeatures` |
|
|
46
52
|
| Resolve | `resolveScale`, `scaleChannelOf`, `ScaleInput`, `ResolvedScale` and its kinds, `ResolveOptions`; the scale kernels `scaleTransform`, `scaleNormalizeArray`, `scaleDiscreteIndexArray`, `scaleClassIndexArray`, `scaleBandGeometry`; the ticks `scaleTicks`, `ScaleTicks`, `ScaleTick`, `ScaleTicksOptions` |
|
|
47
53
|
| View | `resolveView`, `ResolveViewResult`, `ResolvedView`, `ResolvedNode`, `ResolvedPanel`, `ResolvedLayer`, `ResolvedChannel`, `ResolvedGuide`, `ResolvedCoord`, `ResolvedTable`; `layerSeries`, `LayerSeries` |
|
|
54
|
+
| Mark geometry | `layerPositions`, `layerChannelNumbers`, `layerBaseline`, `layerBoxes`, `LayerBoxes`, `LayerBoxesOptions`, `layerSegments`, `LayerSegments`, `polarSpaceLayer`, `scaleValuePosition`, `BandPart`, `CONTINUOUS_BAND_FILL`; tick labels `scaleTickPositions`, `scaleTickFormatter`, `ScaleTickFormatOptions`; colour schemes `namedColorScheme`, `NamedColorScheme` |
|
|
48
55
|
| Transforms (run) | `applyTransforms`, `ApplyTransformsOptions`, `RESOLVABLE_TRANSFORMS` |
|
|
49
56
|
| `./layout` | `layoutHierarchy`, `layoutNetwork`, `layoutNetworkAsync`, `ChartLayoutOptions` |
|
|
50
57
|
| `./geographic` | `projectGeographicLayer`, `GeographicLayerProjection`, `GeographicShape` |
|
|
58
|
+
| `./testing` | `VEGA_LITE_CASES`, `vegaLiteCaseFrame`, `VegaLiteCase`, `VegaLiteCaseName`, `VegaLiteArc`; `VEGA_HIERARCHY_CASES`, `vegaHierarchyFrame`, `VegaHierarchyCase`, `VegaHierarchyCaseName`, `VegaHierarchyNode`; `VEGA_LITE_MAPS`, `vegaLiteMapCitiesFrame`, `vegaLiteMapRegionsFrame`, `VegaLiteMapCase`, `VegaLiteMapCaseName`, `VegaLiteMapPoint`, `VegaLiteMapBounds`, `VegaLiteMapRegion` |
|
|
51
59
|
|
|
52
60
|
## Nothing here is in output units
|
|
53
61
|
|
|
@@ -69,10 +77,12 @@ result is the signal to apply the universal fallback and render the underlying
|
|
|
69
77
|
frame as a table. Every spec carries a `description` so a renderer that declines
|
|
70
78
|
still has something to say.
|
|
71
79
|
|
|
72
|
-
`dimensions`, `projections` and `
|
|
73
|
-
restriction, so a renderer that predates them is unaffected. Declared,
|
|
74
|
-
`unsupportedFeatures` report `dimension 3`, `projection albers-usa
|
|
75
|
-
`layout pack` for a spec that needs
|
|
80
|
+
`dimensions`, `projections`, `layouts` and `coordMarks` are optional: absent
|
|
81
|
+
means no restriction, so a renderer that predates them is unaffected. Declared,
|
|
82
|
+
they make `unsupportedFeatures` report `dimension 3`, `projection albers-usa`,
|
|
83
|
+
`layout pack` or `mark "polygon" in polar coordinates` for a spec that needs
|
|
84
|
+
what the renderer lacks. `coordMarks` maps a coordinate system to the marks
|
|
85
|
+
drawn in it; one it leaves out takes every mark of `marks`.
|
|
76
86
|
|
|
77
87
|
## Named data sources
|
|
78
88
|
|
|
@@ -166,6 +176,24 @@ owns (0 B per pass), then to pixels, cells or radians itself; band and point
|
|
|
166
176
|
scales give `scaleBandGeometry`, binning scales `scaleClassIndexArray`, and
|
|
167
177
|
`scaleTicks` the ticks of an axis, including those of a zoomed range.
|
|
168
178
|
|
|
179
|
+
### Placing marks
|
|
180
|
+
|
|
181
|
+
The geometry every renderer would otherwise repeat is resolved here too, still
|
|
182
|
+
in the panel's unit square. `layerPositions(layer, channel, { part })` gives a
|
|
183
|
+
position channel per mark — band and point scales at the start, centre or end
|
|
184
|
+
of their band, offsets (`xOffset`, `yOffset`) laid across the parent's band, a
|
|
185
|
+
constant on its axis' scale, a grid's lattice at cell centres or edges.
|
|
186
|
+
`layerBoxes` gives the box of every bar, rect and arc (a bar grows from
|
|
187
|
+
`layerBaseline`, a rect without its `2` channel spans
|
|
188
|
+
`CONTINUOUS_BAND_FILL` of the least gap; `{ rows }` keeps only the marks a
|
|
189
|
+
legend shows), `layerSegments` every rule;
|
|
190
|
+
`polarSpaceLayer` reads a polar layer's theta and radius as x and y so the
|
|
191
|
+
same geometry applies. `scaleTickPositions` and `scaleTickFormatter` place
|
|
192
|
+
and label the ticks `scaleTicks` returns (d3's multi-scale labels for time),
|
|
193
|
+
and `namedColorScheme` finds a spec's scheme name among
|
|
194
|
+
`@ac-kit/math-color`'s, Vega's short names included. `@ac-kit/format-svg/chart`
|
|
195
|
+
draws with these alone.
|
|
196
|
+
|
|
169
197
|
### Time zones
|
|
170
198
|
|
|
171
199
|
Domains are epoch milliseconds and never depend on a zone. The zone
|
|
@@ -213,3 +241,39 @@ fields naming each row's layer. With `series`, every offset matches layers by
|
|
|
213
241
|
key, so a layer sits at the same height in every stack and counts as zero
|
|
214
242
|
where it has no row. Layers stack bottom up in the order their keys first
|
|
215
243
|
appear.
|
|
244
|
+
|
|
245
|
+
## Testing a renderer against Vega-Lite
|
|
246
|
+
|
|
247
|
+
`@ac-kit/model-chart/testing` holds Vega-Lite's examples as Vega-Lite 5.23
|
|
248
|
+
compiled them and Vega 5.33 ran them: each case's spec, its rows and the
|
|
249
|
+
scale domains Vega computed, and for the polar cases (`donut`, `radial`) the
|
|
250
|
+
sectors Vega drew (`arcs`). A renderer translates a case to a model-chart spec
|
|
251
|
+
and checks the axes, legends and marks it draws against them.
|
|
252
|
+
`VEGA_HIERARCHY_CASES` holds Vega's `treemap`, `partition` and `tree` (tidy and
|
|
253
|
+
cluster) transforms over one tree (`vegaHierarchyFrame()`), as fractions of
|
|
254
|
+
the layout box, for checking a hierarchy's nodes. `VEGA_LITE_MAPS` holds maps
|
|
255
|
+
of eight cities and three regions (one across the antimeridian, one with a
|
|
256
|
+
hole) in eight projections, globes included, with the places and shape bounds
|
|
257
|
+
Vega-Lite drew as fractions of the box of everything drawn
|
|
258
|
+
(`vegaLiteMapCitiesFrame(name)`, `vegaLiteMapRegionsFrame(name)`), for checking
|
|
259
|
+
a geographic panel.
|
|
260
|
+
|
|
261
|
+
```ts
|
|
262
|
+
import { resolveView } from "@ac-kit/model-chart";
|
|
263
|
+
import { VEGA_LITE_CASES, vegaLiteCaseFrame } from "@ac-kit/model-chart/testing";
|
|
264
|
+
|
|
265
|
+
const result = resolveView(
|
|
266
|
+
{ mark: "point", encoding: { x: { field: "u" }, y: { field: "v" } } },
|
|
267
|
+
vegaLiteCaseFrame("scatter"),
|
|
268
|
+
{
|
|
269
|
+
marks: new Set(["point"]),
|
|
270
|
+
coords: new Set(["cartesian"]),
|
|
271
|
+
channels: new Set(["x", "y"]),
|
|
272
|
+
transforms: new Set(),
|
|
273
|
+
colorDepth: 24,
|
|
274
|
+
continuous: true,
|
|
275
|
+
},
|
|
276
|
+
);
|
|
277
|
+
// Vega's x domain: [0, 100]
|
|
278
|
+
console.log(VEGA_LITE_CASES.scatter.scales.x, result.kind);
|
|
279
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export * from "./render/capabilities.js";
|
|
2
|
+
export * from "./resolve/color-scheme.js";
|
|
2
3
|
export * from "./resolve/errors.js";
|
|
4
|
+
export * from "./resolve/mark-geometry.js";
|
|
3
5
|
export * from "./resolve/options.js";
|
|
4
6
|
export * from "./resolve/scale.js";
|
|
7
|
+
export * from "./resolve/scale-tick-labels.js";
|
|
5
8
|
export * from "./resolve/scale-ticks.js";
|
|
6
9
|
export * from "./resolve/scale-transform.js";
|
|
7
10
|
export * from "./resolve/series.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export * from "./render/capabilities.js";
|
|
2
|
+
export * from "./resolve/color-scheme.js";
|
|
2
3
|
export * from "./resolve/errors.js";
|
|
4
|
+
export * from "./resolve/mark-geometry.js";
|
|
3
5
|
export * from "./resolve/options.js";
|
|
4
6
|
export * from "./resolve/scale.js";
|
|
7
|
+
export * from "./resolve/scale-tick-labels.js";
|
|
5
8
|
export * from "./resolve/scale-ticks.js";
|
|
6
9
|
export * from "./resolve/scale-transform.js";
|
|
7
10
|
export * from "./resolve/series.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC"}
|
|
@@ -35,6 +35,19 @@ export type RendererCapabilities = {
|
|
|
35
35
|
projections?: ReadonlySet<ProjectionKind>;
|
|
36
36
|
/** Hierarchy and network layouts available. Absent: no restriction. */
|
|
37
37
|
layouts?: ReadonlySet<HierarchyLayout | NetworkLayout>;
|
|
38
|
+
/**
|
|
39
|
+
* The marks drawn in each coordinate system, within `marks`: a `polygon` a
|
|
40
|
+
* renderer fills in cartesian coordinates but not in polar ones. A coordinate
|
|
41
|
+
* system the map leaves out takes every mark of `marks`. Absent: no
|
|
42
|
+
* restriction.
|
|
43
|
+
*/
|
|
44
|
+
coordMarks?: ReadonlyMap<CoordKind, ReadonlySet<Mark>>;
|
|
45
|
+
/**
|
|
46
|
+
* The marks drawn in each dimension, within `marks`: an `area` a renderer
|
|
47
|
+
* draws in 2D but not in 3D. A dimension the map leaves out takes every mark
|
|
48
|
+
* of `marks`. Absent: no restriction.
|
|
49
|
+
*/
|
|
50
|
+
dimensionMarks?: ReadonlyMap<2 | 3, ReadonlySet<Mark>>;
|
|
38
51
|
};
|
|
39
52
|
/**
|
|
40
53
|
* Everything in `spec` that `capabilities` cannot honour.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../src/render/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EACX,SAAS,EACT,eAAe,EACf,aAAa,EACb,cAAc,EACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IAC/B,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC/B,UAAU,EAAE,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/C,+EAA+E;IAC/E,UAAU,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;IAC3B,+EAA+E;IAC/E,UAAU,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,yDAAyD;IACzD,WAAW,CAAC,EAAE,WAAW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AAuE;IACvE,OAAO,CAAC,EAAE,WAAW,CAAC,eAAe,GAAG,aAAa,CAAC,CAAC;IACvD;;;;;OAKG;IACH,UAAU,CAAC,EAAE,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IACvD;;;;OAIG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,QAAQ,EACd,YAAY,EAAE,oBAAoB,GAChC,MAAM,EAAE,CA2DV;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACxB,IAAI,EAAE,QAAQ,EACd,YAAY,EAAE,oBAAoB,GAChC,OAAO,CAET;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAC1B,IAAI,EAAE,QAAQ,EACd,YAAY,EAAE,oBAAoB,GAChC,QAAQ,GAAG,IAAI,CAQjB;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC;IACvC,UAAU,EAAE,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/C,WAAW,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IACzC,OAAO,EAAE,WAAW,CAAC,eAAe,GAAG,aAAa,CAAC,CAAC;CACtD,CA6BA,CAAC"}
|
|
@@ -14,6 +14,10 @@ export function unsupportedFeatures(spec, capabilities) {
|
|
|
14
14
|
if (!capabilities.coords.has(coordKind)) {
|
|
15
15
|
reasons.push(`coordinate system "${coordKind}"`);
|
|
16
16
|
}
|
|
17
|
+
else if (capabilities.marks.has(spec.mark) &&
|
|
18
|
+
capabilities.coordMarks?.get(coordKind)?.has(spec.mark) === false) {
|
|
19
|
+
reasons.push(`mark "${spec.mark}" in ${coordKind} coordinates`);
|
|
20
|
+
}
|
|
17
21
|
for (const channel of Object.keys(spec.encoding)) {
|
|
18
22
|
if (!capabilities.channels.has(channel)) {
|
|
19
23
|
reasons.push(`channel "${channel}"`);
|
|
@@ -29,6 +33,10 @@ export function unsupportedFeatures(spec, capabilities) {
|
|
|
29
33
|
!capabilities.dimensions.has(dimension)) {
|
|
30
34
|
reasons.push(`dimension ${dimension}`);
|
|
31
35
|
}
|
|
36
|
+
else if (capabilities.marks.has(spec.mark) &&
|
|
37
|
+
capabilities.dimensionMarks?.get(dimension)?.has(spec.mark) === false) {
|
|
38
|
+
reasons.push(`mark "${spec.mark}" in ${dimension}D`);
|
|
39
|
+
}
|
|
32
40
|
const coord = spec.coord;
|
|
33
41
|
if (coord?.kind === "geographic" &&
|
|
34
42
|
capabilities.projections !== undefined &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/render/capabilities.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/render/capabilities.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAiD3D;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAClC,IAAc,EACd,YAAkC;IAElC,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,IAAI,WAAW,CAAC;IAClD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;QACzC,OAAO,CAAC,IAAI,CAAC,sBAAsB,SAAS,GAAG,CAAC,CAAC;IA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