@uwdata/mosaic-spec 0.12.0 → 0.12.1
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 +7689 -2399
- package/dist/mosaic-spec.js +68 -26
- package/dist/mosaic-spec.min.js +16 -16
- package/dist/types/spec/PlotMark.d.ts +2 -1
- package/dist/types/spec/marks/Waffle.d.ts +58 -0
- package/package.json +5 -5
- package/src/spec/PlotMark.ts +3 -1
- package/src/spec/marks/Waffle.ts +61 -0
|
@@ -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;
|
|
@@ -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.1",
|
|
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.1",
|
|
37
|
+
"@uwdata/mosaic-sql": "^0.12.1",
|
|
38
|
+
"@uwdata/vgplot": "^0.12.1",
|
|
39
39
|
"ts-json-schema-generator": "^2.3.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "fe3a7c34352da54ec36a1ebf557846f46a649782"
|
|
42
42
|
}
|
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;
|
|
@@ -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
|
+
}
|