@uwdata/mosaic-spec 0.9.0 → 0.11.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/LICENSE +47 -0
- package/dist/mosaic-schema.json +120 -33
- package/dist/mosaic-spec.js +7306 -15932
- package/dist/mosaic-spec.min.js +33 -42
- package/dist/types/ast/ASTNode.d.ts +2 -2
- package/dist/types/ast/DataNode.d.ts +3 -3
- 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 -3
- package/dist/types/ast/TransformNode.d.ts +9 -1
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/parse-spec.d.ts +34 -9
- package/dist/types/spec/Input.d.ts +5 -0
- package/dist/types/spec/Param.d.ts +12 -0
- package/dist/types/spec/PlotAttribute.d.ts +6 -0
- package/dist/types/spec/Transform.d.ts +33 -13
- package/dist/types/util.d.ts +3 -3
- package/package.json +8 -8
- package/src/ast/ParamNode.js +3 -4
- package/src/ast/ParamRefNode.js +1 -1
- package/src/ast/SelectionNode.js +46 -10
- package/src/ast/TransformNode.js +44 -10
- package/src/constants.js +1 -0
- package/src/parse-spec.js +53 -16
- package/src/spec/Input.ts +5 -0
- package/src/spec/Param.ts +14 -0
- package/src/spec/PlotAttribute.ts +7 -0
- package/src/spec/Spec.ts +1 -1
- package/src/spec/Transform.ts +44 -15
package/src/spec/Param.ts
CHANGED
|
@@ -58,6 +58,20 @@ export interface Selection {
|
|
|
58
58
|
* but not oneself (default `false`, except for `crossfilter` selections).
|
|
59
59
|
*/
|
|
60
60
|
cross?: boolean;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* A flag for setting an initial empty selection state. If true, a selection
|
|
64
|
+
* with no clauses corresponds to an empty selection with no records. If
|
|
65
|
+
* false, a selection with no clauses selects all values.
|
|
66
|
+
*/
|
|
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[];
|
|
61
75
|
}
|
|
62
76
|
|
|
63
77
|
/** A Param or Selection definition. */
|
|
@@ -1556,6 +1556,13 @@ export interface PlotAttributes {
|
|
|
1556
1556
|
*/
|
|
1557
1557
|
rNice?: boolean | number| Interval | ParamRef;
|
|
1558
1558
|
|
|
1559
|
+
/**
|
|
1560
|
+
* A textual label to show on the axis or legend; if null, show no label. By
|
|
1561
|
+
* default the scale label is inferred from channel definitions, possibly with
|
|
1562
|
+
* an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value.
|
|
1563
|
+
*/
|
|
1564
|
+
rLabel?: string | null | ParamRef;
|
|
1565
|
+
|
|
1559
1566
|
/**
|
|
1560
1567
|
* If true, shorthand for a transform suitable for percentages, mapping
|
|
1561
1568
|
* proportions in [0, 1] to [0, 100].
|
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
|
@@ -41,20 +41,58 @@ type Arg2Opt = Arg | [Arg, Arg?];
|
|
|
41
41
|
*/
|
|
42
42
|
type Arg3Opt = Arg | [Arg, Arg?, Arg?];
|
|
43
43
|
|
|
44
|
-
/**
|
|
45
|
-
export
|
|
44
|
+
/** Binning interval names. */
|
|
45
|
+
export type BinInterval =
|
|
46
|
+
| 'date'
|
|
47
|
+
| 'number'
|
|
48
|
+
| 'millisecond'
|
|
49
|
+
| 'second'
|
|
50
|
+
| 'minute'
|
|
51
|
+
| 'hour'
|
|
52
|
+
| 'day'
|
|
53
|
+
| 'month'
|
|
54
|
+
| 'year';
|
|
55
|
+
|
|
56
|
+
/* A bin transform. */
|
|
57
|
+
export interface Bin {
|
|
58
|
+
/**
|
|
59
|
+
* Bin a continuous variable into discrete intervals. The bin argument
|
|
60
|
+
* specifies a data column or expression to bin. Both numerical and
|
|
61
|
+
* temporal (date/time) values are supported.
|
|
62
|
+
*/
|
|
63
|
+
bin: Arg | [Arg];
|
|
64
|
+
/**
|
|
65
|
+
* The interval bin unit to use, typically used to indicate a date/time
|
|
66
|
+
* unit for binning temporal values, such as `hour`, `day`, or `month`.
|
|
67
|
+
* If `date`, the extent of data values is used to automatically select
|
|
68
|
+
* an interval for temporal data. The value `number` enforces normal
|
|
69
|
+
* numerical binning, even over temporal data. If unspecified, defaults
|
|
70
|
+
* to `number` for numerical data and `date` for temporal data.
|
|
71
|
+
*/
|
|
72
|
+
interval?: BinInterval;
|
|
73
|
+
/**
|
|
74
|
+
* The step size to use between bins. When binning numerical values (or
|
|
75
|
+
* interval type `number`), this setting specifies the numerical step size.
|
|
76
|
+
* For data/time intervals, this indicates the number of steps of that unit,
|
|
77
|
+
* such as hours, days, or years.
|
|
78
|
+
*/
|
|
79
|
+
step?: number;
|
|
46
80
|
/**
|
|
47
81
|
* The target number of binning steps to use. To accommodate human-friendly
|
|
48
|
-
* bin boundaries, the actual number of bins may diverge from this
|
|
82
|
+
* ("nice") bin boundaries, the actual number of bins may diverge from this
|
|
83
|
+
* exact value. This option is ignored when **step** is specified.
|
|
49
84
|
*/
|
|
50
85
|
steps?: number;
|
|
51
86
|
/**
|
|
52
|
-
* The minimum allowed bin step size (default `0`)
|
|
53
|
-
* For example, a setting of `1`
|
|
87
|
+
* The minimum allowed bin step size (default `0`) when performing numerical
|
|
88
|
+
* binning. For example, a setting of `1` prevents step sizes less than 1.
|
|
89
|
+
* This option is ignored when **step** is specified.
|
|
54
90
|
*/
|
|
55
91
|
minstep?: number;
|
|
56
92
|
/**
|
|
57
|
-
* A flag requesting "nice" human-friendly
|
|
93
|
+
* A flag (default `true`) requesting "nice" human-friendly end points and
|
|
94
|
+
* step sizes when performing numerical binning. When **step** is specified,
|
|
95
|
+
* this option affects the binning end points (e.g., origin) only.
|
|
58
96
|
*/
|
|
59
97
|
nice?: true;
|
|
60
98
|
/**
|
|
@@ -64,15 +102,6 @@ export interface BinOptions {
|
|
|
64
102
|
offset?: number;
|
|
65
103
|
}
|
|
66
104
|
|
|
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
105
|
/* A dateMonth transform. */
|
|
77
106
|
export interface DateMonth {
|
|
78
107
|
/**
|