@ac-kit/model-chart 0.1.0 → 0.2.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 +23 -0
- package/README.md +35 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/render/capabilities.d.ts +10 -1
- package/dist/render/capabilities.d.ts.map +1 -1
- package/dist/render/capabilities.js +16 -0
- package/dist/render/capabilities.js.map +1 -1
- package/dist/spec/coord.d.ts +5 -0
- package/dist/spec/coord.d.ts.map +1 -1
- package/dist/spec/data-sources.d.ts +47 -0
- package/dist/spec/data-sources.d.ts.map +1 -0
- package/dist/spec/data-sources.js +112 -0
- package/dist/spec/data-sources.js.map +1 -0
- package/dist/spec/plot.d.ts +5 -0
- package/dist/spec/plot.d.ts.map +1 -1
- package/package.json +8 -7
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @ac-kit/model-chart
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 34e8cfa: A chart can read several named sources. `DataSources` maps names to frames and
|
|
8
|
+
`DataGrid`s; `PlotSpec.data` names the one a layer reads (absent: the only
|
|
9
|
+
source, or `"default"`); a network's `nodes` names the frame of node rows keyed
|
|
10
|
+
by `id`. `resolveDataSource` and `assertDataReferences` throw
|
|
11
|
+
`UnknownDataSourceError` for a layer, fallback or `nodes` naming a missing
|
|
12
|
+
source, and `InvalidNodeSourceError` for a `nodes` source that is a grid or has
|
|
13
|
+
no `id` field, including a `nodes` inherited from an enclosing layer
|
|
14
|
+
composition. `RendererCapabilities` gains optional `dimensions`, `projections`
|
|
15
|
+
and `layouts`; absent means no restriction, and `unsupportedFeatures` reports
|
|
16
|
+
`dimension 2`, `dimension 3`, `projection albers-usa` or `layout pack` when a
|
|
17
|
+
declared set lacks what a spec needs.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [34e8cfa]
|
|
22
|
+
- Updated dependencies [34e8cfa]
|
|
23
|
+
- @ac-kit/model-dataset@0.2.0
|
package/README.md
CHANGED
|
@@ -40,6 +40,7 @@ not a new type someone has to add.
|
|
|
40
40
|
| Transforms | `TransformSpec` and its ten members (`bin`, `aggregate`, `stack`, `density`, …) |
|
|
41
41
|
| Coordinates | `CoordSpec`, `CoordKind`, `ProjectionSpec`, `ProjectionKind`, `HierarchyLayout`, `NetworkLayout` |
|
|
42
42
|
| Composition | `PlotSpec`, `ViewSpec`, `LayerSpec`, `FacetSpec`, `ConcatSpec`, `Interpolation` |
|
|
43
|
+
| Data | `DataSources`, `resolveDataSource`, `assertDataReferences`, `UnknownDataSourceError`, `InvalidNodeSourceError` |
|
|
43
44
|
| Annotations | `AnnotationSpec` |
|
|
44
45
|
| Rendering | `RendererCapabilities`, `canRender`, `resolvePlot`, `unsupportedFeatures` |
|
|
45
46
|
|
|
@@ -63,6 +64,39 @@ result is the signal to apply the universal fallback and render the underlying
|
|
|
63
64
|
frame as a table. Every spec carries a `description` so a renderer that declines
|
|
64
65
|
still has something to say.
|
|
65
66
|
|
|
67
|
+
`dimensions`, `projections` and `layouts` are optional: absent means no
|
|
68
|
+
restriction, so a renderer that predates them is unaffected. Declared, they make
|
|
69
|
+
`unsupportedFeatures` report `dimension 3`, `projection albers-usa` or
|
|
70
|
+
`layout pack` for a spec that needs what the renderer lacks.
|
|
71
|
+
|
|
72
|
+
## Named data sources
|
|
73
|
+
|
|
74
|
+
`PlotSpec.data` names the source a layer reads among the `DataSources` a chart
|
|
75
|
+
is given — frames and `DataGrid`s by name. Absent, it reads the only source, or
|
|
76
|
+
the one called `"default"`. A network's `nodes` names the frame of node rows,
|
|
77
|
+
keyed by `id`. `assertDataReferences` checks a whole view, fallbacks included,
|
|
78
|
+
before anything is resolved.
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
import { dataFrameFromColumns } from "@ac-kit/model-dataset";
|
|
82
|
+
import { assertDataReferences, type DataSources } from "@ac-kit/model-chart";
|
|
83
|
+
|
|
84
|
+
const sources: DataSources = new Map([
|
|
85
|
+
["links", dataFrameFromColumns([{ name: "source", kind: "nominal" }], [["a"]])],
|
|
86
|
+
["people", dataFrameFromColumns([{ name: "id", kind: "identifier" }], [["a"]])],
|
|
87
|
+
]);
|
|
88
|
+
|
|
89
|
+
assertDataReferences(
|
|
90
|
+
{
|
|
91
|
+
mark: "link",
|
|
92
|
+
data: "links",
|
|
93
|
+
encoding: {},
|
|
94
|
+
coord: { kind: "network", layout: "force", nodes: "people" },
|
|
95
|
+
},
|
|
96
|
+
sources,
|
|
97
|
+
);
|
|
98
|
+
```
|
|
99
|
+
|
|
66
100
|
## Transforms are declared here, computed elsewhere
|
|
67
101
|
|
|
68
102
|
`bin`, `density`, `regression` and `contour` are named operations with real
|
|
@@ -71,5 +105,5 @@ implementations, and those belong where the mathematics lives —
|
|
|
71
105
|
which one to apply, not how.
|
|
72
106
|
|
|
73
107
|
See the
|
|
74
|
-
[generated API docs](https://anthochamp.
|
|
108
|
+
[generated API docs](https://anthochamp.pages.grenadine.io/node-essentials/api/model-chart/)
|
|
75
109
|
for the full reference.
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./render/capabilities.js";
|
|
|
2
2
|
export * from "./spec/annotation.js";
|
|
3
3
|
export * from "./spec/channel.js";
|
|
4
4
|
export * from "./spec/coord.js";
|
|
5
|
+
export * from "./spec/data-sources.js";
|
|
5
6
|
export * from "./spec/encoding.js";
|
|
6
7
|
export * from "./spec/mark.js";
|
|
7
8
|
export * from "./spec/plot.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,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,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"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./render/capabilities.js";
|
|
|
2
2
|
export * from "./spec/annotation.js";
|
|
3
3
|
export * from "./spec/channel.js";
|
|
4
4
|
export * from "./spec/coord.js";
|
|
5
|
+
export * from "./spec/data-sources.js";
|
|
5
6
|
export * from "./spec/encoding.js";
|
|
6
7
|
export * from "./spec/mark.js";
|
|
7
8
|
export * from "./spec/plot.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,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Channel } from "../spec/channel.js";
|
|
2
|
-
import type { CoordKind } from "../spec/coord.js";
|
|
2
|
+
import type { CoordKind, HierarchyLayout, NetworkLayout, ProjectionKind } from "../spec/coord.js";
|
|
3
3
|
import type { Mark } from "../spec/mark.js";
|
|
4
4
|
import type { PlotSpec } from "../spec/plot.js";
|
|
5
5
|
import type { TransformSpec } from "../spec/transform.js";
|
|
@@ -26,6 +26,15 @@ export type RendererCapabilities = {
|
|
|
26
26
|
* absent.
|
|
27
27
|
*/
|
|
28
28
|
maxMarks?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Spatial dimensions drawn; a spec encoding `z` needs `3`, any other `2`.
|
|
31
|
+
* Absent: no restriction.
|
|
32
|
+
*/
|
|
33
|
+
dimensions?: ReadonlySet<2 | 3>;
|
|
34
|
+
/** Map projections available. Absent: no restriction. */
|
|
35
|
+
projections?: ReadonlySet<ProjectionKind>;
|
|
36
|
+
/** Hierarchy and network layouts available. Absent: no restriction. */
|
|
37
|
+
layouts?: ReadonlySet<HierarchyLayout | NetworkLayout>;
|
|
29
38
|
};
|
|
30
39
|
/**
|
|
31
40
|
* 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,
|
|
1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S,CACxB,IAAI,EAAE,QAAQ,EACd,YAAY,EAAE,oBAAoB,GAChC,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAC1B,IAAI,EAAE,QAAQ,EACd,YAAY,EAAE,oBAAoB,GAChC,QAAQ,GAAG,IAAI,CAmBjB"}
|
|
@@ -23,6 +23,22 @@ export function unsupportedFeatures(spec, capabilities) {
|
|
|
23
23
|
reasons.push(`transform "${transform.kind}"`);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
const dimension = spec.encoding.z === undefined ? 2 : 3;
|
|
27
|
+
if (capabilities.dimensions !== undefined &&
|
|
28
|
+
!capabilities.dimensions.has(dimension)) {
|
|
29
|
+
reasons.push(`dimension ${dimension}`);
|
|
30
|
+
}
|
|
31
|
+
const coord = spec.coord;
|
|
32
|
+
if (coord?.kind === "geographic" &&
|
|
33
|
+
capabilities.projections !== undefined &&
|
|
34
|
+
!capabilities.projections.has(coord.projection.kind)) {
|
|
35
|
+
reasons.push(`projection ${coord.projection.kind}`);
|
|
36
|
+
}
|
|
37
|
+
if ((coord?.kind === "hierarchy" || coord?.kind === "network") &&
|
|
38
|
+
capabilities.layouts !== undefined &&
|
|
39
|
+
!capabilities.layouts.has(coord.layout)) {
|
|
40
|
+
reasons.push(`layout ${coord.layout}`);
|
|
41
|
+
}
|
|
26
42
|
return reasons;
|
|
27
43
|
}
|
|
28
44
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/render/capabilities.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/render/capabilities.ts"],"names":[],"mappings":"AA6CA;;;;;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,IAA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ACD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC"}
|
package/dist/spec/coord.d.ts
CHANGED
|
@@ -85,6 +85,11 @@ export type CoordSpec = {
|
|
|
85
85
|
} | {
|
|
86
86
|
kind: "network";
|
|
87
87
|
layout: NetworkLayout;
|
|
88
|
+
/**
|
|
89
|
+
* Name of the source of node rows, whose key field is `id`. Absent: the
|
|
90
|
+
* nodes are the distinct endpoints of the links.
|
|
91
|
+
*/
|
|
92
|
+
nodes?: string;
|
|
88
93
|
};
|
|
89
94
|
/** The discriminant of {@link CoordSpec}, for a renderer declaring its limits. */
|
|
90
95
|
export type CoordKind = CoordSpec["kind"];
|
package/dist/spec/coord.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coord.d.ts","sourceRoot":"","sources":["../../src/spec/coord.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GACvB,iBAAiB,GACjB,UAAU,GACV,qBAAqB,GACrB,QAAQ,GACR,YAAY,GACZ,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,GACnB,sBAAsB,GACtB,uBAAuB,GACvB,UAAU,GACV,cAAc,GACd,eAAe,GACf,eAAe,GACf,aAAa,CAAC;AAEjB;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,cAAc,CAAC;IACrB,iDAAiD;IACjD,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvE,kDAAkD;IAClD,SAAS,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM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,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,eAAe,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAChE;IACA,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEL,kFAAkF;AAClF,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { DataFrame, DataGrid } from "@ac-kit/model-dataset";
|
|
2
|
+
import type { PlotSpec, ViewSpec } from "./plot.js";
|
|
3
|
+
/**
|
|
4
|
+
* The data a chart is given: named frames and grids, each read by the layers
|
|
5
|
+
* that name it through {@link PlotSpec.data}.
|
|
6
|
+
*/
|
|
7
|
+
export type DataSources = ReadonlyMap<string, DataFrame | DataGrid>;
|
|
8
|
+
/** The name a layer without `data` reads when the chart has several sources. */
|
|
9
|
+
export declare const DEFAULT_DATA_SOURCE = "default";
|
|
10
|
+
/**
|
|
11
|
+
* A layer names a source the chart was not given, or names none and there is no
|
|
12
|
+
* single choice.
|
|
13
|
+
*/
|
|
14
|
+
export declare class UnknownDataSourceError extends Error {
|
|
15
|
+
/** `undefined` when the layer names none. */
|
|
16
|
+
readonly sourceName: string | undefined;
|
|
17
|
+
readonly known: readonly string[];
|
|
18
|
+
constructor(sourceName: string | undefined, known: readonly string[]);
|
|
19
|
+
}
|
|
20
|
+
/** A network's `nodes` source that is a grid or has no `id` field. */
|
|
21
|
+
export declare class InvalidNodeSourceError extends Error {
|
|
22
|
+
readonly sourceName: string;
|
|
23
|
+
constructor(sourceName: string);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The source a layer reads: the one it names, else the only one, else
|
|
27
|
+
* `"default"`.
|
|
28
|
+
*
|
|
29
|
+
* @throws {UnknownDataSourceError} When the name is not among `sources`, or is
|
|
30
|
+
* absent with several sources and none called `"default"`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveDataSource(data: string | undefined, sources: DataSources): DataFrame | DataGrid;
|
|
33
|
+
/**
|
|
34
|
+
* Checks that every layer of `view`, and of its fallbacks, reads a source that
|
|
35
|
+
* exists, and that every network `nodes` source, whether set on the layer or
|
|
36
|
+
* inherited from an enclosing layer composition, is a frame with an `id`
|
|
37
|
+
* field.
|
|
38
|
+
*
|
|
39
|
+
* O(layers) in the spec.
|
|
40
|
+
*
|
|
41
|
+
* @throws {UnknownDataSourceError} For the first layer or `nodes` naming an
|
|
42
|
+
* unknown source.
|
|
43
|
+
* @throws {InvalidNodeSourceError} For a `nodes` source that is a grid or lacks
|
|
44
|
+
* `id`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function assertDataReferences(view: ViewSpec | PlotSpec, sources: DataSources): void;
|
|
47
|
+
//# sourceMappingURL=data-sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-sources.d.ts","sourceRoot":"","sources":["../../src/spec/data-sources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAOjE,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC,CAAC;AAEpE,gFAAgF;AAChF,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAChD,6CAA6C;IAC7C,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAElC,YAAY,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,EASnE;CACD;AAED,sEAAsE;AACtE,qBAAa,sBAAuB,SAAQ,KAAK;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM;IAAvC,YAAqB,UAAU,EAAE,MAAM,EAGtC;CACD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,WAAW,GAClB,SAAS,GAAG,QAAQ,CAStB;AA2DD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,QAAQ,GAAG,QAAQ,EACzB,OAAO,EAAE,WAAW,GAClB,IAAI,CAWN"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { findDataFrameFieldIndexByName, isDataGrid, } from "@ac-kit/model-dataset";
|
|
2
|
+
/** The name a layer without `data` reads when the chart has several sources. */
|
|
3
|
+
export const DEFAULT_DATA_SOURCE = "default";
|
|
4
|
+
/**
|
|
5
|
+
* A layer names a source the chart was not given, or names none and there is no
|
|
6
|
+
* single choice.
|
|
7
|
+
*/
|
|
8
|
+
export class UnknownDataSourceError extends Error {
|
|
9
|
+
/** `undefined` when the layer names none. */
|
|
10
|
+
sourceName;
|
|
11
|
+
known;
|
|
12
|
+
constructor(sourceName, known) {
|
|
13
|
+
super(sourceName === undefined
|
|
14
|
+
? `No "data" named and no single or "${DEFAULT_DATA_SOURCE}" source among [${known.join(", ")}]`
|
|
15
|
+
: `No data source named "${sourceName}" among [${known.join(", ")}]`);
|
|
16
|
+
this.name = "UnknownDataSourceError";
|
|
17
|
+
this.sourceName = sourceName;
|
|
18
|
+
this.known = known;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** A network's `nodes` source that is a grid or has no `id` field. */
|
|
22
|
+
export class InvalidNodeSourceError extends Error {
|
|
23
|
+
sourceName;
|
|
24
|
+
constructor(sourceName) {
|
|
25
|
+
super(`Node source "${sourceName}" must be a frame with an "id" field`);
|
|
26
|
+
this.sourceName = sourceName;
|
|
27
|
+
this.name = "InvalidNodeSourceError";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The source a layer reads: the one it names, else the only one, else
|
|
32
|
+
* `"default"`.
|
|
33
|
+
*
|
|
34
|
+
* @throws {UnknownDataSourceError} When the name is not among `sources`, or is
|
|
35
|
+
* absent with several sources and none called `"default"`.
|
|
36
|
+
*/
|
|
37
|
+
export function resolveDataSource(data, sources) {
|
|
38
|
+
const name = data ??
|
|
39
|
+
(sources.size === 1 ? sources.keys().next().value : DEFAULT_DATA_SOURCE);
|
|
40
|
+
const source = name === undefined ? undefined : sources.get(name);
|
|
41
|
+
if (source === undefined) {
|
|
42
|
+
throw new UnknownDataSourceError(data, [...sources.keys()]);
|
|
43
|
+
}
|
|
44
|
+
return source;
|
|
45
|
+
}
|
|
46
|
+
function* plotsOf(view) {
|
|
47
|
+
const pending = [];
|
|
48
|
+
const seen = new Map();
|
|
49
|
+
const push = (node, inherited) => {
|
|
50
|
+
pending.push({ node, inherited });
|
|
51
|
+
};
|
|
52
|
+
push(view, undefined);
|
|
53
|
+
while (pending.length > 0) {
|
|
54
|
+
const { node: current, inherited } = pending.pop();
|
|
55
|
+
let coords = seen.get(current);
|
|
56
|
+
if (coords === undefined) {
|
|
57
|
+
coords = new Set();
|
|
58
|
+
seen.set(current, coords);
|
|
59
|
+
}
|
|
60
|
+
if (coords.has(inherited)) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
coords.add(inherited);
|
|
64
|
+
if (!("kind" in current) || current.kind === "plot") {
|
|
65
|
+
const plot = current;
|
|
66
|
+
const coord = plot.coord ?? inherited;
|
|
67
|
+
yield { plot, coord };
|
|
68
|
+
for (const fallback of plot.fallback ?? []) {
|
|
69
|
+
push(fallback, inherited);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else if (current.kind === "layer") {
|
|
73
|
+
const coord = current.coord ?? inherited;
|
|
74
|
+
for (const layer of current.layers) {
|
|
75
|
+
push(layer, coord);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else if (current.kind === "facet") {
|
|
79
|
+
push(current.plot, inherited);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
for (const child of current.views) {
|
|
83
|
+
push(child, inherited);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Checks that every layer of `view`, and of its fallbacks, reads a source that
|
|
90
|
+
* exists, and that every network `nodes` source, whether set on the layer or
|
|
91
|
+
* inherited from an enclosing layer composition, is a frame with an `id`
|
|
92
|
+
* field.
|
|
93
|
+
*
|
|
94
|
+
* O(layers) in the spec.
|
|
95
|
+
*
|
|
96
|
+
* @throws {UnknownDataSourceError} For the first layer or `nodes` naming an
|
|
97
|
+
* unknown source.
|
|
98
|
+
* @throws {InvalidNodeSourceError} For a `nodes` source that is a grid or lacks
|
|
99
|
+
* `id`.
|
|
100
|
+
*/
|
|
101
|
+
export function assertDataReferences(view, sources) {
|
|
102
|
+
for (const { plot, coord } of plotsOf(view)) {
|
|
103
|
+
resolveDataSource(plot.data, sources);
|
|
104
|
+
if (coord?.kind === "network" && coord.nodes !== undefined) {
|
|
105
|
+
const nodes = resolveDataSource(coord.nodes, sources);
|
|
106
|
+
if (isDataGrid(nodes) || findDataFrameFieldIndexByName(nodes, "id") < 0) {
|
|
107
|
+
throw new InvalidNodeSourceError(coord.nodes);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=data-sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-sources.js","sourceRoot":"","sources":["../../src/spec/data-sources.ts"],"names":[],"mappings":"AACA,OAAO,EACN,6BAA6B,EAC7B,UAAU,GACV,MAAM,uBAAuB,CAAC;AAW/B,gFAAgF;AAChF,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAE7C;;;GAGG;AACH,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11 @@ export type Interpolation = "linear" | "step" | "step-before" | "step-after" | "
|
|
|
22
22
|
* make the spec renderable by exactly one adapter.
|
|
23
23
|
*/
|
|
24
24
|
export type PlotSpec = {
|
|
25
|
+
/**
|
|
26
|
+
* Name of the source this layer reads, among the chart's `DataSources`.
|
|
27
|
+
* Absent: the only source, or the one named `"default"`.
|
|
28
|
+
*/
|
|
29
|
+
data?: string;
|
|
25
30
|
mark: Mark;
|
|
26
31
|
encoding: Partial<Record<Channel, EncodingSpec>>;
|
|
27
32
|
/** Default `{ kind: "cartesian" }`. */
|
package/dist/spec/plot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../src/spec/plot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,oEAAoE;AACpE;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GACtB,QAAQ,GACR,MAAM,GACN,aAAa,GACb,YAAY,GACZ,UAAU,GACV,SAAS,GACT,OAAO,GACP,UAAU,CAAC;AAEd;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;IACjD,uCAAuC;IACvC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,yDAAyD;IACzD,SAAS,CAAC,EAAE,SAAS,aAAa,EAAE,C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GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,QAAQ,CAAC;IACf,kEAAkE;IAClE,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,6DAA6D;AAC7D,MAAM,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,gEAAgE;AAChE,MAAM,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;IAC9C,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,iDAAiD;AACjD,MAAM,MAAM,QAAQ,GACjB,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,QAAQ,CAAC,GAC7B,SAAS,GACT,SAAS,GACT,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ac-kit/model-chart",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A description of a chart, independent of the medium it will be drawn in.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chart",
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
"plot",
|
|
9
9
|
"visualization"
|
|
10
10
|
],
|
|
11
|
-
"homepage": "https://anthochamp.
|
|
11
|
+
"homepage": "https://anthochamp.pages.grenadine.io/node-essentials/api/model-chart/",
|
|
12
12
|
"bugs": {
|
|
13
|
-
"url": "https://
|
|
13
|
+
"url": "https://git.grenadine.io/anthochamp/node-essentials/issues"
|
|
14
14
|
},
|
|
15
15
|
"license": "BSD-3-Clause",
|
|
16
16
|
"author": "Anthony Champagne <dev@anthonychampagne.fr>",
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "git+https://
|
|
19
|
+
"url": "git+https://git.grenadine.io/anthochamp/node-essentials.git",
|
|
20
20
|
"directory": "packages/model-chart"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
@@ -44,14 +44,15 @@
|
|
|
44
44
|
"prepack": "yarn build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@ac-kit/model-dataset": "^0.
|
|
47
|
+
"@ac-kit/model-dataset": "^0.2.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@ac-kit/tsconfig": "0.1.0",
|
|
51
51
|
"@ac-kit/typedoc-config": "0.1.0",
|
|
52
|
-
"@ac-kit/vitest-config": "0.
|
|
52
|
+
"@ac-kit/vitest-config": "0.2.0",
|
|
53
|
+
"@types/web": "^0.0.367",
|
|
53
54
|
"@typescript/native": "typescript@7.0.2",
|
|
54
|
-
"rimraf": "6.1.
|
|
55
|
+
"rimraf": "6.1.4",
|
|
55
56
|
"typedoc": "0.28.20",
|
|
56
57
|
"typescript": "@typescript/typescript6@6.0.2"
|
|
57
58
|
},
|