@uwdata/mosaic-spec 0.8.0 → 0.9.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/dist/mosaic-schema.json +12548 -6028
- package/dist/mosaic-spec.js +2410 -1847
- package/dist/mosaic-spec.min.js +20 -20
- package/dist/types/spec/Input.d.ts +28 -3
- package/dist/types/spec/PlotMark.d.ts +2 -1
- package/dist/types/spec/Spec.d.ts +7 -0
- package/dist/types/spec/Transform.d.ts +37 -1
- package/dist/types/spec/interactors/Nearest.d.ts +25 -6
- package/dist/types/spec/interactors/Toggle.d.ts +8 -0
- package/dist/types/spec/marks/Dot.d.ts +4 -0
- package/dist/types/spec/marks/ErrorBar.d.ts +82 -0
- package/dist/types/spec/marks/Marks.d.ts +16 -1
- package/dist/types/spec/marks/Text.d.ts +4 -0
- package/package.json +7 -9
- package/src/config/transforms.js +6 -0
- package/src/spec/Input.ts +25 -3
- package/src/spec/PlotMark.ts +2 -0
- package/src/spec/Spec.ts +7 -0
- package/src/spec/Transform.ts +53 -1
- package/src/spec/interactors/Nearest.ts +26 -6
- package/src/spec/interactors/Toggle.ts +9 -0
- package/src/spec/marks/Dot.ts +5 -0
- package/src/spec/marks/ErrorBar.ts +91 -0
- package/src/spec/marks/Marks.ts +27 -1
- package/src/spec/marks/Text.ts +5 -0
- package/LICENSE +0 -47
|
@@ -10,6 +10,11 @@ export interface Menu {
|
|
|
10
10
|
* currently selected menu option.
|
|
11
11
|
*/
|
|
12
12
|
as?: ParamRef;
|
|
13
|
+
/**
|
|
14
|
+
* The database column name to use within generated selection clause
|
|
15
|
+
* predicates. Defaults to the `column` property.
|
|
16
|
+
*/
|
|
17
|
+
field?: string;
|
|
13
18
|
/**
|
|
14
19
|
* The name of a database table to use as a data source for this widget.
|
|
15
20
|
* Used in conjunction with the `column` property.
|
|
@@ -32,11 +37,14 @@ export interface Menu {
|
|
|
32
37
|
/**
|
|
33
38
|
* An array of menu options, as literal values or option objects.
|
|
34
39
|
* Option objects have a `value` property and an optional `label` property.
|
|
35
|
-
* If no label is provided, the
|
|
40
|
+
* If no label is provided, the string-coerced value is used.
|
|
36
41
|
*/
|
|
37
|
-
options?: Array<any
|
|
42
|
+
options?: Array<any | {
|
|
43
|
+
value: any;
|
|
44
|
+
label?: string;
|
|
45
|
+
}>;
|
|
38
46
|
/**
|
|
39
|
-
* The initial selected menu
|
|
47
|
+
* The initial selected menu value.
|
|
40
48
|
*/
|
|
41
49
|
value?: any;
|
|
42
50
|
}
|
|
@@ -51,6 +59,11 @@ export interface Search {
|
|
|
51
59
|
* current text search query.
|
|
52
60
|
*/
|
|
53
61
|
as?: ParamRef;
|
|
62
|
+
/**
|
|
63
|
+
* The database column name to use within generated selection clause
|
|
64
|
+
* predicates. Defaults to the `column` property.
|
|
65
|
+
*/
|
|
66
|
+
field?: string;
|
|
54
67
|
/**
|
|
55
68
|
* The type of text search query to perform. One of:
|
|
56
69
|
* - `"contains"` (default): the query string may appear anywhere in the text
|
|
@@ -90,6 +103,18 @@ export interface Slider {
|
|
|
90
103
|
* currently selected slider option.
|
|
91
104
|
*/
|
|
92
105
|
as?: ParamRef;
|
|
106
|
+
/**
|
|
107
|
+
* The database column name to use within generated selection clause
|
|
108
|
+
* predicates. Defaults to the `column` property.
|
|
109
|
+
*/
|
|
110
|
+
field?: string;
|
|
111
|
+
/**
|
|
112
|
+
* The type of selection clause predicate to generate if the **as** option
|
|
113
|
+
* is a Selection. If `'point'` (the default), the selection predicate is an
|
|
114
|
+
* equality check for the slider value. If `'interval'`, the predicate checks
|
|
115
|
+
* an interval from the minimum to the current slider value.
|
|
116
|
+
*/
|
|
117
|
+
select?: 'point' | 'interval';
|
|
93
118
|
/**
|
|
94
119
|
* The name of a database table to use as a data source for this widget.
|
|
95
120
|
* Used in conjunction with the `column` property.
|
|
@@ -8,6 +8,7 @@ import { DelaunayLink, DelaunayMesh, Hull, Voronoi, VoronoiMesh } from './marks/
|
|
|
8
8
|
import { DenseLine } from './marks/DenseLine.js';
|
|
9
9
|
import { Density, DensityX, DensityY } from './marks/Density.js';
|
|
10
10
|
import { Circle, Dot, DotX, DotY, Hexagon } from './marks/Dot.js';
|
|
11
|
+
import { ErrorBarX, ErrorBarY } from './marks/ErrorBar.js';
|
|
11
12
|
import { Frame } from './marks/Frame.js';
|
|
12
13
|
import { Geo, Graticule, Sphere } from './marks/Geo.js';
|
|
13
14
|
import { Hexbin } from './marks/Hexbin.js';
|
|
@@ -23,4 +24,4 @@ import { Text, TextX, TextY } from './marks/Text.js';
|
|
|
23
24
|
import { TickX, TickY } from './marks/Tick.js';
|
|
24
25
|
import { Spike, Vector, VectorX, VectorY } from './marks/Vector.js';
|
|
25
26
|
/** A plot mark entry. */
|
|
26
|
-
export type PlotMark = Area | AreaX | AreaY | Arrow | AxisX | AxisY | AxisFx | AxisFy | GridX | GridY | GridFx | GridFy | BarX | BarY | Cell | CellX | CellY | Contour | DelaunayLink | DelaunayMesh | Hull | Voronoi | VoronoiMesh | DenseLine | Density | DensityX | DensityY | Dot | DotX | DotY | Circle | Hexagon | Frame | Geo | Graticule | Sphere | Hexbin | Hexgrid | Image | Line | LineX | LineY | Link | Raster | Heatmap | RasterTile | Rect | RectX | RectY | RegressionY | RuleX | RuleY | Text | TextX | TextY | TickX | TickY | Vector | VectorX | VectorY | Spike;
|
|
27
|
+
export type PlotMark = Area | AreaX | AreaY | Arrow | AxisX | AxisY | AxisFx | AxisFy | GridX | GridY | GridFx | GridFy | BarX | BarY | Cell | CellX | CellY | Contour | DelaunayLink | DelaunayMesh | Hull | Voronoi | VoronoiMesh | DenseLine | Density | DensityX | DensityY | Dot | DotX | DotY | Circle | Hexagon | ErrorBarX | ErrorBarY | Frame | Geo | Graticule | Sphere | Hexbin | Hexgrid | Image | Line | LineX | LineY | Link | Raster | Heatmap | RasterTile | Rect | RectX | RectY | RegressionY | RuleX | RuleY | Text | TextX | TextY | TickX | TickY | Vector | VectorX | VectorY | Spike;
|
|
@@ -28,6 +28,13 @@ export type Data = Record<string, DataDefinition>;
|
|
|
28
28
|
export type Params = Record<string, ParamDefinition>;
|
|
29
29
|
/** Top-level specification properties. */
|
|
30
30
|
export interface SpecHead {
|
|
31
|
+
/**
|
|
32
|
+
* A [JSON schema](http://json-schema.org/) URL for this specification,
|
|
33
|
+
* such as https://uwdata.github.io/mosaic/schema/latest.json. This property
|
|
34
|
+
* enables validation and autocomplete in editors with JSON schema support.
|
|
35
|
+
* @format uri
|
|
36
|
+
*/
|
|
37
|
+
$schema?: string;
|
|
31
38
|
/** Specification metadata. */
|
|
32
39
|
meta?: Meta;
|
|
33
40
|
/** Configuration options. */
|
|
@@ -133,6 +133,18 @@ export interface Count extends AggregateOptions, WindowOptions {
|
|
|
133
133
|
*/
|
|
134
134
|
count: Arg0 | Arg1;
|
|
135
135
|
}
|
|
136
|
+
export interface Covariance extends AggregateOptions, WindowOptions {
|
|
137
|
+
/**
|
|
138
|
+
* Compute the sample covariance of between the given columns.
|
|
139
|
+
*/
|
|
140
|
+
covariance: Arg2;
|
|
141
|
+
}
|
|
142
|
+
export interface CovarPop extends AggregateOptions, WindowOptions {
|
|
143
|
+
/**
|
|
144
|
+
* Compute the population covariance of between the given columns.
|
|
145
|
+
*/
|
|
146
|
+
covarPop: Arg2;
|
|
147
|
+
}
|
|
136
148
|
export interface First extends AggregateOptions, WindowOptions {
|
|
137
149
|
/**
|
|
138
150
|
* Return the first column value found in an aggregation group.
|
|
@@ -182,12 +194,36 @@ export interface Quantile extends AggregateOptions, WindowOptions {
|
|
|
182
194
|
*/
|
|
183
195
|
quantile: Arg2;
|
|
184
196
|
}
|
|
197
|
+
export interface Stddev extends AggregateOptions, WindowOptions {
|
|
198
|
+
/**
|
|
199
|
+
* Compute the sum of the given column.
|
|
200
|
+
*/
|
|
201
|
+
stddev: Arg1;
|
|
202
|
+
}
|
|
203
|
+
export interface StddevPop extends AggregateOptions, WindowOptions {
|
|
204
|
+
/**
|
|
205
|
+
* Compute the sum of the given column.
|
|
206
|
+
*/
|
|
207
|
+
stddevPop: Arg1;
|
|
208
|
+
}
|
|
185
209
|
export interface Sum extends AggregateOptions, WindowOptions {
|
|
186
210
|
/**
|
|
187
211
|
* Compute the sum of the given column.
|
|
188
212
|
*/
|
|
189
213
|
sum: Arg1;
|
|
190
214
|
}
|
|
215
|
+
export interface Variance extends AggregateOptions, WindowOptions {
|
|
216
|
+
/**
|
|
217
|
+
* Compute the sample variance of the given column.
|
|
218
|
+
*/
|
|
219
|
+
variance: Arg1;
|
|
220
|
+
}
|
|
221
|
+
export interface VarPop extends AggregateOptions, WindowOptions {
|
|
222
|
+
/**
|
|
223
|
+
* Compute the population variance of the given column.
|
|
224
|
+
*/
|
|
225
|
+
varPop: Arg1;
|
|
226
|
+
}
|
|
191
227
|
export interface RowNumber extends WindowOptions {
|
|
192
228
|
/**
|
|
193
229
|
* Compute the 1-based row number over an ordered window partition.
|
|
@@ -271,7 +307,7 @@ export interface NthValue extends WindowOptions {
|
|
|
271
307
|
/** A data transform that maps one column value to another. */
|
|
272
308
|
export type ColumnTransform = Bin | DateMonth | DateMonthDay | DateDay | Centroid | CentroidX | CentroidY | GeoJSON;
|
|
273
309
|
/** An aggregate transform that combines multiple values. */
|
|
274
|
-
export type AggregateTransform = Argmax | Argmin | Avg | Count | Max | Min | First | Last | Max | Min | Median | Mode | Product | Quantile | Sum;
|
|
310
|
+
export type AggregateTransform = Argmax | Argmin | Avg | Count | Max | Min | First | Last | Max | Min | Median | Mode | Product | Quantile | Stddev | StddevPop | Sum | Variance | VarPop;
|
|
275
311
|
export type WindowTransform = RowNumber | Rank | DenseRank | PercentRank | CumeDist | NTile | Rank | Lag | Lead | FirstValue | LastValue | NthValue;
|
|
276
312
|
/** A data transform. */
|
|
277
313
|
export type Transform = ColumnTransform | AggregateTransform | WindowTransform;
|
|
@@ -7,19 +7,38 @@ export interface NearestOptions {
|
|
|
7
7
|
*/
|
|
8
8
|
as: ParamRef;
|
|
9
9
|
/**
|
|
10
|
-
* The
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* The encoding channels whose domain values should be selected. For example,
|
|
11
|
+
* a setting of `['color']` selects the data value backing the color channel,
|
|
12
|
+
* whereas `['x', 'z']` selects both x and z channel domain values. If
|
|
13
|
+
* unspecified, the selected channels default to match the current pointer
|
|
14
|
+
* settings: a `nearestX` interactor selects the `['x']` channels, while
|
|
15
|
+
* a `nearest` interactor selects the `['x', 'y']` channels.
|
|
13
16
|
*/
|
|
14
|
-
|
|
17
|
+
channels?: string[];
|
|
18
|
+
/**
|
|
19
|
+
* The fields (database column names) to use in generated selection clause
|
|
20
|
+
* predicates. If unspecified, the fields backing the selected *channels*
|
|
21
|
+
* in the first valid prior mark definition are used by default.
|
|
22
|
+
*/
|
|
23
|
+
fields?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* The maximum radius of a nearest selection (default 40). Marks with (x, y)
|
|
26
|
+
* coordinates outside this radius will not be selected as nearest points.
|
|
27
|
+
*/
|
|
28
|
+
maxRadius?: number;
|
|
29
|
+
}
|
|
30
|
+
/** A nearest interactor. */
|
|
31
|
+
export interface Nearest extends NearestOptions {
|
|
32
|
+
/** Select values from the mark closest to the pointer. */
|
|
33
|
+
select: 'nearest';
|
|
15
34
|
}
|
|
16
35
|
/** A nearestX interactor. */
|
|
17
36
|
export interface NearestX extends NearestOptions {
|
|
18
|
-
/** Select
|
|
37
|
+
/** Select values from the mark closest to the pointer *x* location. */
|
|
19
38
|
select: 'nearestX';
|
|
20
39
|
}
|
|
21
40
|
/** A nearestY interactor. */
|
|
22
41
|
export interface NearestY extends NearestOptions {
|
|
23
|
-
/** Select
|
|
42
|
+
/** Select values from the mark closest to the pointer *y* location. */
|
|
24
43
|
select: 'nearestY';
|
|
25
44
|
}
|
|
@@ -41,6 +41,14 @@ export interface ToggleY extends ToggleOptions {
|
|
|
41
41
|
*/
|
|
42
42
|
select: 'toggleY';
|
|
43
43
|
}
|
|
44
|
+
/** A toggleZ interactor. */
|
|
45
|
+
export interface ToggleZ extends ToggleOptions {
|
|
46
|
+
/**
|
|
47
|
+
* Select individal values in the `z` scale domain.
|
|
48
|
+
* Clicking or touching a mark toggles its selection status.
|
|
49
|
+
*/
|
|
50
|
+
select: 'toggleZ';
|
|
51
|
+
}
|
|
44
52
|
/** A toggleColor interactor. */
|
|
45
53
|
export interface ToggleColor extends ToggleOptions {
|
|
46
54
|
/**
|
|
@@ -13,6 +13,10 @@ export interface DotOptions extends MarkOptions {
|
|
|
13
13
|
* to the *y* scale.
|
|
14
14
|
*/
|
|
15
15
|
y?: ChannelValueSpec;
|
|
16
|
+
/**
|
|
17
|
+
* An optional ordinal channel for grouping data into series.
|
|
18
|
+
*/
|
|
19
|
+
z?: ChannelValue;
|
|
16
20
|
/**
|
|
17
21
|
* The radius of dots; either a channel or constant. When a number, it is
|
|
18
22
|
* interpreted as a constant radius in pixels. Otherwise it is interpreted as
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
import { ChannelValue, ChannelValueSpec, MarkData, MarkOptions, MarkerOptions } from './Marks.js';
|
|
3
|
+
/** Options for errorbar marks. */
|
|
4
|
+
interface ErrorBarOptions extends MarkOptions, MarkerOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The confidence interval in (0, 1); defaults to 0.95.
|
|
7
|
+
*/
|
|
8
|
+
ci?: number | ParamRef;
|
|
9
|
+
/**
|
|
10
|
+
* An optional ordinal channel for grouping data, producing an independent
|
|
11
|
+
* error bar for each group. If not specified, it defaults to **stroke** if
|
|
12
|
+
* a channel.
|
|
13
|
+
*/
|
|
14
|
+
z?: ChannelValue;
|
|
15
|
+
}
|
|
16
|
+
/** Options for the errorbarX mark. */
|
|
17
|
+
export interface ErrorBarXOptions extends ErrorBarOptions {
|
|
18
|
+
/**
|
|
19
|
+
* The dependent variable horizontal position channel, typically bound to the
|
|
20
|
+
* *x* scale.
|
|
21
|
+
*/
|
|
22
|
+
x: ChannelValueSpec;
|
|
23
|
+
/**
|
|
24
|
+
* The independent variable vertical position channel, typically bound to
|
|
25
|
+
* the *y* scale; defaults to the zero-based index of the data [0, 1, 2, …].
|
|
26
|
+
*/
|
|
27
|
+
y?: ChannelValueSpec;
|
|
28
|
+
}
|
|
29
|
+
/** The errorbarX mark. */
|
|
30
|
+
export interface ErrorBarX extends MarkData, ErrorBarXOptions {
|
|
31
|
+
/**
|
|
32
|
+
* A mark that draws error bars for a calculated parametric confidence
|
|
33
|
+
* interval for a dependent variable (*x*), potentially grouped by an
|
|
34
|
+
* independent variable (*y*).
|
|
35
|
+
*
|
|
36
|
+
* This mark aggregates raw values to produce a [parametric confidence
|
|
37
|
+
* interval][1] of the mean, assuming a normal distribution. To instead
|
|
38
|
+
* visualize pre-computeted interval values or custom aggregations, use
|
|
39
|
+
* a **ruleY** mark with specified **x1** and **x2** channels.
|
|
40
|
+
*
|
|
41
|
+
* Multiple error bars can be produced by specifying a **z** or **stroke**
|
|
42
|
+
* channel. Set the **marker** option to `'tick'` to add small perpendicular
|
|
43
|
+
* lines at the start and end of the error interval.
|
|
44
|
+
*
|
|
45
|
+
* [1]: https://en.wikipedia.org/wiki/Normal_distribution#Confidence_intervals
|
|
46
|
+
*/
|
|
47
|
+
mark: 'errorbarX';
|
|
48
|
+
}
|
|
49
|
+
/** Options for the errorbarY mark. */
|
|
50
|
+
export interface ErrorBarYOptions extends ErrorBarOptions {
|
|
51
|
+
/**
|
|
52
|
+
* The independent variable horizontal position channel, typically bound to
|
|
53
|
+
* the *x* scale; defaults to the zero-based index of the data [0, 1, 2, …].
|
|
54
|
+
*/
|
|
55
|
+
x?: ChannelValueSpec;
|
|
56
|
+
/**
|
|
57
|
+
* The dependent variable vertical position channel, typically bound to the
|
|
58
|
+
* *y* scale.
|
|
59
|
+
*/
|
|
60
|
+
y: ChannelValueSpec;
|
|
61
|
+
}
|
|
62
|
+
/** The errorbarY mark. */
|
|
63
|
+
export interface ErrorBarY extends MarkData, ErrorBarYOptions {
|
|
64
|
+
/**
|
|
65
|
+
* A mark that draws error bars for a calculated parametric confidence
|
|
66
|
+
* interval for a dependent variable (*y*), potentially grouped by an
|
|
67
|
+
* independent variable (*x*).
|
|
68
|
+
*
|
|
69
|
+
* This mark aggregates raw values to produce a [parametric confidence
|
|
70
|
+
* interval][1] of the mean, assuming a normal distribution. To instead
|
|
71
|
+
* visualize pre-computeted interval values or custom aggregations, use
|
|
72
|
+
* a **ruleX** mark with specified **y1** and **y2** channels.
|
|
73
|
+
*
|
|
74
|
+
* Multiple error bars can be produced by specifying a **z** or **stroke**
|
|
75
|
+
* channel. Set the **marker** option to `'tick'` to add small perpendicular
|
|
76
|
+
* lines at the start and end of the error interval.
|
|
77
|
+
*
|
|
78
|
+
* [1]: https://en.wikipedia.org/wiki/Normal_distribution#Confidence_intervals
|
|
79
|
+
*/
|
|
80
|
+
mark: 'errorbarY';
|
|
81
|
+
}
|
|
82
|
+
export {};
|
|
@@ -147,6 +147,8 @@ export type SortOrder = ChannelValue | {
|
|
|
147
147
|
};
|
|
148
148
|
/** The pointer mode for the tip; corresponds to pointerX, pointerY, and pointer. */
|
|
149
149
|
export type TipPointer = 'x' | 'y' | 'xy';
|
|
150
|
+
/** Selection filters to apply internally to mark data. */
|
|
151
|
+
export type SelectFilter = 'first' | 'last' | 'maxX' | 'maxY' | 'minX' | 'minY' | 'nearest' | 'nearestX' | 'nearestY';
|
|
150
152
|
export interface MarkData {
|
|
151
153
|
/**
|
|
152
154
|
* The data source for the mark.
|
|
@@ -166,9 +168,22 @@ export interface MarkOptions {
|
|
|
166
168
|
* channel values; only truthy values are retained.
|
|
167
169
|
*
|
|
168
170
|
* Note that filtering only affects the rendered mark index, not the
|
|
169
|
-
* associated channel values, and
|
|
171
|
+
* associated channel values, and has no effect on imputed scale domains.
|
|
170
172
|
*/
|
|
171
173
|
filter?: ChannelValue;
|
|
174
|
+
/**
|
|
175
|
+
* Applies a filter transform after data is loaded to highlight selected
|
|
176
|
+
* values only. For example, `first` and `last` select the first or last
|
|
177
|
+
* values of series only (using the *z* channel to separate series).
|
|
178
|
+
* Meanwhile, `nearestX` and `nearestY` select the point nearest to the
|
|
179
|
+
* pointer along the *x* or *y* channel dimension. Unlike Mosaic selections,
|
|
180
|
+
* a mark level *select* is internal to the mark only, and does not populate
|
|
181
|
+
* a param or selection value to be shared across clients.
|
|
182
|
+
*
|
|
183
|
+
* Note that filtering only affects the rendered mark index, not the
|
|
184
|
+
* associated channel values, and has no effect on imputed scale domains.
|
|
185
|
+
*/
|
|
186
|
+
select?: SelectFilter;
|
|
172
187
|
/**
|
|
173
188
|
* Applies a transform to reverse the order of the mark’s index, say for
|
|
174
189
|
* reverse input order.
|
|
@@ -13,6 +13,10 @@ export interface TextOptions extends MarkOptions, TextStyles {
|
|
|
13
13
|
* bound to the *y* scale.
|
|
14
14
|
*/
|
|
15
15
|
y?: ChannelValueSpec;
|
|
16
|
+
/**
|
|
17
|
+
* An optional ordinal channel for grouping data into series.
|
|
18
|
+
*/
|
|
19
|
+
z?: ChannelValue;
|
|
16
20
|
/**
|
|
17
21
|
* The text contents channel, possibly with line breaks (\n, \r\n, or \r). If
|
|
18
22
|
* not specified, defaults to the zero-based index [0, 1, 2, …].
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uwdata/mosaic-spec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Declarative specification of Mosaic-powered applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mosaic",
|
|
@@ -29,16 +29,14 @@
|
|
|
29
29
|
"schema": "ts-json-schema-generator -f tsconfig.json -p src/spec/Spec.ts -t Spec --no-type-check --no-ref-encode --functions hide > dist/mosaic-schema.json",
|
|
30
30
|
"pretest": "npm run prebuild && npm run types",
|
|
31
31
|
"test": "mocha 'test/**/*-test.js' && tsc -p jsconfig.json",
|
|
32
|
+
"version": "cd ../.. && npm run docs:schema",
|
|
32
33
|
"prepublishOnly": "npm run test && npm run lint && npm run build"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@uwdata/mosaic-core": "^0.
|
|
36
|
-
"@uwdata/mosaic-sql": "^0.
|
|
37
|
-
"@uwdata/vgplot": "^0.
|
|
38
|
-
"ts-json-schema-generator": "^2.
|
|
36
|
+
"@uwdata/mosaic-core": "^0.9.0",
|
|
37
|
+
"@uwdata/mosaic-sql": "^0.9.0",
|
|
38
|
+
"@uwdata/vgplot": "^0.9.0",
|
|
39
|
+
"ts-json-schema-generator": "^2.2.0"
|
|
39
40
|
},
|
|
40
|
-
"
|
|
41
|
-
"ajv": "^8.13.0"
|
|
42
|
-
},
|
|
43
|
-
"gitHead": "a24b4c9f7dfa1c38c6af96ec17e075326c1af9b0"
|
|
41
|
+
"gitHead": "89bb9b0dfa747aed691eaeba35379525a6764c61"
|
|
44
42
|
}
|
package/src/config/transforms.js
CHANGED
|
@@ -11,6 +11,8 @@ export function transformNames(overrides = []) {
|
|
|
11
11
|
'centroidX',
|
|
12
12
|
'centroidY',
|
|
13
13
|
'count',
|
|
14
|
+
'covariance',
|
|
15
|
+
'covarPop',
|
|
14
16
|
'dateMonth',
|
|
15
17
|
'dateMonthDay',
|
|
16
18
|
'dateDay',
|
|
@@ -23,7 +25,11 @@ export function transformNames(overrides = []) {
|
|
|
23
25
|
'mode',
|
|
24
26
|
'product',
|
|
25
27
|
'quantile',
|
|
28
|
+
'stddev',
|
|
29
|
+
'stddevPop',
|
|
26
30
|
'sum',
|
|
31
|
+
'variance',
|
|
32
|
+
'varPop',
|
|
27
33
|
'row_number',
|
|
28
34
|
'rank',
|
|
29
35
|
'dense_rank',
|
package/src/spec/Input.ts
CHANGED
|
@@ -11,6 +11,11 @@ export interface Menu {
|
|
|
11
11
|
* currently selected menu option.
|
|
12
12
|
*/
|
|
13
13
|
as?: ParamRef;
|
|
14
|
+
/**
|
|
15
|
+
* The database column name to use within generated selection clause
|
|
16
|
+
* predicates. Defaults to the `column` property.
|
|
17
|
+
*/
|
|
18
|
+
field?: string;
|
|
14
19
|
/**
|
|
15
20
|
* The name of a database table to use as a data source for this widget.
|
|
16
21
|
* Used in conjunction with the `column` property.
|
|
@@ -33,11 +38,11 @@ export interface Menu {
|
|
|
33
38
|
/**
|
|
34
39
|
* An array of menu options, as literal values or option objects.
|
|
35
40
|
* Option objects have a `value` property and an optional `label` property.
|
|
36
|
-
* If no label is provided, the
|
|
41
|
+
* If no label is provided, the string-coerced value is used.
|
|
37
42
|
*/
|
|
38
|
-
options?: Array<any>;
|
|
43
|
+
options?: Array<any | { value: any, label?: string }>;
|
|
39
44
|
/**
|
|
40
|
-
* The initial selected menu
|
|
45
|
+
* The initial selected menu value.
|
|
41
46
|
*/
|
|
42
47
|
value?: any;
|
|
43
48
|
}
|
|
@@ -53,6 +58,11 @@ export interface Search {
|
|
|
53
58
|
* current text search query.
|
|
54
59
|
*/
|
|
55
60
|
as?: ParamRef;
|
|
61
|
+
/**
|
|
62
|
+
* The database column name to use within generated selection clause
|
|
63
|
+
* predicates. Defaults to the `column` property.
|
|
64
|
+
*/
|
|
65
|
+
field?: string;
|
|
56
66
|
/**
|
|
57
67
|
* The type of text search query to perform. One of:
|
|
58
68
|
* - `"contains"` (default): the query string may appear anywhere in the text
|
|
@@ -93,6 +103,18 @@ export interface Slider {
|
|
|
93
103
|
* currently selected slider option.
|
|
94
104
|
*/
|
|
95
105
|
as?: ParamRef;
|
|
106
|
+
/**
|
|
107
|
+
* The database column name to use within generated selection clause
|
|
108
|
+
* predicates. Defaults to the `column` property.
|
|
109
|
+
*/
|
|
110
|
+
field?: string;
|
|
111
|
+
/**
|
|
112
|
+
* The type of selection clause predicate to generate if the **as** option
|
|
113
|
+
* is a Selection. If `'point'` (the default), the selection predicate is an
|
|
114
|
+
* equality check for the slider value. If `'interval'`, the predicate checks
|
|
115
|
+
* an interval from the minimum to the current slider value.
|
|
116
|
+
*/
|
|
117
|
+
select?: 'point' | 'interval';
|
|
96
118
|
/**
|
|
97
119
|
* The name of a database table to use as a data source for this widget.
|
|
98
120
|
* Used in conjunction with the `column` property.
|
package/src/spec/PlotMark.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { DelaunayLink, DelaunayMesh, Hull, Voronoi, VoronoiMesh } from './marks/
|
|
|
8
8
|
import { DenseLine } from './marks/DenseLine.js';
|
|
9
9
|
import { Density, DensityX, DensityY } from './marks/Density.js';
|
|
10
10
|
import { Circle, Dot, DotX, DotY, Hexagon } from './marks/Dot.js';
|
|
11
|
+
import { ErrorBarX, ErrorBarY } from './marks/ErrorBar.js';
|
|
11
12
|
import { Frame } from './marks/Frame.js';
|
|
12
13
|
import { Geo, Graticule, Sphere } from './marks/Geo.js';
|
|
13
14
|
import { Hexbin } from './marks/Hexbin.js';
|
|
@@ -35,6 +36,7 @@ export type PlotMark =
|
|
|
35
36
|
| DenseLine
|
|
36
37
|
| Density | DensityX | DensityY
|
|
37
38
|
| Dot | DotX | DotY | Circle | Hexagon
|
|
39
|
+
| ErrorBarX | ErrorBarY
|
|
38
40
|
| Frame
|
|
39
41
|
| Geo | Graticule | Sphere
|
|
40
42
|
| Hexbin
|
package/src/spec/Spec.ts
CHANGED
|
@@ -33,6 +33,13 @@ export type Params = Record<string, ParamDefinition>;
|
|
|
33
33
|
|
|
34
34
|
/** Top-level specification properties. */
|
|
35
35
|
export interface SpecHead {
|
|
36
|
+
/**
|
|
37
|
+
* A [JSON schema](http://json-schema.org/) URL for this specification,
|
|
38
|
+
* such as https://uwdata.github.io/mosaic/schema/latest.json. This property
|
|
39
|
+
* enables validation and autocomplete in editors with JSON schema support.
|
|
40
|
+
* @format uri
|
|
41
|
+
*/
|
|
42
|
+
$schema?: string;
|
|
36
43
|
/** Specification metadata. */
|
|
37
44
|
meta?: Meta;
|
|
38
45
|
/** Configuration options. */
|
package/src/spec/Transform.ts
CHANGED
|
@@ -168,6 +168,22 @@ export interface Count extends AggregateOptions, WindowOptions {
|
|
|
168
168
|
count: Arg0 | Arg1;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
/* A sample covariance aggregate transform. */
|
|
172
|
+
export interface Covariance extends AggregateOptions, WindowOptions {
|
|
173
|
+
/**
|
|
174
|
+
* Compute the sample covariance of between the given columns.
|
|
175
|
+
*/
|
|
176
|
+
covariance: Arg2;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* A population covariance aggregate transform. */
|
|
180
|
+
export interface CovarPop extends AggregateOptions, WindowOptions {
|
|
181
|
+
/**
|
|
182
|
+
* Compute the population covariance of between the given columns.
|
|
183
|
+
*/
|
|
184
|
+
covarPop: Arg2;
|
|
185
|
+
}
|
|
186
|
+
|
|
171
187
|
/* A first aggregate transform. */
|
|
172
188
|
export interface First extends AggregateOptions, WindowOptions {
|
|
173
189
|
/**
|
|
@@ -233,6 +249,22 @@ export interface Quantile extends AggregateOptions, WindowOptions {
|
|
|
233
249
|
quantile: Arg2;
|
|
234
250
|
}
|
|
235
251
|
|
|
252
|
+
/* A sample standard deviation aggregate transform. */
|
|
253
|
+
export interface Stddev extends AggregateOptions, WindowOptions {
|
|
254
|
+
/**
|
|
255
|
+
* Compute the sum of the given column.
|
|
256
|
+
*/
|
|
257
|
+
stddev: Arg1;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/* A population standard deviation aggregate transform. */
|
|
261
|
+
export interface StddevPop extends AggregateOptions, WindowOptions {
|
|
262
|
+
/**
|
|
263
|
+
* Compute the sum of the given column.
|
|
264
|
+
*/
|
|
265
|
+
stddevPop: Arg1;
|
|
266
|
+
}
|
|
267
|
+
|
|
236
268
|
/* A sum aggregate transform. */
|
|
237
269
|
export interface Sum extends AggregateOptions, WindowOptions {
|
|
238
270
|
/**
|
|
@@ -241,6 +273,22 @@ export interface Sum extends AggregateOptions, WindowOptions {
|
|
|
241
273
|
sum: Arg1;
|
|
242
274
|
}
|
|
243
275
|
|
|
276
|
+
/* A sample variance aggregate transform. */
|
|
277
|
+
export interface Variance extends AggregateOptions, WindowOptions {
|
|
278
|
+
/**
|
|
279
|
+
* Compute the sample variance of the given column.
|
|
280
|
+
*/
|
|
281
|
+
variance: Arg1;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/* A population variance aggregate transform. */
|
|
285
|
+
export interface VarPop extends AggregateOptions, WindowOptions {
|
|
286
|
+
/**
|
|
287
|
+
* Compute the population variance of the given column.
|
|
288
|
+
*/
|
|
289
|
+
varPop: Arg1;
|
|
290
|
+
}
|
|
291
|
+
|
|
244
292
|
/* A row_number window transform. */
|
|
245
293
|
export interface RowNumber extends WindowOptions {
|
|
246
294
|
/**
|
|
@@ -370,7 +418,11 @@ export type AggregateTransform =
|
|
|
370
418
|
| Mode
|
|
371
419
|
| Product
|
|
372
420
|
| Quantile
|
|
373
|
-
|
|
|
421
|
+
| Stddev
|
|
422
|
+
| StddevPop
|
|
423
|
+
| Sum
|
|
424
|
+
| Variance
|
|
425
|
+
| VarPop;
|
|
374
426
|
|
|
375
427
|
/* A window transform that operates over a sorted domain. */
|
|
376
428
|
export type WindowTransform =
|
|
@@ -8,21 +8,41 @@ export interface NearestOptions {
|
|
|
8
8
|
*/
|
|
9
9
|
as: ParamRef;
|
|
10
10
|
/**
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* The encoding channels whose domain values should be selected. For example,
|
|
12
|
+
* a setting of `['color']` selects the data value backing the color channel,
|
|
13
|
+
* whereas `['x', 'z']` selects both x and z channel domain values. If
|
|
14
|
+
* unspecified, the selected channels default to match the current pointer
|
|
15
|
+
* settings: a `nearestX` interactor selects the `['x']` channels, while
|
|
16
|
+
* a `nearest` interactor selects the `['x', 'y']` channels.
|
|
14
17
|
*/
|
|
15
|
-
|
|
18
|
+
channels?: string[];
|
|
19
|
+
/**
|
|
20
|
+
* The fields (database column names) to use in generated selection clause
|
|
21
|
+
* predicates. If unspecified, the fields backing the selected *channels*
|
|
22
|
+
* in the first valid prior mark definition are used by default.
|
|
23
|
+
*/
|
|
24
|
+
fields?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* The maximum radius of a nearest selection (default 40). Marks with (x, y)
|
|
27
|
+
* coordinates outside this radius will not be selected as nearest points.
|
|
28
|
+
*/
|
|
29
|
+
maxRadius?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** A nearest interactor. */
|
|
33
|
+
export interface Nearest extends NearestOptions {
|
|
34
|
+
/** Select values from the mark closest to the pointer. */
|
|
35
|
+
select: 'nearest';
|
|
16
36
|
}
|
|
17
37
|
|
|
18
38
|
/** A nearestX interactor. */
|
|
19
39
|
export interface NearestX extends NearestOptions {
|
|
20
|
-
/** Select
|
|
40
|
+
/** Select values from the mark closest to the pointer *x* location. */
|
|
21
41
|
select: 'nearestX';
|
|
22
42
|
}
|
|
23
43
|
|
|
24
44
|
/** A nearestY interactor. */
|
|
25
45
|
export interface NearestY extends NearestOptions {
|
|
26
|
-
/** Select
|
|
46
|
+
/** Select values from the mark closest to the pointer *y* location. */
|
|
27
47
|
select: 'nearestY';
|
|
28
48
|
}
|
|
@@ -46,6 +46,15 @@ export interface ToggleY extends ToggleOptions {
|
|
|
46
46
|
select: 'toggleY';
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
/** A toggleZ interactor. */
|
|
50
|
+
export interface ToggleZ extends ToggleOptions {
|
|
51
|
+
/**
|
|
52
|
+
* Select individal values in the `z` scale domain.
|
|
53
|
+
* Clicking or touching a mark toggles its selection status.
|
|
54
|
+
*/
|
|
55
|
+
select: 'toggleZ';
|
|
56
|
+
}
|
|
57
|
+
|
|
49
58
|
/** A toggleColor interactor. */
|
|
50
59
|
export interface ToggleColor extends ToggleOptions {
|
|
51
60
|
/**
|
package/src/spec/marks/Dot.ts
CHANGED
|
@@ -19,6 +19,11 @@ export interface DotOptions extends MarkOptions {
|
|
|
19
19
|
*/
|
|
20
20
|
y?: ChannelValueSpec;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* An optional ordinal channel for grouping data into series.
|
|
24
|
+
*/
|
|
25
|
+
z?: ChannelValue;
|
|
26
|
+
|
|
22
27
|
/**
|
|
23
28
|
* The radius of dots; either a channel or constant. When a number, it is
|
|
24
29
|
* interpreted as a constant radius in pixels. Otherwise it is interpreted as
|