@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.
Files changed (154) hide show
  1. package/dist/mosaic-schema.json +186153 -0
  2. package/dist/mosaic-spec.js +3387 -4641
  3. package/dist/mosaic-spec.min.js +23 -23
  4. package/dist/types/ast/ASTNode.d.ts +26 -0
  5. package/dist/types/ast/DataNode.d.ts +60 -0
  6. package/dist/types/ast/ExpressionNode.d.ts +15 -0
  7. package/dist/types/ast/HConcatNode.d.ts +10 -0
  8. package/dist/types/ast/HSpaceNode.d.ts +11 -0
  9. package/dist/types/ast/InputNode.d.ts +8 -0
  10. package/dist/types/ast/LiteralNode.d.ts +7 -0
  11. package/dist/types/ast/OptionsNode.d.ts +10 -0
  12. package/dist/types/ast/ParamNode.d.ts +9 -0
  13. package/dist/types/ast/ParamRefNode.d.ts +8 -0
  14. package/dist/types/ast/PlotAttributeNode.d.ts +18 -0
  15. package/dist/types/ast/PlotFromNode.d.ts +9 -0
  16. package/dist/types/ast/PlotInteractorNode.d.ts +8 -0
  17. package/dist/types/ast/PlotLegendNode.d.ts +10 -0
  18. package/dist/types/ast/PlotMarkNode.d.ts +10 -0
  19. package/dist/types/ast/PlotNode.d.ts +11 -0
  20. package/dist/types/ast/SelectionNode.d.ts +12 -0
  21. package/dist/types/ast/SpecNode.d.ts +10 -0
  22. package/dist/types/ast/TransformNode.d.ts +13 -0
  23. package/dist/types/ast/VConcatNode.d.ts +10 -0
  24. package/dist/types/ast/VSpaceNode.d.ts +11 -0
  25. package/dist/types/ast-to-dom.d.ts +38 -0
  26. package/dist/types/ast-to-esm.d.ts +64 -0
  27. package/dist/types/config/components.d.ts +4 -0
  28. package/dist/types/config/extensions.d.ts +9 -0
  29. package/dist/types/config/inputs.d.ts +5 -0
  30. package/dist/types/config/plots.d.ts +34 -0
  31. package/dist/types/config/transforms.d.ts +4 -0
  32. package/dist/types/constants.d.ts +30 -0
  33. package/dist/types/index.d.ts +29 -0
  34. package/dist/types/parse-spec.d.ts +86 -0
  35. package/dist/types/spec/CSSStyles.d.ts +3 -0
  36. package/dist/types/spec/Data.d.ts +165 -0
  37. package/dist/types/spec/Expression.d.ts +27 -0
  38. package/dist/types/spec/HConcat.d.ts +8 -0
  39. package/dist/types/spec/HSpace.d.ts +9 -0
  40. package/dist/types/spec/Input.d.ts +182 -0
  41. package/dist/types/spec/Param.d.ts +51 -0
  42. package/dist/types/spec/Plot.d.ts +14 -0
  43. package/dist/types/spec/PlotAttribute.d.ts +1522 -0
  44. package/dist/types/spec/PlotFrom.d.ts +20 -0
  45. package/dist/types/spec/PlotInteractor.d.ts +8 -0
  46. package/dist/types/spec/PlotLegend.d.ts +68 -0
  47. package/dist/types/spec/PlotMark.d.ts +26 -0
  48. package/dist/types/spec/PlotTypes.d.ts +293 -0
  49. package/dist/types/spec/Spec.d.ts +45 -0
  50. package/dist/types/spec/Transform.d.ts +278 -0
  51. package/dist/types/spec/VConcat.d.ts +8 -0
  52. package/dist/types/spec/VSpace.d.ts +9 -0
  53. package/dist/types/spec/interactors/Highlight.d.ts +37 -0
  54. package/dist/types/spec/interactors/Interval1D.d.ts +63 -0
  55. package/dist/types/spec/interactors/Interval2D.d.ts +46 -0
  56. package/dist/types/spec/interactors/Nearest.d.ts +25 -0
  57. package/dist/types/spec/interactors/PanZoom.d.ts +58 -0
  58. package/dist/types/spec/interactors/Toggle.d.ts +51 -0
  59. package/dist/types/spec/marks/Area.d.ts +139 -0
  60. package/dist/types/spec/marks/Arrow.d.ts +94 -0
  61. package/dist/types/spec/marks/Axis.d.ts +281 -0
  62. package/dist/types/spec/marks/Bar.d.ts +150 -0
  63. package/dist/types/spec/marks/Cell.d.ts +57 -0
  64. package/dist/types/spec/marks/Contour.d.ts +23 -0
  65. package/dist/types/spec/marks/Delaunay.d.ts +86 -0
  66. package/dist/types/spec/marks/DenseLine.d.ts +27 -0
  67. package/dist/types/spec/marks/Density.d.ts +121 -0
  68. package/dist/types/spec/marks/Dot.d.ts +129 -0
  69. package/dist/types/spec/marks/Frame.d.ts +21 -0
  70. package/dist/types/spec/marks/Geo.d.ts +53 -0
  71. package/dist/types/spec/marks/Hexbin.d.ts +30 -0
  72. package/dist/types/spec/marks/Hexgrid.d.ts +25 -0
  73. package/dist/types/spec/marks/Image.d.ts +89 -0
  74. package/dist/types/spec/marks/Line.d.ts +82 -0
  75. package/dist/types/spec/marks/Link.d.ts +60 -0
  76. package/dist/types/spec/marks/Marks.d.ts +890 -0
  77. package/dist/types/spec/marks/Raster.d.ts +124 -0
  78. package/dist/types/spec/marks/Rect.d.ts +166 -0
  79. package/dist/types/spec/marks/Regression.d.ts +58 -0
  80. package/dist/types/spec/marks/Rule.d.ts +100 -0
  81. package/dist/types/spec/marks/Text.d.ts +106 -0
  82. package/dist/types/spec/marks/Tick.d.ts +61 -0
  83. package/dist/types/spec/marks/Vector.d.ts +99 -0
  84. package/dist/types/util.d.ts +12 -0
  85. package/jsconfig.json +10 -0
  86. package/package.json +16 -9
  87. package/src/ast/ASTNode.js +23 -2
  88. package/src/ast/DataNode.js +79 -21
  89. package/src/ast/HSpaceNode.js +1 -1
  90. package/src/ast/InputNode.js +1 -2
  91. package/src/ast/ParamNode.js +1 -2
  92. package/src/ast/PlotAttributeNode.js +1 -2
  93. package/src/ast/PlotInteractorNode.js +1 -2
  94. package/src/ast/PlotLegendNode.js +1 -2
  95. package/src/ast/PlotMarkNode.js +3 -2
  96. package/src/ast/TransformNode.js +1 -2
  97. package/src/ast/VSpaceNode.js +1 -1
  98. package/src/ast-to-dom.js +16 -7
  99. package/src/ast-to-esm.js +41 -12
  100. package/src/config/inputs.js +1 -0
  101. package/src/config/plots.js +4 -0
  102. package/src/index.js +4 -0
  103. package/src/parse-spec.js +38 -5
  104. package/src/spec/CSSStyles.ts +9 -0
  105. package/src/spec/Data.ts +184 -0
  106. package/src/spec/Expression.ts +31 -0
  107. package/src/spec/HConcat.ts +9 -0
  108. package/src/spec/HSpace.ts +9 -0
  109. package/src/spec/Input.ts +182 -0
  110. package/src/spec/Param.ts +68 -0
  111. package/src/spec/Plot.ts +15 -0
  112. package/src/spec/PlotAttribute.ts +1783 -0
  113. package/src/spec/PlotFrom.ts +23 -0
  114. package/src/spec/PlotInteractor.ts +25 -0
  115. package/src/spec/PlotLegend.ts +70 -0
  116. package/src/spec/PlotMark.ts +51 -0
  117. package/src/spec/PlotTypes.ts +519 -0
  118. package/src/spec/Spec.ts +63 -0
  119. package/src/spec/Transform.ts +394 -0
  120. package/src/spec/VConcat.ts +9 -0
  121. package/src/spec/VSpace.ts +9 -0
  122. package/src/spec/interactors/Highlight.ts +38 -0
  123. package/src/spec/interactors/Interval1D.ts +67 -0
  124. package/src/spec/interactors/Interval2D.ts +48 -0
  125. package/src/spec/interactors/Nearest.ts +28 -0
  126. package/src/spec/interactors/PanZoom.ts +65 -0
  127. package/src/spec/interactors/Toggle.ts +56 -0
  128. package/src/spec/marks/Area.ts +154 -0
  129. package/src/spec/marks/Arrow.ts +108 -0
  130. package/src/spec/marks/Axis.ts +305 -0
  131. package/src/spec/marks/Bar.ts +160 -0
  132. package/src/spec/marks/Cell.ts +62 -0
  133. package/src/spec/marks/Contour.ts +25 -0
  134. package/src/spec/marks/Delaunay.ts +95 -0
  135. package/src/spec/marks/DenseLine.ts +30 -0
  136. package/src/spec/marks/Density.ts +145 -0
  137. package/src/spec/marks/Dot.ts +147 -0
  138. package/src/spec/marks/Frame.ts +23 -0
  139. package/src/spec/marks/Geo.ts +58 -0
  140. package/src/spec/marks/Hexbin.ts +34 -0
  141. package/src/spec/marks/Hexgrid.ts +27 -0
  142. package/src/spec/marks/Image.ts +101 -0
  143. package/src/spec/marks/Line.ts +93 -0
  144. package/src/spec/marks/Link.ts +70 -0
  145. package/src/spec/marks/Marks.ts +1062 -0
  146. package/src/spec/marks/Raster.ts +145 -0
  147. package/src/spec/marks/Rect.ts +183 -0
  148. package/src/spec/marks/Regression.ts +63 -0
  149. package/src/spec/marks/Rule.ts +113 -0
  150. package/src/spec/marks/Text.ts +122 -0
  151. package/src/spec/marks/Tick.ts +69 -0
  152. package/src/spec/marks/Vector.ts +113 -0
  153. package/src/util.js +8 -0
  154. package/tsconfig.json +11 -0
@@ -0,0 +1,160 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { Interval } from '../PlotTypes.js';
3
+ import { ChannelValueIntervalSpec, ChannelValueSpec, InsetOptions, MarkData, MarkOptions, StackOptions } from './Marks.js';
4
+ import { RectCornerOptions } from './Rect.js';
5
+
6
+ /** Options for the barX and barY marks. */
7
+ interface BarOptions extends MarkOptions, InsetOptions, RectCornerOptions, StackOptions {
8
+ /**
9
+ * How to convert a continuous value (**x** for barX, or **y** for barY) into
10
+ * an interval (**x1** and **x2** for barX, or **y1** and **y2** for barY);
11
+ * one of:
12
+ *
13
+ * - a named time interval such as *day* (for date intervals)
14
+ * - a number (for number intervals), defining intervals at integer multiples of *n*
15
+ *
16
+ * Setting this option disables the implicit stack transform (stackX for barX,
17
+ * or stackY for barY).
18
+ */
19
+ interval?: Interval | ParamRef;
20
+ }
21
+
22
+ /** Options for the barX mark. */
23
+ export interface BarXOptions extends BarOptions {
24
+ /**
25
+ * The horizontal position (or length/width) channel, typically bound to the
26
+ * *x* scale.
27
+ *
28
+ * If neither **x1** nor **x2** nor **interval** is specified, an implicit
29
+ * stackX transform is applied and **x** defaults to the identity function,
30
+ * assuming that *data* = [*x₀*, *x₁*, *x₂*, …]. Otherwise if an **interval**
31
+ * is specified, then **x1** and **x2** are derived from **x**, representing
32
+ * the lower and upper bound of the containing interval, respectively.
33
+ * Otherwise, if only one of **x1** or **x2** is specified, the other
34
+ * defaults to **x**, which defaults to zero.
35
+ */
36
+ x?: ChannelValueIntervalSpec;
37
+
38
+ /**
39
+ * The required primary (starting, often left) horizontal position channel,
40
+ * typically bound to the *x* scale. Setting this option disables the
41
+ * implicit stackX transform.
42
+ *
43
+ * If *x* represents ordinal values, use a cell mark instead.
44
+ */
45
+ x1?: ChannelValueSpec;
46
+
47
+ /**
48
+ * The required secondary (ending, often right) horizontal position channel,
49
+ * typically bound to the *x* scale. Setting this option disables the
50
+ * implicit stackX transform.
51
+ *
52
+ * If *x* represents ordinal values, use a cell mark instead.
53
+ */
54
+ x2?: ChannelValueSpec;
55
+
56
+ /**
57
+ * The optional vertical position of the bar; a ordinal channel typically
58
+ * bound to the *y* scale. If not specified, the bar spans the vertical
59
+ * extent of the frame; otherwise the *y* scale must be a *band* scale.
60
+ *
61
+ * If *y* represents quantitative or temporal values, use a rectX mark
62
+ * instead.
63
+ */
64
+ y?: ChannelValueSpec;
65
+ }
66
+
67
+ /** Options for the barY mark. */
68
+ export interface BarYOptions extends BarOptions {
69
+ /**
70
+ * The vertical position (or length/height) channel, typically bound to the
71
+ * *y* scale.
72
+ *
73
+ * If neither **y1** nor **y2** nor **interval** is specified, an implicit
74
+ * stackY transform is applied and **y** defaults to the identity function,
75
+ * assuming that *data* = [*y₀*, *y₁*, *y₂*, …]. Otherwise if an **interval**
76
+ * is specified, then **y1** and **y2** are derived from **y**, representing
77
+ * the lower and upper bound of the containing interval, respectively.
78
+ * Otherwise, if only one of **y1** or **y2** is specified, the other
79
+ * defaults to **y**, which defaults to zero.
80
+ */
81
+ y?: ChannelValueIntervalSpec;
82
+
83
+ /**
84
+ * The required primary (starting, often bottom) vertical position channel,
85
+ * typically bound to the *y* scale. Setting this option disables the
86
+ * implicit stackY transform.
87
+ *
88
+ * If *y* represents ordinal values, use a cell mark instead.
89
+ */
90
+ y1?: ChannelValueSpec;
91
+
92
+ /**
93
+ * The required secondary (ending, often top) horizontal position channel,
94
+ * typically bound to the *y* scale. Setting this option disables the
95
+ * implicit stackY transform.
96
+ *
97
+ * If *y* represents ordinal values, use a cell mark instead.
98
+ */
99
+ y2?: ChannelValueSpec;
100
+
101
+ /**
102
+ * The optional horizontal position of the bar; a ordinal channel typically
103
+ * bound to the *x* scale. If not specified, the bar spans the horizontal
104
+ * extent of the frame; otherwise the *x* scale must be a *band* scale.
105
+ *
106
+ * If *x* represents quantitative or temporal values, use a rectY mark
107
+ * instead.
108
+ */
109
+ x?: ChannelValueSpec;
110
+ }
111
+
112
+ /** The barX mark. */
113
+ export interface BarX extends MarkData, BarXOptions {
114
+ /**
115
+ * A horizontal bar mark. The required *x* values should be quantitative or
116
+ * temporal, and the optional *y* values should be ordinal.
117
+ *
118
+ * If neither **x1** nor **x2** nor **interval** is specified, an implicit
119
+ * stackX transform is applied and **x** defaults to the identity function,
120
+ * assuming that *data* = [*x₀*, *x₁*, *x₂*, …]. Otherwise if an **interval**
121
+ * is specified, then **x1** and **x2** are derived from **x**, representing
122
+ * the lower and upper bound of the containing interval, respectively.
123
+ * Otherwise, if only one of **x1** or **x2** is specified, the other
124
+ * defaults to **x**, which defaults to zero.
125
+ *
126
+ * The optional **y** ordinal channel specifies the vertical position; it is
127
+ * typically bound to the *y* scale, which must be a *band* scale. If the
128
+ * **y** channel is not specified, the bar will span the vertical extent of
129
+ * the plot’s frame.
130
+ *
131
+ * If *y* is quantitative, use the rectX mark instead.
132
+ * If *x* is ordinal, use the cell mark instead.
133
+ */
134
+ mark: 'barX';
135
+ }
136
+
137
+ /** The barY mark. */
138
+ export interface BarY extends MarkData, BarYOptions {
139
+ /**
140
+ * A vertical bar mark. The required *y* values should be quantitative or
141
+ * temporal, and the optional *x* values should be ordinal.
142
+ *
143
+ * If neither **y1** nor **y2** nor **interval** is specified, an implicit
144
+ * stackY transform is applied and **y** defaults to the identity function,
145
+ * assuming that *data* = [*y₀*, *y₁*, *y₂*, …]. Otherwise if an **interval**
146
+ * is specified, then **y1** and **y2** are derived from **y**, representing
147
+ * the lower and upper bound of the containing interval, respectively.
148
+ * Otherwise, if only one of **y1** or **y2** is specified, the other
149
+ * defaults to **y**, which defaults to zero.
150
+ *
151
+ * The optional **x** ordinal channel specifies the horizontal position; it
152
+ * is typically bound to the *x* scale, which must be a *band* scale. If the
153
+ * **x** channel is not specified, the bar will span the horizontal extent of
154
+ * the plot’s frame.
155
+ *
156
+ * If *x* is quantitative, use the rectY mark instead.
157
+ * If *y* is ordinal, use the cell mark instead.
158
+ */
159
+ mark: 'barY';
160
+ }
@@ -0,0 +1,62 @@
1
+ import { ChannelValueSpec, InsetOptions, MarkData, MarkOptions } from './Marks.js';
2
+ import { RectCornerOptions } from './Rect.js';
3
+
4
+ /** Options for the cell mark. */
5
+ export interface CellOptions extends MarkOptions, InsetOptions, RectCornerOptions {
6
+ /**
7
+ * The horizontal position of the cell; an optional ordinal channel typically
8
+ * bound to the *x* scale. If not specified, the cell spans the horizontal
9
+ * extent of the frame; otherwise the *x* scale must be a *band* scale.
10
+ *
11
+ * If *x* represents quantitative or temporal values, use a barX mark instead;
12
+ * if *y* is also quantitative or temporal, use a rect mark.
13
+ */
14
+ x?: ChannelValueSpec;
15
+
16
+ /**
17
+ * The vertical position of the cell; an optional ordinal channel typically
18
+ * bound to the *y* scale. If not specified, the cell spans the vertical
19
+ * extent of the frame; otherwise the *y* scale must be a *band* scale.
20
+ *
21
+ * If *y* represents quantitative or temporal values, use a barY mark instead;
22
+ * if *x* is also quantitative or temporal, use a rect mark.
23
+ */
24
+ y?: ChannelValueSpec;
25
+ }
26
+
27
+ /** The cell mark. */
28
+ export interface Cell extends MarkData, CellOptions {
29
+ /**
30
+ * A rectangular cell mark. Along with **x** and/or **y**, a **fill** channel
31
+ * is typically specified to encode value as color.
32
+ *
33
+ * If neither **x** nor **y** are specified, *data* is assumed to be an array of
34
+ * pairs [[*x₀*, *y₀*], [*x₁*, *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*,
35
+ * *x₁*, *x₂*, …] and **y** = [*y₀*, *y₁*, *y₂*, …].
36
+ *
37
+ * Both **x** and **y** should be ordinal; if only **x** is quantitative (or
38
+ * temporal), use a barX mark; if only **y** is quantitative, use a barY mark;
39
+ * if both are quantitative, use a rect mark.
40
+ */
41
+ mark: 'cell';
42
+ }
43
+
44
+ /** The cellX mark. */
45
+ export interface CellX extends MarkData, CellOptions {
46
+ /**
47
+ * Like cell, but **x** defaults to the zero-based index [0, 1, 2, …], and if
48
+ * **stroke** is not a channel, **fill** defaults to the identity function,
49
+ * assuming that *data* = [*x₀*, *x₁*, *x₂*, …].
50
+ */
51
+ mark: 'cellX';
52
+ }
53
+
54
+ /** The cellY mark. */
55
+ export interface CellY extends MarkData, CellOptions {
56
+ /**
57
+ * Like cell, but **y** defaults to the zero-based index [0, 1, 2, …], and if
58
+ * **stroke** is not a channel, **fill** defaults to the identity function,
59
+ * assuming that *data* = [*y₀*, *y₁*, *y₂*, …].
60
+ */
61
+ mark: 'cellY';
62
+ }
@@ -0,0 +1,25 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { MarkData, MarkOptions } from './Marks.js';
3
+ import { Grid2DOptions } from './Raster.js';
4
+
5
+ export interface ContourOptions extends MarkOptions, Grid2DOptions {
6
+ /**
7
+ * The number of contour thresholds to subdivide the domain into discrete
8
+ * level sets; defaults to 10. One of:
9
+ *
10
+ * - a count representing the desired number of bins
11
+ * - an array of *n* threshold values for *n* - 1 bins
12
+ */
13
+ thresholds?: number | number[] | ParamRef;
14
+ }
15
+
16
+ /** The contour mark. */
17
+ export interface Contour extends MarkData, ContourOptions {
18
+ /**
19
+ * A contour mark that draws isolines to delineate regions above and below a
20
+ * particular continuous value. It is often used to convey densities as a
21
+ * height field. The special column name "density" can be used to map density
22
+ * values to the fill or stroke options.
23
+ */
24
+ mark: 'contour';
25
+ }
@@ -0,0 +1,95 @@
1
+ import {
2
+ ChannelValue, ChannelValueSpec, CurveOptions,
3
+ MarkData, MarkOptions, MarkerOptions
4
+ } from './Marks.js';
5
+
6
+ /** Options for the Delaunay marks. */
7
+ export interface DelaunayOptions extends MarkOptions, MarkerOptions, CurveOptions {
8
+ /** The horizontal position channel, typically bound to the *x* scale. */
9
+ x?: ChannelValueSpec;
10
+ /** The vertical position channel, typically bound to the *y* scale. */
11
+ y?: ChannelValueSpec;
12
+ /**
13
+ * An optional ordinal channel for grouping to produce multiple
14
+ * (possibly overlapping) triangulations.
15
+ */
16
+ z?: ChannelValue;
17
+ }
18
+
19
+ /** The delaunayLink mark. */
20
+ export interface DelaunayLink extends MarkData, DelaunayOptions {
21
+ /**
22
+ * A mark that draws links for each edge of the Delaunay triangulation
23
+ * of points given by the **x** and **y** channels. Like the link mark,
24
+ * except that **x1**, **y1**, **x2**, and **y2** are derived automatically
25
+ * from **x** and **y**. When an aesthetic channel is specified (such as
26
+ * **stroke** or **strokeWidth**), the link inherits the corresponding
27
+ * channel value from one of its two endpoints arbitrarily.
28
+ *
29
+ * If **z** is specified, the input points are grouped by *z*, producing a
30
+ * separate Delaunay triangulation for each group.
31
+ */
32
+ mark: 'delaunayLink';
33
+ }
34
+
35
+ /** The delaunayMesh mark. */
36
+ export interface DelaunayMesh extends MarkData, DelaunayOptions {
37
+ /**
38
+ * A mark that draws a mesh of the Delaunay triangulation of the points
39
+ * given by the **x** and **y** channels. The **stroke** option defaults to
40
+ * _currentColor_, and the **strokeOpacity** defaults to 0.2; the **fill**
41
+ * option is not supported. When an aesthetic channel is specified (such as
42
+ * **stroke** or **strokeWidth**), the mesh inherits the corresponding
43
+ * channel value from one of its constituent points arbitrarily.
44
+ *
45
+ * If **z** is specified, the input points are grouped by *z*, producing a
46
+ * separate Delaunay triangulation for each group.
47
+ */
48
+ mark: 'delaunayMesh';
49
+ }
50
+
51
+ /** The hull mark. */
52
+ export interface Hull extends MarkData, DelaunayOptions {
53
+ /**
54
+ * A mark that draws a convex hull around the points given by the **x** and
55
+ * **y** channels. The **stroke** option defaults to _currentColor_ and the
56
+ * **fill** option defaults to _none_. When an aesthetic channel is specified
57
+ * (such as **stroke** or **strokeWidth**), the hull inherits the
58
+ * corresponding channel value from one of its constituent points
59
+ * arbitrarily.
60
+ *
61
+ * If **z** is specified, the input points are grouped by *z*, producing a
62
+ * separate hull for each group. If **z** is not specified, it defaults to
63
+ * the **fill** channel, if any, or the **stroke** channel, if any.
64
+ */
65
+ mark: 'hull';
66
+ }
67
+
68
+ /** The voronoi mark. */
69
+ export interface Voronoi extends MarkData, DelaunayOptions {
70
+ /**
71
+ * A mark that draws polygons for each cell of the Voronoi tesselation
72
+ * of the points given by the **x** and **y** channels.
73
+ *
74
+ * If **z** is specified, the input points are grouped by *z*, producing a
75
+ * separate Voronoi tesselation for each group.
76
+ */
77
+ mark: 'voronoi';
78
+ }
79
+
80
+ /** The voronoiMesh mark. */
81
+ export interface VoronoiMesh extends MarkData, DelaunayOptions {
82
+ /**
83
+ * A mark that draws a mesh for the cell boundaries of the Voronoi
84
+ * tesselation of the points given by the **x** and **y** channels. The
85
+ * **stroke** option defaults to _currentColor_, and the **strokeOpacity**
86
+ * defaults to 0.2. The **fill** option is not supported. When an aesthetic
87
+ * channel is specified (such as **stroke** or **strokeWidth**), the mesh
88
+ * inherits the corresponding channel value from one of its constituent
89
+ * points arbitrarily.
90
+ *
91
+ * If **z** is specified, the input points are grouped by *z*, producing a
92
+ * separate Voronoi tesselation for each group.
93
+ */
94
+ mark: 'voronoiMesh';
95
+ }
@@ -0,0 +1,30 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { ChannelValue, MarkData } from './Marks.js';
3
+ import { RasterOptions } from './Raster.js';
4
+
5
+ export interface DenseLineOptions extends RasterOptions {
6
+ /**
7
+ * Flag to perform approximate arc length normalization of line segments
8
+ * to prevent artifacts due to overcounting steep lines. Defaults to `true`.
9
+ */
10
+ normalize?: boolean | ParamRef;
11
+
12
+ /**
13
+ * A ordinal channel for grouping data into series to be drawn as separate
14
+ * lines.
15
+ */
16
+ z?: ChannelValue;
17
+ }
18
+
19
+ /** The denseLine mark. */
20
+ export interface DenseLine extends MarkData, DenseLineOptions {
21
+ /**
22
+ * A denseLine mark that plots line densities rather than point densities.
23
+ * The mark forms a binned raster grid and "draws" straight lines into it.
24
+ * To avoid over-weighting steep lines, by default each drawn series is
25
+ * normalized on a per-column basis to approximate arc length normalization.
26
+ * The values for each series are aggregated to form the line density, which
27
+ * is then drawn as an image similar to the raster mark.
28
+ */
29
+ mark: 'denseLine';
30
+ }
@@ -0,0 +1,145 @@
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
+
9
+ // Density2D
10
+
11
+ export interface Density2DOptions extends MarkOptions, Omit<DotOptions, 'x' | 'y'>, TextStyles, Grid2DOptions {
12
+ /**
13
+ * The basic mark type to use to render 2D density values.
14
+ * Defaults to a dot mark; cell and text marks are also supported.
15
+ */
16
+ type?: 'dot' | 'circle' | 'hexagon' | 'cell' | 'text' | ParamRef;
17
+ }
18
+
19
+ /** The density mark for 2D densities. */
20
+ export interface Density extends MarkData, Density2DOptions {
21
+ /**
22
+ * A 2D density mark that shows smoothed point cloud densities along two
23
+ * dimensions. The mark bins the data, counts the number of records that fall
24
+ * into each bin, and smooths the resulting counts, then plots the smoothed
25
+ * distribution, by default using a circular dot mark. The density mark
26
+ * calculates density values that can be mapped to encoding channels such as
27
+ * fill or r using the special field name "density".
28
+ *
29
+ * Set the *type* property to use a different base mark type.
30
+ */
31
+ mark: 'density';
32
+ }
33
+
34
+ // Density1D
35
+
36
+ export interface Density1DOptions {
37
+ /**
38
+ * The kernel density bandwidth for smoothing, in pixels. Defaults to 20.
39
+ */
40
+ bandwidth?: number | ParamRef;
41
+
42
+ /**
43
+ * The number of bins over which to discretize the data prior to smoothing.
44
+ * Defaults to 1024.
45
+ */
46
+ bins?: number | ParamRef;
47
+ }
48
+
49
+ export interface DensityAreaXOptions extends Omit<AreaXOptions, 'x' | 'x1' | 'x2'> {
50
+ /**
51
+ * The basic mark type to use to render 1D density values. Defaults to an
52
+ * areaX mark; lineX, dotX, and textX marks are also supported.
53
+ */
54
+ type: 'areaX';
55
+ }
56
+
57
+ export interface DensityAreaYOptions extends Omit<AreaYOptions, 'y' | 'y1' | 'y2'> {
58
+ /**
59
+ * The basic mark type to use to render 1D density values. Defaults to an
60
+ * areaY mark; lineY, dot, and text marks are also supported.
61
+ */
62
+ type?: 'areaY';
63
+ }
64
+
65
+ export interface DensityLineXOptions extends Omit<LineXOptions, 'x' | 'x1' | 'x2'> {
66
+ /**
67
+ * The basic mark type to use to render 1D density values. Defaults to an
68
+ * areaX mark; lineX, dotX, and textX marks are also supported.
69
+ */
70
+ type: 'lineX';
71
+ }
72
+
73
+ export interface DensityLineYOptions extends Omit<LineYOptions, 'y' | 'y1' | 'y2'> {
74
+ /**
75
+ * The basic mark type to use to render 1D density values. Defaults to an
76
+ * areaY mark; lineY, dot, and text marks are also supported.
77
+ */
78
+ type: 'lineY';
79
+ }
80
+
81
+ export interface DensityDotXOptions extends Omit<DotOptions, 'x'> {
82
+ /**
83
+ * The basic mark type to use to render 1D density values. Defaults to an
84
+ * areaX mark; lineX, dotX, and textX marks are also supported.
85
+ */
86
+ type: 'dotX';
87
+ }
88
+
89
+ export interface DensityDotYOptions extends Omit<DotOptions, 'y'> {
90
+ /**
91
+ * The basic mark type to use to render 1D density values. Defaults to an
92
+ * areaY mark; lineY, dot, and text marks are also supported.
93
+ */
94
+ type: 'dot' | 'dotY' | 'circle' | 'hexagon';
95
+ }
96
+
97
+ export interface DensityTextXOptions extends Omit<TextOptions, 'x'> {
98
+ /**
99
+ * The basic mark type to use to render 1D density values. Defaults to an
100
+ * areaX mark; lineX, dotX, and textX marks are also supported.
101
+ */
102
+ type: 'textX';
103
+ }
104
+
105
+ export interface DensityTextYOptions extends Omit<TextOptions, 'y'> {
106
+ /**
107
+ * The basic mark type to use to render 1D density values. Defaults to an
108
+ * areaY mark; lineY, dot, and text marks are also supported.
109
+ */
110
+ type: 'text' | 'textY';
111
+ }
112
+
113
+ export interface DensityXBase extends MarkData, Density1DOptions {
114
+ /**
115
+ * A densityX mark that visualizes smoothed point cloud densities along the
116
+ * **x** dimension. The mark bins the data, counts the number of records that
117
+ * fall into each bin, smooths the resulting counts, and then plots the
118
+ * smoothed distribution, by default using an areaX mark.
119
+ *
120
+ * Set the *type* property to use a different base mark type.
121
+ */
122
+ mark: 'densityX';
123
+ }
124
+
125
+ export interface DensityYBase extends MarkData, Density1DOptions {
126
+ /**
127
+ * A densityY mark that visualizes smoothed point cloud densities along the
128
+ * **y** dimension. The mark bins the data, counts the number of records that
129
+ * fall into each bin, smooths the resulting counts, and then plots the
130
+ * smoothed distribution, by default using an areaY mark.
131
+ *
132
+ * Set the *type* property to use a different base mark type.
133
+ */
134
+ mark: 'densityY';
135
+ }
136
+
137
+ /** The densityX mark. */
138
+ export type DensityX = DensityXBase & (
139
+ DensityAreaXOptions | DensityLineXOptions | DensityDotXOptions | DensityTextXOptions
140
+ );
141
+
142
+ /** The densityY mark. */
143
+ export type DensityY = DensityYBase & (
144
+ DensityAreaYOptions | DensityLineYOptions | DensityDotYOptions | DensityTextYOptions
145
+ );
@@ -0,0 +1,147 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { FrameAnchor, Interval, SymbolType } from '../PlotTypes.js';
3
+ import {
4
+ ChannelValue, ChannelValueIntervalSpec,
5
+ ChannelValueSpec, MarkData, MarkOptions
6
+ } from './Marks.js';
7
+
8
+ /** Options for the dot mark. */
9
+ export interface DotOptions extends MarkOptions {
10
+ /**
11
+ * The horizontal position channel specifying the dot’s center, typically
12
+ * bound to the *x* scale.
13
+ */
14
+ x?: ChannelValueSpec;
15
+
16
+ /**
17
+ * The vertical position channel specifying the dot’s center, typically bound
18
+ * to the *y* scale.
19
+ */
20
+ y?: ChannelValueSpec;
21
+
22
+ /**
23
+ * The radius of dots; either a channel or constant. When a number, it is
24
+ * interpreted as a constant radius in pixels. Otherwise it is interpreted as
25
+ * a channel, typically bound to the *r* channel, which defaults to the *sqrt*
26
+ * type for proportional symbols. The radius defaults to 4.5 pixels when using
27
+ * the **symbol** channel, and otherwise 3 pixels. Dots with a nonpositive
28
+ * radius are not drawn.
29
+ */
30
+ r?: ChannelValueSpec | number | ParamRef;
31
+
32
+ /**
33
+ * The rotation angle of dots in degrees clockwise; either a channel or a
34
+ * constant. When a number, it is interpreted as a constant; otherwise it is
35
+ * interpreted as a channel. Defaults to 0°, pointing up.
36
+ */
37
+ rotate?: ChannelValue | number | ParamRef;
38
+
39
+ /**
40
+ * The categorical symbol; either a channel or a constant. A constant symbol
41
+ * can be specified by a valid symbol name such as *star*, or a symbol object
42
+ * (implementing the draw method); otherwise it is interpreted as a channel.
43
+ * Defaults to *circle* for the **dot** mark, and *hexagon* for the
44
+ * **hexagon** mark.
45
+ *
46
+ * If the **symbol** channel’s values are all symbols, symbol names, or
47
+ * nullish, the channel is unscaled (values are interpreted literally);
48
+ * otherwise, the channel is bound to the *symbol* scale.
49
+ */
50
+ symbol?: ChannelValueSpec | SymbolType | ParamRef;
51
+
52
+ /**
53
+ * The frame anchor specifies defaults for **x** and **y** based on the plot’s
54
+ * frame; it may be one of the four sides (*top*, *right*, *bottom*, *left*),
55
+ * one of the four corners (*top-left*, *top-right*, *bottom-right*,
56
+ * *bottom-left*), or the *middle* of the frame. For example, for dots
57
+ * distributed horizontally at the top of the frame:
58
+ *
59
+ * ```js
60
+ * Plot.dot(data, {x: "date", frameAnchor: "top"})
61
+ * ```
62
+ */
63
+ frameAnchor?: FrameAnchor | ParamRef;
64
+ }
65
+
66
+ /** Options for the dotX mark. */
67
+ export interface DotXOptions extends Omit<DotOptions, "y"> {
68
+ /**
69
+ * The vertical position of the dot’s center, typically bound to the *y*
70
+ * scale.
71
+ */
72
+ y?: ChannelValueIntervalSpec;
73
+
74
+ /**
75
+ * An interval (such as *day* or a number), to transform **y** values to the
76
+ * middle of the interval.
77
+ */
78
+ interval?: Interval | ParamRef;
79
+ }
80
+
81
+ /** Options for the dotY mark. */
82
+ export interface DotYOptions extends Omit<DotOptions, "x"> {
83
+ /**
84
+ * The horizontal position of the dot’s center, typically bound to the *x*
85
+ * scale.
86
+ */
87
+ x?: ChannelValueIntervalSpec;
88
+
89
+ /**
90
+ * An interval (such as *day* or a number), to transform **x** values to the
91
+ * middle of the interval.
92
+ */
93
+ interval?: Interval | ParamRef;
94
+ }
95
+
96
+ /** The dot mark. */
97
+ export interface Dot extends MarkData, DotOptions {
98
+ /**
99
+ * A dot mark that draws circles, or other symbols, as in a scatterplot.
100
+ *
101
+ * If either **x** or **y** is not specified, the default is determined by the
102
+ * **frameAnchor** option. If none of **x**, **y**, and **frameAnchor** are
103
+ * specified, *data* is assumed to be an array of pairs [[*x₀*, *y₀*], [*x₁*,
104
+ * *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*, *x₁*, *x₂*, …] and **y** =
105
+ * [*y₀*, *y₁*, *y₂*, …].
106
+ *
107
+ * Dots are sorted by descending radius **r** by default to mitigate
108
+ * overplotting; set the **sort** option to null to draw them in input order.
109
+ */
110
+ mark: 'dot';
111
+ }
112
+
113
+ /** The dotX mark. */
114
+ export interface DotX extends MarkData, DotXOptions {
115
+ /**
116
+ * Like dot, except that **x** defaults to the identity function, assuming that
117
+ * *data* = [*x₀*, *x₁*, *x₂*, …].
118
+ *
119
+ * If an **interval** is specified, such as *day*, **y** is transformed to the
120
+ * middle of the interval.
121
+ */
122
+ mark: 'dotX';
123
+ }
124
+
125
+ /** The dotY mark. */
126
+ export interface DotY extends MarkData, DotYOptions {
127
+ /**
128
+ * Like dot, except that **y** defaults to the identity function, assuming that
129
+ * *data* = [*y₀*, *y₁*, *y₂*, …].
130
+ *
131
+ * If an **interval** is specified, such as *day*, **x** is transformed to the
132
+ * middle of the interval.
133
+ */
134
+ mark: 'dotY';
135
+ }
136
+
137
+ /** The circle mark. */
138
+ export interface Circle extends MarkData, Exclude<DotOptions, 'symbol'> {
139
+ /** Like dot, except that the **symbol** option is set to *circle*. */
140
+ mark: 'circle';
141
+ }
142
+
143
+ /** The hexagon mark. */
144
+ export interface Hexagon extends MarkData, Exclude<DotOptions, 'symbol'> {
145
+ /** Like dot, except that the **symbol** option is set to *hexagon*. */
146
+ mark: 'hexagon';
147
+ }
@@ -0,0 +1,23 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { InsetOptions, MarkOptions } from './Marks.js';
3
+ import { RectCornerOptions } from './Rect.js';
4
+
5
+ /** Options for the frame decoration mark. */
6
+ export interface FrameOptions extends MarkOptions, InsetOptions, RectCornerOptions {
7
+ /**
8
+ * If null (default), the rectangular outline of the frame is drawn;
9
+ * otherwise the frame is drawn as a line only on the given side, and the
10
+ * **rx**, **ry**, **fill**, and **fillOpacity** options are ignored.
11
+ */
12
+ anchor?: 'top' | 'right' | 'bottom' | 'left' | null | ParamRef;
13
+ }
14
+
15
+ /** The frame mark. */
16
+ export interface Frame extends FrameOptions {
17
+ /**
18
+ * Draws a rectangle around the plot’s frame, or if an **anchor** is given,
19
+ * a line on the given side. Useful for visual separation of facets, or in
20
+ * conjunction with axes and grids to fill the frame’s background.
21
+ */
22
+ mark: 'frame';
23
+ }