@uwdata/mosaic-spec 0.10.0 → 0.12.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 +2122 -422
- package/dist/mosaic-spec.js +7783 -15281
- package/dist/mosaic-spec.min.js +29 -38
- package/dist/types/ast/ColumnParamRefNode.d.ts +8 -0
- package/dist/types/ast/ExpressionNode.d.ts +2 -4
- package/dist/types/ast/ParamNode.d.ts +1 -2
- package/dist/types/ast/ParamRefNode.d.ts +1 -1
- package/dist/types/ast/SelectionNode.d.ts +15 -5
- package/dist/types/constants.d.ts +2 -1
- package/dist/types/parse-spec.d.ts +33 -8
- package/dist/types/spec/Input.d.ts +1 -1
- package/dist/types/spec/Param.d.ts +6 -0
- package/dist/types/spec/PlotAttribute.d.ts +11 -5
- package/dist/types/spec/PlotFrom.d.ts +1 -1
- package/dist/types/spec/PlotInteractor.d.ts +2 -1
- package/dist/types/spec/Transform.d.ts +8 -2
- package/dist/types/spec/interactors/BrushStyles.d.ts +27 -0
- package/dist/types/spec/interactors/Interval1D.d.ts +6 -27
- package/dist/types/spec/interactors/Interval2D.d.ts +6 -5
- package/dist/types/spec/interactors/Region.d.ts +32 -0
- package/dist/types/spec/interactors/Toggle.d.ts +3 -3
- package/dist/types/spec/marks/Marks.d.ts +5 -0
- package/package.json +7 -7
- package/src/ast/ColumnParamRefNode.js +21 -0
- package/src/ast/DataNode.js +3 -3
- package/src/ast/ExpressionNode.js +17 -22
- package/src/ast/ParamNode.js +3 -4
- package/src/ast/ParamRefNode.js +1 -1
- package/src/ast/PlotFromNode.js +6 -6
- package/src/ast/PlotMarkNode.js +2 -2
- package/src/ast/SelectionNode.js +46 -14
- package/src/ast/TransformNode.js +14 -12
- package/src/config/transforms.js +1 -0
- package/src/constants.js +2 -1
- package/src/parse-spec.js +53 -16
- package/src/spec/Input.ts +1 -1
- package/src/spec/Param.ts +7 -0
- package/src/spec/PlotAttribute.ts +13 -5
- package/src/spec/PlotFrom.ts +1 -1
- package/src/spec/PlotInteractor.ts +7 -5
- package/src/spec/Spec.ts +1 -1
- package/src/spec/Transform.ts +10 -1
- package/src/spec/interactors/BrushStyles.ts +27 -0
- package/src/spec/interactors/Interval1D.ts +6 -28
- package/src/spec/interactors/Interval2D.ts +6 -5
- package/src/spec/interactors/Region.ts +34 -0
- package/src/spec/interactors/Toggle.ts +3 -3
- package/src/spec/marks/Marks.ts +6 -0
package/src/ast/PlotMarkNode.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MARK, SQL } from '../constants.js';
|
|
2
2
|
import { isObject } from '../util.js';
|
|
3
3
|
import { ASTNode } from './ASTNode.js';
|
|
4
4
|
import { parseExpression } from './ExpressionNode.js';
|
|
@@ -8,7 +8,7 @@ import { parseTransform } from './TransformNode.js';
|
|
|
8
8
|
|
|
9
9
|
function maybeTransform(value, ctx) {
|
|
10
10
|
if (isObject(value)) {
|
|
11
|
-
return
|
|
11
|
+
return value[SQL]
|
|
12
12
|
? parseExpression(value, ctx)
|
|
13
13
|
: parseTransform(value, ctx);
|
|
14
14
|
}
|
package/src/ast/SelectionNode.js
CHANGED
|
@@ -1,30 +1,62 @@
|
|
|
1
1
|
import { ASTNode } from './ASTNode.js';
|
|
2
|
-
import {
|
|
2
|
+
import { OptionsNode, parseOptions } from './OptionsNode.js';
|
|
3
|
+
import { INCLUDE, INTERSECT, SELECTION } from '../constants.js';
|
|
4
|
+
import { paramRef, toArray } from '../util.js';
|
|
5
|
+
|
|
6
|
+
export function parseSelection(spec, ctx) {
|
|
7
|
+
const { select, include, ...options } = spec;
|
|
8
|
+
const opt = parseOptions(options, ctx);
|
|
9
|
+
if (include) {
|
|
10
|
+
opt.options.include = new IncludeNode(
|
|
11
|
+
toArray(include).map(ref => ctx.selectionRef(paramRef(ref)))
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
return new SelectionNode(select, opt);
|
|
15
|
+
}
|
|
3
16
|
|
|
4
17
|
export class SelectionNode extends ASTNode {
|
|
5
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Create a Selection AST node.
|
|
20
|
+
* @param {string} select The selection type.
|
|
21
|
+
* @param {OptionsNode} options Selection options.
|
|
22
|
+
*/
|
|
23
|
+
constructor(select = INTERSECT, options = new OptionsNode({})) {
|
|
6
24
|
super(SELECTION);
|
|
7
25
|
this.select = select;
|
|
8
|
-
this.
|
|
9
|
-
|
|
26
|
+
this.options = options;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
instantiate(ctx) {
|
|
30
|
+
const { select, options } = this;
|
|
31
|
+
return ctx.api.Selection[select](options.instantiate(ctx));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
codegen(ctx) {
|
|
35
|
+
const { select, options } = this;
|
|
36
|
+
return `${ctx.ns()}Selection.${select}(${options.codegen(ctx)})`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
toJSON() {
|
|
40
|
+
const { select, options } = this;
|
|
41
|
+
return { select, ...options.toJSON() };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export class IncludeNode extends ASTNode {
|
|
46
|
+
constructor(refs) {
|
|
47
|
+
super(INCLUDE);
|
|
48
|
+
this.refs = refs;
|
|
10
49
|
}
|
|
11
50
|
|
|
12
51
|
instantiate(ctx) {
|
|
13
|
-
|
|
14
|
-
return ctx.api.Selection[select]({ cross, empty });
|
|
52
|
+
return this.refs.map(ref => ref.instantiate(ctx));
|
|
15
53
|
}
|
|
16
54
|
|
|
17
55
|
codegen(ctx) {
|
|
18
|
-
|
|
19
|
-
const args = [['cross', cross], ['empty', empty]]
|
|
20
|
-
.filter(a => a[1] != null)
|
|
21
|
-
.map(a => `${a[0]}: ${a[1]}`);
|
|
22
|
-
const arg = args.length ? `{ ${args.join(', ')} }` : '';
|
|
23
|
-
return `${ctx.ns()}Selection.${select}(${arg})`;
|
|
56
|
+
return `[${this.refs.map(ref => ref.codegen(ctx)).join(', ')}]`;
|
|
24
57
|
}
|
|
25
58
|
|
|
26
59
|
toJSON() {
|
|
27
|
-
|
|
28
|
-
return { select, cross, empty };
|
|
60
|
+
return this.refs.map(ref => ref.toJSON());
|
|
29
61
|
}
|
|
30
62
|
}
|
package/src/ast/TransformNode.js
CHANGED
|
@@ -2,8 +2,10 @@ import { ASTNode } from './ASTNode.js';
|
|
|
2
2
|
import { TRANSFORM } from '../constants.js';
|
|
3
3
|
import { parseOptions } from './OptionsNode.js';
|
|
4
4
|
|
|
5
|
-
function toArray(value) {
|
|
6
|
-
return value == null
|
|
5
|
+
function toArray(value, ctx) {
|
|
6
|
+
return value == null
|
|
7
|
+
? []
|
|
8
|
+
: [value].flat().map(v => ctx.maybeParam(v));
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export function parseTransform(spec, ctx) {
|
|
@@ -20,14 +22,14 @@ export function parseTransform(spec, ctx) {
|
|
|
20
22
|
|
|
21
23
|
if (name === 'bin') {
|
|
22
24
|
const { bin, ...options } = spec;
|
|
23
|
-
const [arg] = toArray(bin);
|
|
25
|
+
const [arg] = toArray(bin, ctx);
|
|
24
26
|
return new BinTransformNode(name, arg, parseOptions(options, ctx));
|
|
25
27
|
} else {
|
|
26
|
-
const args = name === 'count' && !spec[name] ? [] : toArray(spec[name]);
|
|
28
|
+
const args = name === 'count' && !spec[name] ? [] : toArray(spec[name], ctx);
|
|
27
29
|
const options = {
|
|
28
30
|
distinct: spec.distinct,
|
|
29
|
-
orderby: toArray(spec.orderby
|
|
30
|
-
partitionby: toArray(spec.partitionby
|
|
31
|
+
orderby: toArray(spec.orderby, ctx),
|
|
32
|
+
partitionby: toArray(spec.partitionby, ctx),
|
|
31
33
|
rows: spec.rows ? ctx.maybeParam(spec.rows) : null,
|
|
32
34
|
range: spec.range ? ctx.maybeParam(spec.range) : null
|
|
33
35
|
};
|
|
@@ -47,7 +49,7 @@ export class TransformNode extends ASTNode {
|
|
|
47
49
|
const { name, args, options } = this;
|
|
48
50
|
const { distinct, orderby, partitionby, rows, range } = options;
|
|
49
51
|
|
|
50
|
-
let expr = ctx.api[name](...args);
|
|
52
|
+
let expr = ctx.api[name](...args.map(a => a.instantiate(ctx)));
|
|
51
53
|
if (distinct) {
|
|
52
54
|
expr = expr.distinct();
|
|
53
55
|
}
|
|
@@ -70,7 +72,7 @@ export class TransformNode extends ASTNode {
|
|
|
70
72
|
const { distinct, orderby, partitionby, rows, range } = options;
|
|
71
73
|
|
|
72
74
|
let str = `${ctx.ns()}${name}(`
|
|
73
|
-
+ args.map(v =>
|
|
75
|
+
+ args.map(v => v.codegen(ctx)).join(', ')
|
|
74
76
|
+ ')';
|
|
75
77
|
|
|
76
78
|
if (distinct) {
|
|
@@ -97,7 +99,7 @@ export class TransformNode extends ASTNode {
|
|
|
97
99
|
const { name, args, options } = this;
|
|
98
100
|
const { distinct, orderby, partitionby, rows, range } = options;
|
|
99
101
|
|
|
100
|
-
const json = { [name]: simplify(args) };
|
|
102
|
+
const json = { [name]: simplify(args.map(v => v.toJSON())) };
|
|
101
103
|
|
|
102
104
|
if (distinct) {
|
|
103
105
|
json.distinct = true;
|
|
@@ -128,21 +130,21 @@ export class BinTransformNode extends ASTNode {
|
|
|
128
130
|
|
|
129
131
|
instantiate(ctx) {
|
|
130
132
|
const { name, arg, options } = this;
|
|
131
|
-
return ctx.api[name](arg, options.instantiate(ctx));
|
|
133
|
+
return ctx.api[name](arg.instantiate(ctx), options.instantiate(ctx));
|
|
132
134
|
}
|
|
133
135
|
|
|
134
136
|
codegen(ctx) {
|
|
135
137
|
const { name, arg, options } = this;
|
|
136
138
|
const opt = options.codegen(ctx);
|
|
137
139
|
return `${ctx.ns()}${name}(`
|
|
138
|
-
+
|
|
140
|
+
+ arg.codegen(ctx)
|
|
139
141
|
+ (opt ? `, ${opt}` : '')
|
|
140
142
|
+ ')';
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
toJSON() {
|
|
144
146
|
const { name, arg, options } = this;
|
|
145
|
-
return { [name]: arg, ...options.toJSON() };
|
|
147
|
+
return { [name]: arg.toJSON(), ...options.toJSON() };
|
|
146
148
|
}
|
|
147
149
|
}
|
|
148
150
|
|
package/src/config/transforms.js
CHANGED
package/src/constants.js
CHANGED
|
@@ -13,7 +13,9 @@ export const OPTIONS = 'options';
|
|
|
13
13
|
// params and selections
|
|
14
14
|
export const SELECTION = 'selection';
|
|
15
15
|
export const PARAMREF = 'paramref';
|
|
16
|
+
export const COLUMPARAMREF = 'columnparamref';
|
|
16
17
|
export const PARAM = 'param';
|
|
18
|
+
export const INCLUDE = 'include';
|
|
17
19
|
|
|
18
20
|
// param and selection types
|
|
19
21
|
export const SELECT = 'select';
|
|
@@ -29,7 +31,6 @@ export const DATA = 'data';
|
|
|
29
31
|
// sql expressions
|
|
30
32
|
export const EXPRESSION = 'expression';
|
|
31
33
|
export const SQL = 'sql';
|
|
32
|
-
export const AGG = 'agg';
|
|
33
34
|
|
|
34
35
|
// inputs
|
|
35
36
|
export const INPUT = 'input';
|
package/src/parse-spec.js
CHANGED
|
@@ -68,7 +68,6 @@ export class ParseContext {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
parse(spec) {
|
|
71
|
-
// eslint-disable-next-line no-unused-vars
|
|
72
71
|
const {
|
|
73
72
|
meta,
|
|
74
73
|
config,
|
|
@@ -113,29 +112,67 @@ export class ParseContext {
|
|
|
113
112
|
}
|
|
114
113
|
|
|
115
114
|
/**
|
|
116
|
-
* Test if a value is param reference, if so,
|
|
117
|
-
* as needed and
|
|
115
|
+
* Test if a value is a param reference, if so, generates a parameter
|
|
116
|
+
* definition as needed and returns a new ParamRefNode. Otherwise,
|
|
117
|
+
* returns a LiteralNode for the given value.
|
|
118
118
|
* @param {*} value The value to test.
|
|
119
|
-
* @param {() => ParamNode | SelectionNode} [makeNode] A Param of Selection AST
|
|
120
|
-
* node constructor.
|
|
121
119
|
* @returns {ParamRefNode|LiteralNode} An AST node for the input value.
|
|
122
120
|
*/
|
|
123
|
-
maybeParam(value
|
|
124
|
-
const { params } = this;
|
|
121
|
+
maybeParam(value) {
|
|
125
122
|
const name = paramRef(value);
|
|
123
|
+
return name
|
|
124
|
+
? this.paramRef(name)
|
|
125
|
+
: new LiteralNode(value);
|
|
126
|
+
}
|
|
126
127
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Test if a value is a param reference, if so, generates a selection
|
|
130
|
+
* definition as needed and returns a new ParamRefNode. Otherwise,
|
|
131
|
+
* returns a LiteralNode for the given value.
|
|
132
|
+
* @param {*} value The value to test.
|
|
133
|
+
* @returns {ParamRefNode|LiteralNode} An AST node for the input value.
|
|
134
|
+
*/
|
|
135
|
+
maybeSelection(value) {
|
|
136
|
+
const name = paramRef(value);
|
|
137
|
+
return name
|
|
138
|
+
? this.selectionRef(name)
|
|
139
|
+
: new LiteralNode(value);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Create a parameter reference. Generates a parameter definition if needed
|
|
144
|
+
* and returns a new ParamRefNode.
|
|
145
|
+
* @param {string} name The parameter name.
|
|
146
|
+
* @param {() => ParamNode | SelectionNode} [makeNode] A Param or Selection AST
|
|
147
|
+
* node constructor.
|
|
148
|
+
* @returns {ParamRefNode|null} A node referring to the param or selection.
|
|
149
|
+
*/
|
|
150
|
+
paramRef(name, makeNode = () => new ParamNode) {
|
|
151
|
+
const { params } = this;
|
|
152
|
+
if (!name) return null;
|
|
153
|
+
let p = params.get(name);
|
|
154
|
+
if (!p) {
|
|
155
|
+
p = makeNode();
|
|
156
|
+
params.set(name, p);
|
|
133
157
|
}
|
|
134
|
-
return new
|
|
158
|
+
return new ParamRefNode(name);
|
|
135
159
|
}
|
|
136
160
|
|
|
137
|
-
|
|
138
|
-
|
|
161
|
+
/**
|
|
162
|
+
* Create a selection reference. Generates a selection definition if needed
|
|
163
|
+
* and returns a new ParamRefNode. Returns null if a non-selection parameter
|
|
164
|
+
* with the same name already exists and *strict* is true.
|
|
165
|
+
* @param {string} name The selection name.
|
|
166
|
+
* @param {boolean} [strict=false] Indicates if this method may return param
|
|
167
|
+
* references (false, default) or only selection references (true).
|
|
168
|
+
* @returns {ParamRefNode|null} A node referring to the param or selection.
|
|
169
|
+
*/
|
|
170
|
+
selectionRef(name, strict = false) {
|
|
171
|
+
const p = this.params.get(name);
|
|
172
|
+
if (strict && p && !(p instanceof SelectionNode)) {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
return this.paramRef(name, () => new SelectionNode);
|
|
139
176
|
}
|
|
140
177
|
|
|
141
178
|
error(message, data) {
|
package/src/spec/Input.ts
CHANGED
|
@@ -171,7 +171,7 @@ export interface Table {
|
|
|
171
171
|
/**
|
|
172
172
|
* The name of a database table to use as a data source for this widget.
|
|
173
173
|
*/
|
|
174
|
-
from: string;
|
|
174
|
+
from: string | ParamRef;
|
|
175
175
|
/**
|
|
176
176
|
* A list of column names to include in the table grid.
|
|
177
177
|
* If unspecified, all table columns are included.
|
package/src/spec/Param.ts
CHANGED
|
@@ -65,6 +65,13 @@ export interface Selection {
|
|
|
65
65
|
* false, a selection with no clauses selects all values.
|
|
66
66
|
*/
|
|
67
67
|
empty?: boolean;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Upstream selections whose clauses should be included as part of this
|
|
71
|
+
* selection. Any clauses or activations published to the upstream
|
|
72
|
+
* selections will be relayed to this selection.
|
|
73
|
+
*/
|
|
74
|
+
include?: ParamRef | ParamRef[];
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
/** A Param or Selection definition. */
|
|
@@ -178,13 +178,21 @@ export interface PlotAttributes {
|
|
|
178
178
|
grid?: boolean | string | ParamRef;
|
|
179
179
|
|
|
180
180
|
/**
|
|
181
|
-
*
|
|
182
|
-
* default the scale label is inferred from channel definitions, possibly with
|
|
183
|
-
* an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value.
|
|
181
|
+
* The [aria-label attribute][1] on the SVG root.
|
|
184
182
|
*
|
|
185
|
-
*
|
|
183
|
+
* [1]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label
|
|
186
184
|
*/
|
|
187
|
-
|
|
185
|
+
ariaLabel?: string | null;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* The [aria-description attribute][1] on the SVG root.
|
|
189
|
+
*
|
|
190
|
+
* [1]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-description
|
|
191
|
+
*/
|
|
192
|
+
ariaDescription?: string | null;
|
|
193
|
+
|
|
194
|
+
/** The default clip for all marks. */
|
|
195
|
+
clip?: 'frame' | 'sphere' | boolean | null | ParamRef;
|
|
188
196
|
|
|
189
197
|
|
|
190
198
|
// x scale attributes
|
package/src/spec/PlotFrom.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type PlotDataInline = any[];
|
|
|
9
9
|
/** Input data specification for a plot mark. */
|
|
10
10
|
export interface PlotFrom {
|
|
11
11
|
/** The name of the backing data table. */
|
|
12
|
-
from: string;
|
|
12
|
+
from: string | ParamRef;
|
|
13
13
|
/** A selection that filters the mark data. */
|
|
14
14
|
filterBy?: ParamRef;
|
|
15
15
|
/**
|
|
@@ -3,6 +3,7 @@ import { IntervalX, IntervalY } from './interactors/Interval1D.js';
|
|
|
3
3
|
import { IntervalXY } from './interactors/Interval2D.js';
|
|
4
4
|
import { NearestX, NearestY } from './interactors/Nearest.js';
|
|
5
5
|
import { Pan, PanX, PanY, PanZoom, PanZoomX, PanZoomY } from './interactors/PanZoom.js';
|
|
6
|
+
import { Region } from './interactors/Region.js';
|
|
6
7
|
import { Toggle, ToggleColor, ToggleX, ToggleY } from './interactors/Toggle.js';
|
|
7
8
|
|
|
8
9
|
/** A plot interactor entry. */
|
|
@@ -13,13 +14,14 @@ export type PlotInteractor =
|
|
|
13
14
|
| IntervalXY
|
|
14
15
|
| NearestX
|
|
15
16
|
| NearestY
|
|
16
|
-
| Toggle
|
|
17
|
-
| ToggleX
|
|
18
|
-
| ToggleY
|
|
19
|
-
| ToggleColor
|
|
20
17
|
| Pan
|
|
21
18
|
| PanX
|
|
22
19
|
| PanY
|
|
23
20
|
| PanZoom
|
|
24
21
|
| PanZoomX
|
|
25
|
-
| PanZoomY
|
|
22
|
+
| PanZoomY
|
|
23
|
+
| Region
|
|
24
|
+
| Toggle
|
|
25
|
+
| ToggleX
|
|
26
|
+
| ToggleY
|
|
27
|
+
| ToggleColor;
|
package/src/spec/Spec.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataDefinition } from './Data.js';
|
|
2
|
-
import { ParamDefinition } from './Param.js';
|
|
2
|
+
import { ParamDefinition, ParamRef } from './Param.js';
|
|
3
3
|
import { HConcat } from './HConcat.js';
|
|
4
4
|
import { VConcat } from './VConcat.js';
|
|
5
5
|
import { HSpace } from './HSpace.js';
|
package/src/spec/Transform.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface AggregateOptions {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/** A transform argument. */
|
|
20
|
-
type Arg = string | number | boolean;
|
|
20
|
+
type Arg = string | number | boolean | ParamRef;
|
|
21
21
|
|
|
22
22
|
/** A zero argument transform signature. */
|
|
23
23
|
type Arg0 = null | [];
|
|
@@ -102,6 +102,14 @@ export interface Bin {
|
|
|
102
102
|
offset?: number;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
/* A column transform. */
|
|
106
|
+
export interface Column {
|
|
107
|
+
/**
|
|
108
|
+
* Intpret a string or param-value as a column reference.
|
|
109
|
+
*/
|
|
110
|
+
column: Arg1;
|
|
111
|
+
}
|
|
112
|
+
|
|
105
113
|
/* A dateMonth transform. */
|
|
106
114
|
export interface DateMonth {
|
|
107
115
|
/**
|
|
@@ -423,6 +431,7 @@ export interface NthValue extends WindowOptions {
|
|
|
423
431
|
/** A data transform that maps one column value to another. */
|
|
424
432
|
export type ColumnTransform =
|
|
425
433
|
| Bin
|
|
434
|
+
| Column
|
|
426
435
|
| DateMonth
|
|
427
436
|
| DateMonthDay
|
|
428
437
|
| DateDay
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Styles for rectangular selection brushes. */
|
|
2
|
+
export interface BrushStyles {
|
|
3
|
+
/**
|
|
4
|
+
* The overall opacity of the brush rectangle.
|
|
5
|
+
*/
|
|
6
|
+
opacity?: number;
|
|
7
|
+
/**
|
|
8
|
+
* The fill opacity of the brush rectangle.
|
|
9
|
+
*/
|
|
10
|
+
fillOpacity?: number;
|
|
11
|
+
/**
|
|
12
|
+
* The stroke opacity of the brush rectangle.
|
|
13
|
+
*/
|
|
14
|
+
strokeOpacity?: number;
|
|
15
|
+
/**
|
|
16
|
+
* The fill color of the brush rectangle.
|
|
17
|
+
*/
|
|
18
|
+
fill?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The stroke color of the brush rectangle.
|
|
21
|
+
*/
|
|
22
|
+
stroke?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The stroke dash array of the brush rectangle.
|
|
25
|
+
*/
|
|
26
|
+
strokeDasharray?: string;
|
|
27
|
+
}
|
|
@@ -1,28 +1,5 @@
|
|
|
1
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
|
-
}
|
|
2
|
+
import { BrushStyles } from './BrushStyles.js';
|
|
26
3
|
|
|
27
4
|
/** Options for 1D interval interactors. */
|
|
28
5
|
export interface Interval1DOptions {
|
|
@@ -39,13 +16,14 @@ export interface Interval1DOptions {
|
|
|
39
16
|
field?: string;
|
|
40
17
|
/**
|
|
41
18
|
* The size of an interative pixel (default `1`). Larger pixel sizes reduce
|
|
42
|
-
* the brush resolution, which can reduce the size of
|
|
19
|
+
* the brush resolution, which can reduce the size of pre-aggregated
|
|
20
|
+
* materialized views.
|
|
43
21
|
*/
|
|
44
22
|
pixelSize?: number;
|
|
45
23
|
/**
|
|
46
|
-
* A flag indicating if peer (sibling) marks are when
|
|
47
|
-
* (default `true`). If set, peer marks will not be
|
|
48
|
-
* interactor's selection in cross-filtering setups.
|
|
24
|
+
* A flag indicating if peer (sibling) marks are excluded when
|
|
25
|
+
* cross-filtering (default `true`). If set, peer marks will not be
|
|
26
|
+
* filtered by this interactor's selection in cross-filtering setups.
|
|
49
27
|
*/
|
|
50
28
|
peers?: boolean;
|
|
51
29
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ParamRef } from '../Param.js';
|
|
2
|
-
import { BrushStyles } from './
|
|
2
|
+
import { BrushStyles } from './BrushStyles.js';
|
|
3
3
|
|
|
4
4
|
/** Options for 2D interval interactors. */
|
|
5
5
|
export interface Interval2DOptions {
|
|
@@ -23,13 +23,14 @@ export interface Interval2DOptions {
|
|
|
23
23
|
yfield?: string;
|
|
24
24
|
/**
|
|
25
25
|
* The size of an interative pixel (default `1`). Larger pixel sizes reduce
|
|
26
|
-
* the brush resolution, which can reduce the size of
|
|
26
|
+
* the brush resolution, which can reduce the size of pre-aggregated
|
|
27
|
+
* materialized views.
|
|
27
28
|
*/
|
|
28
29
|
pixelSize?: number;
|
|
29
30
|
/**
|
|
30
|
-
* A flag indicating if peer (sibling) marks are when
|
|
31
|
-
* (default `true`). If set, peer marks will not be
|
|
32
|
-
* interactor's selection in cross-filtering setups.
|
|
31
|
+
* A flag indicating if peer (sibling) marks are excluded when
|
|
32
|
+
* cross-filtering (default `true`). If set, peer marks will not be
|
|
33
|
+
* filtered by this interactor's selection in cross-filtering setups.
|
|
33
34
|
*/
|
|
34
35
|
peers?: boolean;
|
|
35
36
|
/**
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
import { BrushStyles } from './BrushStyles.js';
|
|
3
|
+
|
|
4
|
+
/** Options for region interactors. */
|
|
5
|
+
export interface RegionOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The output selection. A clause of the form
|
|
8
|
+
* `(field = value1) OR (field = value2) ...`
|
|
9
|
+
* is added for the currently selected values.
|
|
10
|
+
*/
|
|
11
|
+
as: ParamRef;
|
|
12
|
+
/**
|
|
13
|
+
* The encoding channels over which to select values.
|
|
14
|
+
* For a selected mark, selection clauses will cover
|
|
15
|
+
* the backing data fields for each channel.
|
|
16
|
+
*/
|
|
17
|
+
channels: string[];
|
|
18
|
+
/**
|
|
19
|
+
* A flag indicating if peer (sibling) marks are excluded when
|
|
20
|
+
* cross-filtering (default `true`). If set, peer marks will not be
|
|
21
|
+
* filtered by this interactor's selection in cross-filtering setups.
|
|
22
|
+
*/
|
|
23
|
+
peers?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* CSS styles for the brush (SVG `rect`) element.
|
|
26
|
+
*/
|
|
27
|
+
brush?: BrushStyles;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** A rectangular region interactor. */
|
|
31
|
+
export interface Region extends RegionOptions {
|
|
32
|
+
/** Select aspects of individual marks within a 2D range. */
|
|
33
|
+
select: 'region';
|
|
34
|
+
}
|
|
@@ -9,9 +9,9 @@ export interface ToggleOptions {
|
|
|
9
9
|
*/
|
|
10
10
|
as: ParamRef;
|
|
11
11
|
/**
|
|
12
|
-
* A flag indicating if peer (sibling) marks are when
|
|
13
|
-
* (default `true`). If set, peer marks will not be
|
|
14
|
-
* interactor's selection in cross-filtering setups.
|
|
12
|
+
* A flag indicating if peer (sibling) marks are excluded when
|
|
13
|
+
* cross-filtering (default `true`). If set, peer marks will not be
|
|
14
|
+
* filtered by this interactor's selection in cross-filtering setups.
|
|
15
15
|
*/
|
|
16
16
|
peers?: boolean;
|
|
17
17
|
}
|
package/src/spec/marks/Marks.ts
CHANGED
|
@@ -432,6 +432,12 @@ export interface MarkOptions {
|
|
|
432
432
|
| (TipOptions & { pointer?: TipPointer })
|
|
433
433
|
| ParamRef;
|
|
434
434
|
|
|
435
|
+
/**
|
|
436
|
+
* Additional named channels, for example to include in a tooltip.
|
|
437
|
+
* Consists of (channel name, data field name) key-value pairs.
|
|
438
|
+
*/
|
|
439
|
+
channels?: Record<string, string>;
|
|
440
|
+
|
|
435
441
|
/**
|
|
436
442
|
* How to clip the mark; one of:
|
|
437
443
|
*
|