@uwdata/mosaic-spec 0.7.0 → 0.8.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 +186153 -0
- package/dist/mosaic-spec.js +3387 -4641
- package/dist/mosaic-spec.min.js +23 -23
- package/dist/types/ast/ASTNode.d.ts +26 -0
- package/dist/types/ast/DataNode.d.ts +60 -0
- package/dist/types/ast/ExpressionNode.d.ts +15 -0
- package/dist/types/ast/HConcatNode.d.ts +10 -0
- package/dist/types/ast/HSpaceNode.d.ts +11 -0
- package/dist/types/ast/InputNode.d.ts +8 -0
- package/dist/types/ast/LiteralNode.d.ts +7 -0
- package/dist/types/ast/OptionsNode.d.ts +10 -0
- package/dist/types/ast/ParamNode.d.ts +9 -0
- package/dist/types/ast/ParamRefNode.d.ts +8 -0
- package/dist/types/ast/PlotAttributeNode.d.ts +18 -0
- package/dist/types/ast/PlotFromNode.d.ts +9 -0
- package/dist/types/ast/PlotInteractorNode.d.ts +8 -0
- package/dist/types/ast/PlotLegendNode.d.ts +10 -0
- package/dist/types/ast/PlotMarkNode.d.ts +10 -0
- package/dist/types/ast/PlotNode.d.ts +11 -0
- package/dist/types/ast/SelectionNode.d.ts +12 -0
- package/dist/types/ast/SpecNode.d.ts +10 -0
- package/dist/types/ast/TransformNode.d.ts +13 -0
- package/dist/types/ast/VConcatNode.d.ts +10 -0
- package/dist/types/ast/VSpaceNode.d.ts +11 -0
- package/dist/types/ast-to-dom.d.ts +38 -0
- package/dist/types/ast-to-esm.d.ts +64 -0
- package/dist/types/config/components.d.ts +4 -0
- package/dist/types/config/extensions.d.ts +9 -0
- package/dist/types/config/inputs.d.ts +5 -0
- package/dist/types/config/plots.d.ts +34 -0
- package/dist/types/config/transforms.d.ts +4 -0
- package/dist/types/constants.d.ts +30 -0
- package/dist/types/index.d.ts +29 -0
- package/dist/types/parse-spec.d.ts +86 -0
- package/dist/types/spec/CSSStyles.d.ts +3 -0
- package/dist/types/spec/Data.d.ts +165 -0
- package/dist/types/spec/Expression.d.ts +27 -0
- package/dist/types/spec/HConcat.d.ts +8 -0
- package/dist/types/spec/HSpace.d.ts +9 -0
- package/dist/types/spec/Input.d.ts +182 -0
- package/dist/types/spec/Param.d.ts +51 -0
- package/dist/types/spec/Plot.d.ts +14 -0
- package/dist/types/spec/PlotAttribute.d.ts +1522 -0
- package/dist/types/spec/PlotFrom.d.ts +20 -0
- package/dist/types/spec/PlotInteractor.d.ts +8 -0
- package/dist/types/spec/PlotLegend.d.ts +68 -0
- package/dist/types/spec/PlotMark.d.ts +26 -0
- package/dist/types/spec/PlotTypes.d.ts +293 -0
- package/dist/types/spec/Spec.d.ts +45 -0
- package/dist/types/spec/Transform.d.ts +278 -0
- package/dist/types/spec/VConcat.d.ts +8 -0
- package/dist/types/spec/VSpace.d.ts +9 -0
- package/dist/types/spec/interactors/Highlight.d.ts +37 -0
- package/dist/types/spec/interactors/Interval1D.d.ts +63 -0
- package/dist/types/spec/interactors/Interval2D.d.ts +46 -0
- package/dist/types/spec/interactors/Nearest.d.ts +25 -0
- package/dist/types/spec/interactors/PanZoom.d.ts +58 -0
- package/dist/types/spec/interactors/Toggle.d.ts +51 -0
- package/dist/types/spec/marks/Area.d.ts +139 -0
- package/dist/types/spec/marks/Arrow.d.ts +94 -0
- package/dist/types/spec/marks/Axis.d.ts +281 -0
- package/dist/types/spec/marks/Bar.d.ts +150 -0
- package/dist/types/spec/marks/Cell.d.ts +57 -0
- package/dist/types/spec/marks/Contour.d.ts +23 -0
- package/dist/types/spec/marks/Delaunay.d.ts +86 -0
- package/dist/types/spec/marks/DenseLine.d.ts +27 -0
- package/dist/types/spec/marks/Density.d.ts +121 -0
- package/dist/types/spec/marks/Dot.d.ts +129 -0
- package/dist/types/spec/marks/Frame.d.ts +21 -0
- package/dist/types/spec/marks/Geo.d.ts +53 -0
- package/dist/types/spec/marks/Hexbin.d.ts +30 -0
- package/dist/types/spec/marks/Hexgrid.d.ts +25 -0
- package/dist/types/spec/marks/Image.d.ts +89 -0
- package/dist/types/spec/marks/Line.d.ts +82 -0
- package/dist/types/spec/marks/Link.d.ts +60 -0
- package/dist/types/spec/marks/Marks.d.ts +890 -0
- package/dist/types/spec/marks/Raster.d.ts +124 -0
- package/dist/types/spec/marks/Rect.d.ts +166 -0
- package/dist/types/spec/marks/Regression.d.ts +58 -0
- package/dist/types/spec/marks/Rule.d.ts +100 -0
- package/dist/types/spec/marks/Text.d.ts +106 -0
- package/dist/types/spec/marks/Tick.d.ts +61 -0
- package/dist/types/spec/marks/Vector.d.ts +99 -0
- package/dist/types/util.d.ts +12 -0
- package/jsconfig.json +10 -0
- package/package.json +16 -9
- package/src/ast/ASTNode.js +23 -2
- package/src/ast/DataNode.js +79 -21
- package/src/ast/HSpaceNode.js +1 -1
- package/src/ast/InputNode.js +1 -2
- package/src/ast/ParamNode.js +1 -2
- package/src/ast/PlotAttributeNode.js +1 -2
- package/src/ast/PlotInteractorNode.js +1 -2
- package/src/ast/PlotLegendNode.js +1 -2
- package/src/ast/PlotMarkNode.js +3 -2
- package/src/ast/TransformNode.js +1 -2
- package/src/ast/VSpaceNode.js +1 -1
- package/src/ast-to-dom.js +16 -7
- package/src/ast-to-esm.js +41 -12
- package/src/config/inputs.js +1 -0
- package/src/config/plots.js +4 -0
- package/src/index.js +4 -0
- package/src/parse-spec.js +38 -5
- package/src/spec/CSSStyles.ts +9 -0
- package/src/spec/Data.ts +184 -0
- package/src/spec/Expression.ts +31 -0
- package/src/spec/HConcat.ts +9 -0
- package/src/spec/HSpace.ts +9 -0
- package/src/spec/Input.ts +182 -0
- package/src/spec/Param.ts +68 -0
- package/src/spec/Plot.ts +15 -0
- package/src/spec/PlotAttribute.ts +1783 -0
- package/src/spec/PlotFrom.ts +23 -0
- package/src/spec/PlotInteractor.ts +25 -0
- package/src/spec/PlotLegend.ts +70 -0
- package/src/spec/PlotMark.ts +51 -0
- package/src/spec/PlotTypes.ts +519 -0
- package/src/spec/Spec.ts +63 -0
- package/src/spec/Transform.ts +394 -0
- package/src/spec/VConcat.ts +9 -0
- package/src/spec/VSpace.ts +9 -0
- package/src/spec/interactors/Highlight.ts +38 -0
- package/src/spec/interactors/Interval1D.ts +67 -0
- package/src/spec/interactors/Interval2D.ts +48 -0
- package/src/spec/interactors/Nearest.ts +28 -0
- package/src/spec/interactors/PanZoom.ts +65 -0
- package/src/spec/interactors/Toggle.ts +56 -0
- package/src/spec/marks/Area.ts +154 -0
- package/src/spec/marks/Arrow.ts +108 -0
- package/src/spec/marks/Axis.ts +305 -0
- package/src/spec/marks/Bar.ts +160 -0
- package/src/spec/marks/Cell.ts +62 -0
- package/src/spec/marks/Contour.ts +25 -0
- package/src/spec/marks/Delaunay.ts +95 -0
- package/src/spec/marks/DenseLine.ts +30 -0
- package/src/spec/marks/Density.ts +145 -0
- package/src/spec/marks/Dot.ts +147 -0
- package/src/spec/marks/Frame.ts +23 -0
- package/src/spec/marks/Geo.ts +58 -0
- package/src/spec/marks/Hexbin.ts +34 -0
- package/src/spec/marks/Hexgrid.ts +27 -0
- package/src/spec/marks/Image.ts +101 -0
- package/src/spec/marks/Line.ts +93 -0
- package/src/spec/marks/Link.ts +70 -0
- package/src/spec/marks/Marks.ts +1062 -0
- package/src/spec/marks/Raster.ts +145 -0
- package/src/spec/marks/Rect.ts +183 -0
- package/src/spec/marks/Regression.ts +63 -0
- package/src/spec/marks/Rule.ts +113 -0
- package/src/spec/marks/Text.ts +122 -0
- package/src/spec/marks/Tick.ts +69 -0
- package/src/spec/marks/Vector.ts +113 -0
- package/src/util.js +8 -0
- package/tsconfig.json +11 -0
package/src/spec/Spec.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { DataDefinition } from './Data.js';
|
|
2
|
+
import { ParamDefinition } from './Param.js';
|
|
3
|
+
import { HConcat } from './HConcat.js';
|
|
4
|
+
import { VConcat } from './VConcat.js';
|
|
5
|
+
import { HSpace } from './HSpace.js';
|
|
6
|
+
import { VSpace } from './VSpace.js';
|
|
7
|
+
import { Menu, Search, Slider, Table } from './Input.js';
|
|
8
|
+
import { Plot } from './Plot.js';
|
|
9
|
+
import { PlotMark } from './PlotMark.js';
|
|
10
|
+
import { Legend } from './PlotLegend.js';
|
|
11
|
+
import { PlotAttributes } from './PlotAttribute.js';
|
|
12
|
+
|
|
13
|
+
/** Specification metadata. */
|
|
14
|
+
export interface Meta extends Record<string, any> {
|
|
15
|
+
/** The specification title. */
|
|
16
|
+
title?: string;
|
|
17
|
+
/** A description of the specification content. */
|
|
18
|
+
description?: string;
|
|
19
|
+
/** Credits or other acknowledgements. */
|
|
20
|
+
credit?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Configuration options. */
|
|
24
|
+
export interface Config extends Record<string, any> {
|
|
25
|
+
extensions?: string | string[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Top-level dataset definitions. */
|
|
29
|
+
export type Data = Record<string, DataDefinition>;
|
|
30
|
+
|
|
31
|
+
/** Top-level Param and Selection definitions. */
|
|
32
|
+
export type Params = Record<string, ParamDefinition>;
|
|
33
|
+
|
|
34
|
+
/** Top-level specification properties. */
|
|
35
|
+
export interface SpecHead {
|
|
36
|
+
/** Specification metadata. */
|
|
37
|
+
meta?: Meta;
|
|
38
|
+
/** Configuration options. */
|
|
39
|
+
config?: Config;
|
|
40
|
+
/** Dataset definitions. */
|
|
41
|
+
data?: Data;
|
|
42
|
+
/** Param and Selection definitions. */
|
|
43
|
+
params?: Params;
|
|
44
|
+
/** A default set of attributes to apply to all plot components. */
|
|
45
|
+
plotDefaults?: PlotAttributes;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** A specifcation component such as a plot, input widget, or layout. */
|
|
49
|
+
export type Component =
|
|
50
|
+
| HConcat
|
|
51
|
+
| VConcat
|
|
52
|
+
| HSpace
|
|
53
|
+
| VSpace
|
|
54
|
+
| Menu
|
|
55
|
+
| Search
|
|
56
|
+
| Slider
|
|
57
|
+
| Table
|
|
58
|
+
| Plot
|
|
59
|
+
| PlotMark
|
|
60
|
+
| Legend;
|
|
61
|
+
|
|
62
|
+
/** A declarative Mosaic specification. */
|
|
63
|
+
export type Spec = SpecHead & Component;
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import { ParamRef } from './Param.js';
|
|
2
|
+
|
|
3
|
+
/** A field argument to a data transform. */
|
|
4
|
+
export type TransformField = string | ParamRef;
|
|
5
|
+
|
|
6
|
+
/** Window transform options. */
|
|
7
|
+
export interface WindowOptions {
|
|
8
|
+
orderby?: TransformField | TransformField[];
|
|
9
|
+
partitionby?: TransformField | TransformField[];
|
|
10
|
+
rows?: (number | null)[] | ParamRef;
|
|
11
|
+
range?: (number | null)[] | ParamRef;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Aggregate transform options. */
|
|
15
|
+
export interface AggregateOptions {
|
|
16
|
+
distinct?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** A transform argument. */
|
|
20
|
+
type Arg = string | number | boolean;
|
|
21
|
+
|
|
22
|
+
/** A zero argument transform signature. */
|
|
23
|
+
type Arg0 = null | [];
|
|
24
|
+
|
|
25
|
+
/** A single argument transform signature. */
|
|
26
|
+
type Arg1 = Arg | [Arg];
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A two argument transform signature; both arguments are required.
|
|
30
|
+
*/
|
|
31
|
+
type Arg2 = [Arg, Arg];
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A two argument transform signature; the second argument is optional.
|
|
35
|
+
*/
|
|
36
|
+
type Arg2Opt = Arg | [Arg, Arg?];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A three argument transform signature; the
|
|
40
|
+
* second and third arguments are optional.
|
|
41
|
+
*/
|
|
42
|
+
type Arg3Opt = Arg | [Arg, Arg?, Arg?];
|
|
43
|
+
|
|
44
|
+
/** Bin transform options. */
|
|
45
|
+
export interface BinOptions {
|
|
46
|
+
/**
|
|
47
|
+
* The target number of binning steps to use. To accommodate human-friendly
|
|
48
|
+
* bin boundaries, the actual number of bins may diverge from this exact number.
|
|
49
|
+
*/
|
|
50
|
+
steps?: number;
|
|
51
|
+
/**
|
|
52
|
+
* The minimum allowed bin step size (default `0`).
|
|
53
|
+
* For example, a setting of `1` will prevent step sizes less than 1.
|
|
54
|
+
*/
|
|
55
|
+
minstep?: number;
|
|
56
|
+
/**
|
|
57
|
+
* A flag requesting "nice" human-friendly step sizes (default `true`).
|
|
58
|
+
*/
|
|
59
|
+
nice?: true;
|
|
60
|
+
/**
|
|
61
|
+
* Offset for computed bins (default `0`). For example, a value of `1` will
|
|
62
|
+
* result in using the next consecutive bin boundary.
|
|
63
|
+
*/
|
|
64
|
+
offset?: number;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* A bin transform. */
|
|
68
|
+
export interface Bin {
|
|
69
|
+
/**
|
|
70
|
+
* Bin a continuous variable into discrete intervals. This transform accepts
|
|
71
|
+
* a data column to bin over as well as an optional bin options object.
|
|
72
|
+
*/
|
|
73
|
+
bin: Arg | [Arg] | [Arg, BinOptions];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* A dateMonth transform. */
|
|
77
|
+
export interface DateMonth {
|
|
78
|
+
/**
|
|
79
|
+
* Transform a Date value to a month boundary for cyclic comparison.
|
|
80
|
+
* Year values are collapsed to enable comparison over months only.
|
|
81
|
+
*/
|
|
82
|
+
dateMonth: Arg1;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* A dateMonthDay transform. */
|
|
86
|
+
export interface DateMonthDay {
|
|
87
|
+
/**
|
|
88
|
+
* Transform a Date value to a month and day boundary for cyclic comparison.
|
|
89
|
+
* Year values are collapsed to enable comparison over months and days only.
|
|
90
|
+
*/
|
|
91
|
+
dateMonthDay: Arg1;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* A dateDay transform. */
|
|
95
|
+
export interface DateDay {
|
|
96
|
+
/**
|
|
97
|
+
* Transform a Date value to a day of the month for cyclic comparison.
|
|
98
|
+
* Year and month values are collapsed to enable comparison over days only.
|
|
99
|
+
*/
|
|
100
|
+
dateDay: Arg1;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* A centroid transform. */
|
|
104
|
+
export interface Centroid {
|
|
105
|
+
/**
|
|
106
|
+
* Compute the 2D centroid of geometry-typed data.
|
|
107
|
+
* This transform requires the DuckDB `spatial` extension.
|
|
108
|
+
*/
|
|
109
|
+
centroid: Arg1;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* A centroidX transform. */
|
|
113
|
+
export interface CentroidX {
|
|
114
|
+
/**
|
|
115
|
+
* Compute the centroid x-coordinate of geometry-typed data.
|
|
116
|
+
* This transform requires the DuckDB `spatial` extension.
|
|
117
|
+
*/
|
|
118
|
+
centroidX: Arg1;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* A centroidY transform. */
|
|
122
|
+
export interface CentroidY {
|
|
123
|
+
/**
|
|
124
|
+
* Compute the centroid y-coordinate of geometry-typed data.
|
|
125
|
+
* This transform requires the DuckDB `spatial` extension.
|
|
126
|
+
*/
|
|
127
|
+
centroidY: Arg1;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* A geojson transform. */
|
|
131
|
+
export interface GeoJSON {
|
|
132
|
+
/**
|
|
133
|
+
* Compute a GeoJSON-formatted string from geometry-typed data.
|
|
134
|
+
* This transform requires the DuckDB `spatial` extension.
|
|
135
|
+
*/
|
|
136
|
+
geojson: Arg1;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* An argmax aggregate transform. */
|
|
140
|
+
export interface Argmax extends AggregateOptions, WindowOptions {
|
|
141
|
+
/**
|
|
142
|
+
* Find a value of the first column that maximizes the second column.
|
|
143
|
+
*/
|
|
144
|
+
argmax: Arg2;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* An argmin aggregate transform. */
|
|
148
|
+
export interface Argmin extends AggregateOptions, WindowOptions {
|
|
149
|
+
/**
|
|
150
|
+
* Find a value of the first column that minimizes the second column.
|
|
151
|
+
*/
|
|
152
|
+
argmin: Arg2;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* An avg (average, or mean) aggregate transform. */
|
|
156
|
+
export interface Avg extends AggregateOptions, WindowOptions {
|
|
157
|
+
/**
|
|
158
|
+
* Compute the average (mean) value of the given column.
|
|
159
|
+
*/
|
|
160
|
+
avg: Arg1;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* A count aggregate transform. */
|
|
164
|
+
export interface Count extends AggregateOptions, WindowOptions {
|
|
165
|
+
/**
|
|
166
|
+
* Compute the count of records in an aggregation group.
|
|
167
|
+
*/
|
|
168
|
+
count: Arg0 | Arg1;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* A first aggregate transform. */
|
|
172
|
+
export interface First extends AggregateOptions, WindowOptions {
|
|
173
|
+
/**
|
|
174
|
+
* Return the first column value found in an aggregation group.
|
|
175
|
+
*/
|
|
176
|
+
first: Arg1;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* A last aggregate transform. */
|
|
180
|
+
export interface Last extends AggregateOptions, WindowOptions {
|
|
181
|
+
/**
|
|
182
|
+
* Return the last column value found in an aggregation group.
|
|
183
|
+
*/
|
|
184
|
+
last: Arg1;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* A max aggregate transform. */
|
|
188
|
+
export interface Max extends AggregateOptions, WindowOptions {
|
|
189
|
+
/**
|
|
190
|
+
* Compute the maximum value of the given column.
|
|
191
|
+
*/
|
|
192
|
+
max: Arg1;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* A min aggregate transform. */
|
|
196
|
+
export interface Min extends AggregateOptions, WindowOptions {
|
|
197
|
+
/**
|
|
198
|
+
* Compute the minimum value of the given column.
|
|
199
|
+
*/
|
|
200
|
+
min: Arg1;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* A median aggregate transform. */
|
|
204
|
+
export interface Median extends AggregateOptions, WindowOptions {
|
|
205
|
+
/**
|
|
206
|
+
* Compute the median value of the given column.
|
|
207
|
+
*/
|
|
208
|
+
median: Arg1;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* A mode aggregate transform. */
|
|
212
|
+
export interface Mode extends AggregateOptions, WindowOptions {
|
|
213
|
+
/**
|
|
214
|
+
* Compute the mode value of the given column.
|
|
215
|
+
*/
|
|
216
|
+
mode: Arg1;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* A product aggregate transform. */
|
|
220
|
+
export interface Product extends AggregateOptions, WindowOptions {
|
|
221
|
+
/**
|
|
222
|
+
* Compute the product of the given column.
|
|
223
|
+
*/
|
|
224
|
+
product: Arg1;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/* A quantile aggregate transform. */
|
|
228
|
+
export interface Quantile extends AggregateOptions, WindowOptions {
|
|
229
|
+
/**
|
|
230
|
+
* Compute the quantile value of the given column at the provided
|
|
231
|
+
* probability threshold. For example, 0.5 is the median.
|
|
232
|
+
*/
|
|
233
|
+
quantile: Arg2;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/* A sum aggregate transform. */
|
|
237
|
+
export interface Sum extends AggregateOptions, WindowOptions {
|
|
238
|
+
/**
|
|
239
|
+
* Compute the sum of the given column.
|
|
240
|
+
*/
|
|
241
|
+
sum: Arg1;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* A row_number window transform. */
|
|
245
|
+
export interface RowNumber extends WindowOptions {
|
|
246
|
+
/**
|
|
247
|
+
* Compute the 1-based row number over an ordered window partition.
|
|
248
|
+
*/
|
|
249
|
+
row_number: Arg0;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/* A rank window transform. */
|
|
253
|
+
export interface Rank extends WindowOptions {
|
|
254
|
+
/**
|
|
255
|
+
* Compute the row rank over an ordered window partition.
|
|
256
|
+
* Sorting ties result in gaps in the rank numbers ([1, 1, 3, ...]).
|
|
257
|
+
*/
|
|
258
|
+
rank: Arg0;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/* A dense_rank window transform. */
|
|
262
|
+
export interface DenseRank extends WindowOptions {
|
|
263
|
+
/**
|
|
264
|
+
* Compute the dense row rank (no gaps) over an ordered window partition.
|
|
265
|
+
* Sorting ties do not result in gaps in the rank numbers ( [1, 1, 2, ...]).
|
|
266
|
+
*/
|
|
267
|
+
dense_rank: Arg0;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/* A percent_rank window transform. */
|
|
271
|
+
export interface PercentRank extends WindowOptions {
|
|
272
|
+
/**
|
|
273
|
+
* Compute the percetange rank over an ordered window partition.
|
|
274
|
+
*/
|
|
275
|
+
percent_rank: Arg0;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* A cume_dist window transform. */
|
|
279
|
+
export interface CumeDist extends WindowOptions {
|
|
280
|
+
/**
|
|
281
|
+
* Compute the cumulative distribution value over an ordered window
|
|
282
|
+
* partition. Equals the number of partition rows preceding or peer with
|
|
283
|
+
* the current row, divided by the total number of partition rows.
|
|
284
|
+
*/
|
|
285
|
+
cume_dist: Arg0;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/* An ntile window transform. */
|
|
289
|
+
export interface NTile extends WindowOptions {
|
|
290
|
+
/**
|
|
291
|
+
* Compute an n-tile integer ranging from 1 to the provided argument
|
|
292
|
+
* (num_buckets), dividing the partition as equally as possible.
|
|
293
|
+
*/
|
|
294
|
+
ntile: Arg1;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* A lag window transform. */
|
|
298
|
+
export interface Lag extends WindowOptions {
|
|
299
|
+
/**
|
|
300
|
+
* Compute lagging values in a column. Returns the value at the row that is
|
|
301
|
+
* `offset` (second argument, default `1`) rows before the current row within
|
|
302
|
+
* the window frame. If there is no such row, instead return `default` (third
|
|
303
|
+
* argument, default `null`). Both offset and default are evaluated with
|
|
304
|
+
* respect to the current row.
|
|
305
|
+
*/
|
|
306
|
+
lag: Arg3Opt;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/* A lead window transform. */
|
|
310
|
+
export interface Lead extends WindowOptions {
|
|
311
|
+
/**
|
|
312
|
+
* Compute leading values in a column. Returns the value at the row that is
|
|
313
|
+
* `offset` (second argument, default `1`) rows after the current row within
|
|
314
|
+
* the window frame. If there is no such row, instead return `default` (third
|
|
315
|
+
* argument, default `null`). Both offset and default are evaluated with
|
|
316
|
+
* respect to the current row.
|
|
317
|
+
*/
|
|
318
|
+
lag: Arg3Opt;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/* A first_value window transform. */
|
|
322
|
+
export interface FirstValue extends WindowOptions {
|
|
323
|
+
/**
|
|
324
|
+
* Get the first value of the given column in the current window frame.
|
|
325
|
+
*/
|
|
326
|
+
first_value: Arg1;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/* A last_value window transform. */
|
|
330
|
+
export interface LastValue extends WindowOptions {
|
|
331
|
+
/**
|
|
332
|
+
* Get the last value of the given column in the current window frame.
|
|
333
|
+
*/
|
|
334
|
+
last_value: Arg1;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/* An nth_value window transform. */
|
|
338
|
+
export interface NthValue extends WindowOptions {
|
|
339
|
+
/**
|
|
340
|
+
* Get the nth value of the given column in the current window frame,
|
|
341
|
+
* counting from one. The second argument is the offset for the nth row.
|
|
342
|
+
*/
|
|
343
|
+
nth_value: Arg2Opt;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** A data transform that maps one column value to another. */
|
|
347
|
+
export type ColumnTransform =
|
|
348
|
+
| Bin
|
|
349
|
+
| DateMonth
|
|
350
|
+
| DateMonthDay
|
|
351
|
+
| DateDay
|
|
352
|
+
| Centroid
|
|
353
|
+
| CentroidX
|
|
354
|
+
| CentroidY
|
|
355
|
+
| GeoJSON;
|
|
356
|
+
|
|
357
|
+
/** An aggregate transform that combines multiple values. */
|
|
358
|
+
export type AggregateTransform =
|
|
359
|
+
| Argmax
|
|
360
|
+
| Argmin
|
|
361
|
+
| Avg
|
|
362
|
+
| Count
|
|
363
|
+
| Max
|
|
364
|
+
| Min
|
|
365
|
+
| First
|
|
366
|
+
| Last
|
|
367
|
+
| Max
|
|
368
|
+
| Min
|
|
369
|
+
| Median
|
|
370
|
+
| Mode
|
|
371
|
+
| Product
|
|
372
|
+
| Quantile
|
|
373
|
+
| Sum;
|
|
374
|
+
|
|
375
|
+
/* A window transform that operates over a sorted domain. */
|
|
376
|
+
export type WindowTransform =
|
|
377
|
+
| RowNumber
|
|
378
|
+
| Rank
|
|
379
|
+
| DenseRank
|
|
380
|
+
| PercentRank
|
|
381
|
+
| CumeDist
|
|
382
|
+
| NTile
|
|
383
|
+
| Rank
|
|
384
|
+
| Lag
|
|
385
|
+
| Lead
|
|
386
|
+
| FirstValue
|
|
387
|
+
| LastValue
|
|
388
|
+
| NthValue;
|
|
389
|
+
|
|
390
|
+
/** A data transform. */
|
|
391
|
+
export type Transform =
|
|
392
|
+
| ColumnTransform
|
|
393
|
+
| AggregateTransform
|
|
394
|
+
| WindowTransform;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
|
|
3
|
+
/** A highlight interactor. */
|
|
4
|
+
export interface Highlight {
|
|
5
|
+
/**
|
|
6
|
+
* Highlight selected marks by deemphasizing the others.
|
|
7
|
+
*/
|
|
8
|
+
select: 'highlight';
|
|
9
|
+
/**
|
|
10
|
+
* The input selection. Unselected marks are deemphasized.
|
|
11
|
+
*/
|
|
12
|
+
by: ParamRef;
|
|
13
|
+
/**
|
|
14
|
+
* The overall opacity of deemphasized marks.
|
|
15
|
+
* By default the opacity is set to 0.2.
|
|
16
|
+
*/
|
|
17
|
+
opacity?: number;
|
|
18
|
+
/**
|
|
19
|
+
* The fill opacity of deemphasized marks.
|
|
20
|
+
* By default the fill opacity is unchanged.
|
|
21
|
+
*/
|
|
22
|
+
fillOpacity?: number;
|
|
23
|
+
/**
|
|
24
|
+
* The stroke opacity of deemphasized marks.
|
|
25
|
+
* By default the stroke opacity is unchanged.
|
|
26
|
+
*/
|
|
27
|
+
strokeOpacity?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The fill color of deemphasized marks.
|
|
30
|
+
* By default the fill is unchanged.
|
|
31
|
+
*/
|
|
32
|
+
fill?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The stroke color of deemphasized marks.
|
|
35
|
+
* By default the stroke is unchanged.
|
|
36
|
+
*/
|
|
37
|
+
stroke?: string;
|
|
38
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
|
|
3
|
+
/** Styles for rectangular selection brushes. */
|
|
4
|
+
export interface BrushStyles {
|
|
5
|
+
/**
|
|
6
|
+
* The overall opacity of the brush rectangle.
|
|
7
|
+
*/
|
|
8
|
+
opacity?: number;
|
|
9
|
+
/**
|
|
10
|
+
* The fill opacity of the brush rectangle.
|
|
11
|
+
*/
|
|
12
|
+
fillOpacity?: number;
|
|
13
|
+
/**
|
|
14
|
+
* The stroke opacity of the brush rectangle.
|
|
15
|
+
*/
|
|
16
|
+
strokeOpacity?: number;
|
|
17
|
+
/**
|
|
18
|
+
* The fill color of the brush rectangle.
|
|
19
|
+
*/
|
|
20
|
+
fill?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The stroke color of the brush rectangle.
|
|
23
|
+
*/
|
|
24
|
+
stroke?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Options for 1D interval interactors. */
|
|
28
|
+
export interface Interval1DOptions {
|
|
29
|
+
/**
|
|
30
|
+
* The output selection. A clause of the form `field BETWEEN lo AND hi`
|
|
31
|
+
* is added for the currently selected interval [lo, hi].
|
|
32
|
+
*/
|
|
33
|
+
as: ParamRef;
|
|
34
|
+
/**
|
|
35
|
+
* The name of the field (database column) over which the interval
|
|
36
|
+
* selection should be defined. If unspecified, the channel field of the
|
|
37
|
+
* first valid prior mark definition is used.
|
|
38
|
+
*/
|
|
39
|
+
field?: string;
|
|
40
|
+
/**
|
|
41
|
+
* The size of an interative pixel (default `1`). Larger pixel sizes reduce
|
|
42
|
+
* the brush resolution, which can reduce the size of data cube indexes.
|
|
43
|
+
*/
|
|
44
|
+
pixelSize?: number;
|
|
45
|
+
/**
|
|
46
|
+
* A flag indicating if peer (sibling) marks are when cross-filtering
|
|
47
|
+
* (default `true`). If set, peer marks will not be filtered by this
|
|
48
|
+
* interactor's selection in cross-filtering setups.
|
|
49
|
+
*/
|
|
50
|
+
peers?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* CSS styles for the brush (SVG `rect`) element.
|
|
53
|
+
*/
|
|
54
|
+
brush?: BrushStyles;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** An intervalX interactor. */
|
|
58
|
+
export interface IntervalX extends Interval1DOptions {
|
|
59
|
+
/** Select a continuous 1D interval selection over the `x` scale domain. */
|
|
60
|
+
select: 'intervalX';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** An intervalY interactor. */
|
|
64
|
+
export interface IntervalY extends Interval1DOptions {
|
|
65
|
+
/** Select a continuous 1D interval selection over the `y` scale domain. */
|
|
66
|
+
select: 'intervalY';
|
|
67
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
import { BrushStyles } from './Interval1D.js';
|
|
3
|
+
|
|
4
|
+
/** Options for 2D interval interactors. */
|
|
5
|
+
export interface Interval2DOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The output selection. A clause of the form
|
|
8
|
+
* `(xfield BETWEEN x1 AND x2) AND (yfield BETWEEN y1 AND y2)`
|
|
9
|
+
* is added for the currently selected intervals.
|
|
10
|
+
*/
|
|
11
|
+
as: ParamRef;
|
|
12
|
+
/**
|
|
13
|
+
* The name of the field (database column) over which the `x`-component
|
|
14
|
+
* of the interval selection should be defined. If unspecified, the `x`
|
|
15
|
+
* channel field of the first valid prior mark definition is used.
|
|
16
|
+
*/
|
|
17
|
+
xfield?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The name of the field (database column) over which the `y`-component
|
|
20
|
+
* of the interval selection should be defined. If unspecified, the `y`
|
|
21
|
+
* channel field of the first valid prior mark definition is used.
|
|
22
|
+
*/
|
|
23
|
+
yfield?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The size of an interative pixel (default `1`). Larger pixel sizes reduce
|
|
26
|
+
* the brush resolution, which can reduce the size of data cube indexes.
|
|
27
|
+
*/
|
|
28
|
+
pixelSize?: number;
|
|
29
|
+
/**
|
|
30
|
+
* A flag indicating if peer (sibling) marks are when cross-filtering
|
|
31
|
+
* (default `true`). If set, peer marks will not be filtered by this
|
|
32
|
+
* interactor's selection in cross-filtering setups.
|
|
33
|
+
*/
|
|
34
|
+
peers?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* CSS styles for the brush (SVG `rect`) element.
|
|
37
|
+
*/
|
|
38
|
+
brush?: BrushStyles;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** An intervalXY interactor. */
|
|
42
|
+
export interface IntervalXY extends Interval2DOptions {
|
|
43
|
+
/**
|
|
44
|
+
* Select a continuous 2D interval selection
|
|
45
|
+
* over the `x` and `y` scale domains.
|
|
46
|
+
*/
|
|
47
|
+
select: 'intervalXY';
|
|
48
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
|
|
3
|
+
/** Options for nearest interactors. */
|
|
4
|
+
export interface NearestOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The output selection. A clause of the form `field = value`
|
|
7
|
+
* is added for the currently nearest value.
|
|
8
|
+
*/
|
|
9
|
+
as: ParamRef;
|
|
10
|
+
/**
|
|
11
|
+
* The name of the field (database column) over which the nearest
|
|
12
|
+
* selection should be defined. If unspecified, the channel field of the
|
|
13
|
+
* first valid prior mark definition is used.
|
|
14
|
+
*/
|
|
15
|
+
field?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** A nearestX interactor. */
|
|
19
|
+
export interface NearestX extends NearestOptions {
|
|
20
|
+
/** Select the **x** domain value of the mark closest to the pointer. */
|
|
21
|
+
select: 'nearestX';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** A nearestY interactor. */
|
|
25
|
+
export interface NearestY extends NearestOptions {
|
|
26
|
+
/** Select the **y** domain value of the mark closest to the pointer. */
|
|
27
|
+
select: 'nearestY';
|
|
28
|
+
}
|