@uwdata/mosaic-spec 0.12.0 → 0.12.2
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/README.md +2 -0
- package/dist/mosaic-schema.json +7971 -2265
- package/dist/mosaic-spec.js +193 -80
- package/dist/mosaic-spec.min.js +20 -20
- package/dist/types/spec/Param.d.ts +1 -1
- package/dist/types/spec/PlotMark.d.ts +2 -1
- package/dist/types/spec/marks/Density.d.ts +22 -7
- package/dist/types/spec/marks/Waffle.d.ts +58 -0
- package/package.json +5 -5
- package/src/spec/Param.ts +1 -0
- package/src/spec/PlotMark.ts +3 -1
- package/src/spec/marks/Density.ts +25 -7
- package/src/spec/marks/Waffle.ts +61 -0
|
@@ -27,7 +27,7 @@ export interface ParamDate extends ParamBase {
|
|
|
27
27
|
date: string;
|
|
28
28
|
}
|
|
29
29
|
/** Literal Param values. */
|
|
30
|
-
export type ParamLiteral = string | number | boolean;
|
|
30
|
+
export type ParamLiteral = null | string | number | boolean;
|
|
31
31
|
/** Valid Param values. */
|
|
32
32
|
export type ParamValue = ParamLiteral | Array<ParamLiteral | ParamRef>;
|
|
33
33
|
/** A Selection definition. */
|
|
@@ -23,5 +23,6 @@ import { RuleX, RuleY } from './marks/Rule.js';
|
|
|
23
23
|
import { Text, TextX, TextY } from './marks/Text.js';
|
|
24
24
|
import { TickX, TickY } from './marks/Tick.js';
|
|
25
25
|
import { Spike, Vector, VectorX, VectorY } from './marks/Vector.js';
|
|
26
|
+
import { WaffleX, WaffleY } from './marks/Waffle.js';
|
|
26
27
|
/** A plot mark entry. */
|
|
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
|
+
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 | WaffleX | WaffleY;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ParamRef } from
|
|
2
|
-
import { AreaXOptions, AreaYOptions } from
|
|
3
|
-
import { DotOptions } from
|
|
4
|
-
import { LineXOptions, LineYOptions } from
|
|
5
|
-
import { MarkData, MarkOptions, TextStyles } from
|
|
6
|
-
import { Grid2DOptions } from
|
|
7
|
-
import { TextOptions } from
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
import { AreaXOptions, AreaYOptions } from './Area.js';
|
|
3
|
+
import { DotOptions } from './Dot.js';
|
|
4
|
+
import { LineXOptions, LineYOptions } from './Line.js';
|
|
5
|
+
import { MarkData, MarkOptions, TextStyles } from './Marks.js';
|
|
6
|
+
import { Grid2DOptions } from './Raster.js';
|
|
7
|
+
import { TextOptions } from './Text.js';
|
|
8
8
|
export interface Density2DOptions extends MarkOptions, Omit<DotOptions, 'x' | 'y'>, TextStyles, Grid2DOptions {
|
|
9
9
|
/**
|
|
10
10
|
* The basic mark type to use to render 2D density values.
|
|
@@ -36,6 +36,13 @@ export interface Density1DOptions {
|
|
|
36
36
|
* Defaults to 1024.
|
|
37
37
|
*/
|
|
38
38
|
bins?: number | ParamRef;
|
|
39
|
+
/**
|
|
40
|
+
* Normalization method for density estimates. If `false` or `'none'` (the
|
|
41
|
+
* default), the density estimates are smoothed weighted counts. If `true`
|
|
42
|
+
* or `'sum'`, density estimates are divided by the sum of the total point
|
|
43
|
+
* mass. If `'max'`, estimates are divided by the maximum smoothed value.
|
|
44
|
+
*/
|
|
45
|
+
normalize?: boolean | 'max' | 'sum' | 'none' | ParamRef;
|
|
39
46
|
}
|
|
40
47
|
export interface DensityAreaXOptions extends Omit<AreaXOptions, 'x' | 'x1' | 'x2'> {
|
|
41
48
|
/**
|
|
@@ -43,6 +50,10 @@ export interface DensityAreaXOptions extends Omit<AreaXOptions, 'x' | 'x1' | 'x2
|
|
|
43
50
|
* areaX mark; lineX, dotX, and textX marks are also supported.
|
|
44
51
|
*/
|
|
45
52
|
type: 'areaX';
|
|
53
|
+
/**
|
|
54
|
+
* Flag indicating if densities should be stacked. Defaults to false.
|
|
55
|
+
*/
|
|
56
|
+
stack?: boolean | ParamRef;
|
|
46
57
|
}
|
|
47
58
|
export interface DensityAreaYOptions extends Omit<AreaYOptions, 'y' | 'y1' | 'y2'> {
|
|
48
59
|
/**
|
|
@@ -50,6 +61,10 @@ export interface DensityAreaYOptions extends Omit<AreaYOptions, 'y' | 'y1' | 'y2
|
|
|
50
61
|
* areaY mark; lineY, dot, and text marks are also supported.
|
|
51
62
|
*/
|
|
52
63
|
type?: 'areaY';
|
|
64
|
+
/**
|
|
65
|
+
* Flag indicating if densities should be stacked. Defaults to false.
|
|
66
|
+
*/
|
|
67
|
+
stack?: boolean | ParamRef;
|
|
53
68
|
}
|
|
54
69
|
export interface DensityLineXOptions extends Omit<LineXOptions, 'x' | 'x1' | 'x2'> {
|
|
55
70
|
/**
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
import { BarXOptions, BarYOptions } from './Bar.js';
|
|
3
|
+
import { MarkData } from './Marks.js';
|
|
4
|
+
/** Options for the waffleX and waffleY mark. */
|
|
5
|
+
export interface WaffleOptions {
|
|
6
|
+
/** The number of cells per row or column; defaults to undefined for automatic. */
|
|
7
|
+
multiple?: number | ParamRef;
|
|
8
|
+
/** The quantity each cell represents; defaults to 1. */
|
|
9
|
+
unit?: number | ParamRef;
|
|
10
|
+
/** The gap in pixels between cells; defaults to 1. */
|
|
11
|
+
gap?: number | ParamRef;
|
|
12
|
+
/** If true, round to integers to avoid partial cells. */
|
|
13
|
+
round?: boolean | ParamRef;
|
|
14
|
+
}
|
|
15
|
+
/** The waffleX mark. */
|
|
16
|
+
export interface WaffleX extends MarkData, BarXOptions, WaffleOptions {
|
|
17
|
+
/**
|
|
18
|
+
* A horizontal waffle mark. The required *x* values should be quantitative,
|
|
19
|
+
* and the optional *y* values should be ordinal.
|
|
20
|
+
*
|
|
21
|
+
* If neither **x1** nor **x2** nor **interval** is specified, an implicit
|
|
22
|
+
* stackX transform is applied and **x** defaults to the identity function,
|
|
23
|
+
* assuming that *data* = [*x₀*, *x₁*, *x₂*, …]. Otherwise if an **interval**
|
|
24
|
+
* is specified, then **x1** and **x2** are derived from **x**, representing
|
|
25
|
+
* the lower and upper bound of the containing interval, respectively.
|
|
26
|
+
* Otherwise, if only one of **x1** or **x2** is specified, the other
|
|
27
|
+
* defaults to **x**, which defaults to zero.
|
|
28
|
+
*
|
|
29
|
+
* The optional **y** ordinal channel specifies the vertical position; it is
|
|
30
|
+
* typically bound to the *y* scale, which must be a *band* scale. If the
|
|
31
|
+
* **y** channel is not specified, the bar will span the vertical extent of
|
|
32
|
+
* the plot’s frame. Because a waffle represents a discrete number of square
|
|
33
|
+
* cells, it may not use all of the available bandwidth.
|
|
34
|
+
*/
|
|
35
|
+
mark: 'waffleX';
|
|
36
|
+
}
|
|
37
|
+
/** The waffleY mark. */
|
|
38
|
+
export interface WaffleY extends MarkData, BarYOptions, WaffleOptions {
|
|
39
|
+
/**
|
|
40
|
+
* A vertical waffle mark. The required *y* values should be quantitative,
|
|
41
|
+
* and the optional *x* values should be ordinal.
|
|
42
|
+
*
|
|
43
|
+
* If neither **y1** nor **y2** nor **interval** is specified, an implicit
|
|
44
|
+
* stackY transform is applied and **y** defaults to the identity function,
|
|
45
|
+
* assuming that *data* = [*y₀*, *y₁*, *y₂*, …]. Otherwise if an **interval**
|
|
46
|
+
* is specified, then **y1** and **y2** are derived from **y**, representing
|
|
47
|
+
* the lower and upper bound of the containing interval, respectively.
|
|
48
|
+
* Otherwise, if only one of **y1** or **y2** is specified, the other
|
|
49
|
+
* defaults to **y**, which defaults to zero.
|
|
50
|
+
*
|
|
51
|
+
* The optional **x** ordinal channel specifies the horizontal position; it
|
|
52
|
+
* is typically bound to the *x* scale, which must be a *band* scale. If the
|
|
53
|
+
* **x** channel is not specified, the bar will span the horizontal extent of
|
|
54
|
+
* the plot’s frame. Because a waffle represents a discrete number of square
|
|
55
|
+
* cells, it may not use all of the available bandwidth.
|
|
56
|
+
*/
|
|
57
|
+
mark: 'waffleY';
|
|
58
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uwdata/mosaic-spec",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"description": "Declarative specification of Mosaic-powered applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mosaic",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"prepublishOnly": "npm run test && npm run lint && npm run build"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@uwdata/mosaic-core": "^0.12.
|
|
37
|
-
"@uwdata/mosaic-sql": "^0.12.
|
|
38
|
-
"@uwdata/vgplot": "^0.12.
|
|
36
|
+
"@uwdata/mosaic-core": "^0.12.2",
|
|
37
|
+
"@uwdata/mosaic-sql": "^0.12.2",
|
|
38
|
+
"@uwdata/vgplot": "^0.12.2",
|
|
39
39
|
"ts-json-schema-generator": "^2.3.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "0ca741d840b98039255f26a5ceedf10be66f790e"
|
|
42
42
|
}
|
package/src/spec/Param.ts
CHANGED
package/src/spec/PlotMark.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { RuleX, RuleY } from './marks/Rule.js';
|
|
|
23
23
|
import { Text,TextX, TextY } from './marks/Text.js';
|
|
24
24
|
import { TickX, TickY } from './marks/Tick.js';
|
|
25
25
|
import { Spike, Vector, VectorX, VectorY } from './marks/Vector.js';
|
|
26
|
+
import { WaffleX, WaffleY } from './marks/Waffle.js';
|
|
26
27
|
|
|
27
28
|
/** A plot mark entry. */
|
|
28
29
|
export type PlotMark =
|
|
@@ -50,4 +51,5 @@ export type PlotMark =
|
|
|
50
51
|
| RuleX | RuleY
|
|
51
52
|
| Text | TextX | TextY
|
|
52
53
|
| TickX | TickY
|
|
53
|
-
| Vector | VectorX | VectorY | Spike
|
|
54
|
+
| Vector | VectorX | VectorY | Spike
|
|
55
|
+
| WaffleX | WaffleY;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ParamRef } from
|
|
2
|
-
import { AreaXOptions, AreaYOptions } from
|
|
3
|
-
import { DotOptions } from
|
|
4
|
-
import { LineXOptions, LineYOptions } from
|
|
5
|
-
import { MarkData, MarkOptions, TextStyles } from
|
|
6
|
-
import { Grid2DOptions } from
|
|
7
|
-
import { TextOptions } from
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
import { AreaXOptions, AreaYOptions } from './Area.js';
|
|
3
|
+
import { DotOptions } from './Dot.js';
|
|
4
|
+
import { LineXOptions, LineYOptions } from './Line.js';
|
|
5
|
+
import { MarkData, MarkOptions, TextStyles } from './Marks.js';
|
|
6
|
+
import { Grid2DOptions } from './Raster.js';
|
|
7
|
+
import { TextOptions } from './Text.js';
|
|
8
8
|
|
|
9
9
|
// Density2D
|
|
10
10
|
|
|
@@ -44,6 +44,14 @@ export interface Density1DOptions {
|
|
|
44
44
|
* Defaults to 1024.
|
|
45
45
|
*/
|
|
46
46
|
bins?: number | ParamRef;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Normalization method for density estimates. If `false` or `'none'` (the
|
|
50
|
+
* default), the density estimates are smoothed weighted counts. If `true`
|
|
51
|
+
* or `'sum'`, density estimates are divided by the sum of the total point
|
|
52
|
+
* mass. If `'max'`, estimates are divided by the maximum smoothed value.
|
|
53
|
+
*/
|
|
54
|
+
normalize?: boolean | 'max' | 'sum' | 'none' | ParamRef;
|
|
47
55
|
}
|
|
48
56
|
|
|
49
57
|
export interface DensityAreaXOptions extends Omit<AreaXOptions, 'x' | 'x1' | 'x2'> {
|
|
@@ -52,6 +60,11 @@ export interface DensityAreaXOptions extends Omit<AreaXOptions, 'x' | 'x1' | 'x2
|
|
|
52
60
|
* areaX mark; lineX, dotX, and textX marks are also supported.
|
|
53
61
|
*/
|
|
54
62
|
type: 'areaX';
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Flag indicating if densities should be stacked. Defaults to false.
|
|
66
|
+
*/
|
|
67
|
+
stack?: boolean | ParamRef;
|
|
55
68
|
}
|
|
56
69
|
|
|
57
70
|
export interface DensityAreaYOptions extends Omit<AreaYOptions, 'y' | 'y1' | 'y2'> {
|
|
@@ -60,6 +73,11 @@ export interface DensityAreaYOptions extends Omit<AreaYOptions, 'y' | 'y1' | 'y2
|
|
|
60
73
|
* areaY mark; lineY, dot, and text marks are also supported.
|
|
61
74
|
*/
|
|
62
75
|
type?: 'areaY';
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Flag indicating if densities should be stacked. Defaults to false.
|
|
79
|
+
*/
|
|
80
|
+
stack?: boolean | ParamRef;
|
|
63
81
|
}
|
|
64
82
|
|
|
65
83
|
export interface DensityLineXOptions extends Omit<LineXOptions, 'x' | 'x1' | 'x2'> {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
import { BarXOptions, BarYOptions } from './Bar.js';
|
|
3
|
+
import { MarkData } from './Marks.js';
|
|
4
|
+
|
|
5
|
+
/** Options for the waffleX and waffleY mark. */
|
|
6
|
+
export interface WaffleOptions {
|
|
7
|
+
/** The number of cells per row or column; defaults to undefined for automatic. */
|
|
8
|
+
multiple?: number | ParamRef;
|
|
9
|
+
/** The quantity each cell represents; defaults to 1. */
|
|
10
|
+
unit?: number | ParamRef;
|
|
11
|
+
/** The gap in pixels between cells; defaults to 1. */
|
|
12
|
+
gap?: number | ParamRef;
|
|
13
|
+
/** If true, round to integers to avoid partial cells. */
|
|
14
|
+
round?: boolean | ParamRef;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The waffleX mark. */
|
|
18
|
+
export interface WaffleX extends MarkData, BarXOptions, WaffleOptions {
|
|
19
|
+
/**
|
|
20
|
+
* A horizontal waffle mark. The required *x* values should be quantitative,
|
|
21
|
+
* and the optional *y* values should be ordinal.
|
|
22
|
+
*
|
|
23
|
+
* If neither **x1** nor **x2** nor **interval** is specified, an implicit
|
|
24
|
+
* stackX transform is applied and **x** defaults to the identity function,
|
|
25
|
+
* assuming that *data* = [*x₀*, *x₁*, *x₂*, …]. Otherwise if an **interval**
|
|
26
|
+
* is specified, then **x1** and **x2** are derived from **x**, representing
|
|
27
|
+
* the lower and upper bound of the containing interval, respectively.
|
|
28
|
+
* Otherwise, if only one of **x1** or **x2** is specified, the other
|
|
29
|
+
* defaults to **x**, which defaults to zero.
|
|
30
|
+
*
|
|
31
|
+
* The optional **y** ordinal channel specifies the vertical position; it is
|
|
32
|
+
* typically bound to the *y* scale, which must be a *band* scale. If the
|
|
33
|
+
* **y** channel is not specified, the bar will span the vertical extent of
|
|
34
|
+
* the plot’s frame. Because a waffle represents a discrete number of square
|
|
35
|
+
* cells, it may not use all of the available bandwidth.
|
|
36
|
+
*/
|
|
37
|
+
mark: 'waffleX';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The waffleY mark. */
|
|
41
|
+
export interface WaffleY extends MarkData, BarYOptions, WaffleOptions {
|
|
42
|
+
/**
|
|
43
|
+
* A vertical waffle mark. The required *y* values should be quantitative,
|
|
44
|
+
* and the optional *x* values should be ordinal.
|
|
45
|
+
*
|
|
46
|
+
* If neither **y1** nor **y2** nor **interval** is specified, an implicit
|
|
47
|
+
* stackY transform is applied and **y** defaults to the identity function,
|
|
48
|
+
* assuming that *data* = [*y₀*, *y₁*, *y₂*, …]. Otherwise if an **interval**
|
|
49
|
+
* is specified, then **y1** and **y2** are derived from **y**, representing
|
|
50
|
+
* the lower and upper bound of the containing interval, respectively.
|
|
51
|
+
* Otherwise, if only one of **y1** or **y2** is specified, the other
|
|
52
|
+
* defaults to **y**, which defaults to zero.
|
|
53
|
+
*
|
|
54
|
+
* The optional **x** ordinal channel specifies the horizontal position; it
|
|
55
|
+
* is typically bound to the *x* scale, which must be a *band* scale. If the
|
|
56
|
+
* **x** channel is not specified, the bar will span the horizontal extent of
|
|
57
|
+
* the plot’s frame. Because a waffle represents a discrete number of square
|
|
58
|
+
* cells, it may not use all of the available bandwidth.
|
|
59
|
+
*/
|
|
60
|
+
mark: 'waffleY';
|
|
61
|
+
}
|