@uwdata/mosaic-spec 0.7.1 → 0.9.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 (158) hide show
  1. package/dist/mosaic-schema.json +192673 -0
  2. package/dist/mosaic-spec.js +5077 -5774
  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 +207 -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 +27 -0
  48. package/dist/types/spec/PlotTypes.d.ts +293 -0
  49. package/dist/types/spec/Spec.d.ts +52 -0
  50. package/dist/types/spec/Transform.d.ts +314 -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 +44 -0
  57. package/dist/types/spec/interactors/PanZoom.d.ts +58 -0
  58. package/dist/types/spec/interactors/Toggle.d.ts +59 -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 +133 -0
  69. package/dist/types/spec/marks/ErrorBar.d.ts +82 -0
  70. package/dist/types/spec/marks/Frame.d.ts +21 -0
  71. package/dist/types/spec/marks/Geo.d.ts +53 -0
  72. package/dist/types/spec/marks/Hexbin.d.ts +30 -0
  73. package/dist/types/spec/marks/Hexgrid.d.ts +25 -0
  74. package/dist/types/spec/marks/Image.d.ts +89 -0
  75. package/dist/types/spec/marks/Line.d.ts +82 -0
  76. package/dist/types/spec/marks/Link.d.ts +60 -0
  77. package/dist/types/spec/marks/Marks.d.ts +905 -0
  78. package/dist/types/spec/marks/Raster.d.ts +124 -0
  79. package/dist/types/spec/marks/Rect.d.ts +166 -0
  80. package/dist/types/spec/marks/Regression.d.ts +58 -0
  81. package/dist/types/spec/marks/Rule.d.ts +100 -0
  82. package/dist/types/spec/marks/Text.d.ts +110 -0
  83. package/dist/types/spec/marks/Tick.d.ts +61 -0
  84. package/dist/types/spec/marks/Vector.d.ts +99 -0
  85. package/dist/types/util.d.ts +12 -0
  86. package/jsconfig.json +10 -0
  87. package/package.json +14 -9
  88. package/src/ast/ASTNode.js +23 -2
  89. package/src/ast/DataNode.js +79 -21
  90. package/src/ast/HSpaceNode.js +1 -1
  91. package/src/ast/InputNode.js +1 -2
  92. package/src/ast/ParamNode.js +1 -2
  93. package/src/ast/PlotAttributeNode.js +1 -2
  94. package/src/ast/PlotInteractorNode.js +1 -2
  95. package/src/ast/PlotLegendNode.js +1 -2
  96. package/src/ast/PlotMarkNode.js +3 -2
  97. package/src/ast/TransformNode.js +1 -2
  98. package/src/ast/VSpaceNode.js +1 -1
  99. package/src/ast-to-dom.js +9 -3
  100. package/src/ast-to-esm.js +41 -12
  101. package/src/config/inputs.js +1 -0
  102. package/src/config/plots.js +4 -0
  103. package/src/config/transforms.js +6 -0
  104. package/src/index.js +4 -0
  105. package/src/parse-spec.js +38 -5
  106. package/src/spec/CSSStyles.ts +9 -0
  107. package/src/spec/Data.ts +184 -0
  108. package/src/spec/Expression.ts +31 -0
  109. package/src/spec/HConcat.ts +9 -0
  110. package/src/spec/HSpace.ts +9 -0
  111. package/src/spec/Input.ts +204 -0
  112. package/src/spec/Param.ts +68 -0
  113. package/src/spec/Plot.ts +15 -0
  114. package/src/spec/PlotAttribute.ts +1783 -0
  115. package/src/spec/PlotFrom.ts +23 -0
  116. package/src/spec/PlotInteractor.ts +25 -0
  117. package/src/spec/PlotLegend.ts +70 -0
  118. package/src/spec/PlotMark.ts +53 -0
  119. package/src/spec/PlotTypes.ts +519 -0
  120. package/src/spec/Spec.ts +70 -0
  121. package/src/spec/Transform.ts +446 -0
  122. package/src/spec/VConcat.ts +9 -0
  123. package/src/spec/VSpace.ts +9 -0
  124. package/src/spec/interactors/Highlight.ts +38 -0
  125. package/src/spec/interactors/Interval1D.ts +67 -0
  126. package/src/spec/interactors/Interval2D.ts +48 -0
  127. package/src/spec/interactors/Nearest.ts +48 -0
  128. package/src/spec/interactors/PanZoom.ts +65 -0
  129. package/src/spec/interactors/Toggle.ts +65 -0
  130. package/src/spec/marks/Area.ts +154 -0
  131. package/src/spec/marks/Arrow.ts +108 -0
  132. package/src/spec/marks/Axis.ts +305 -0
  133. package/src/spec/marks/Bar.ts +160 -0
  134. package/src/spec/marks/Cell.ts +62 -0
  135. package/src/spec/marks/Contour.ts +25 -0
  136. package/src/spec/marks/Delaunay.ts +95 -0
  137. package/src/spec/marks/DenseLine.ts +30 -0
  138. package/src/spec/marks/Density.ts +145 -0
  139. package/src/spec/marks/Dot.ts +152 -0
  140. package/src/spec/marks/ErrorBar.ts +91 -0
  141. package/src/spec/marks/Frame.ts +23 -0
  142. package/src/spec/marks/Geo.ts +58 -0
  143. package/src/spec/marks/Hexbin.ts +34 -0
  144. package/src/spec/marks/Hexgrid.ts +27 -0
  145. package/src/spec/marks/Image.ts +101 -0
  146. package/src/spec/marks/Line.ts +93 -0
  147. package/src/spec/marks/Link.ts +70 -0
  148. package/src/spec/marks/Marks.ts +1088 -0
  149. package/src/spec/marks/Raster.ts +145 -0
  150. package/src/spec/marks/Rect.ts +183 -0
  151. package/src/spec/marks/Regression.ts +63 -0
  152. package/src/spec/marks/Rule.ts +113 -0
  153. package/src/spec/marks/Text.ts +127 -0
  154. package/src/spec/marks/Tick.ts +69 -0
  155. package/src/spec/marks/Vector.ts +113 -0
  156. package/src/util.js +8 -0
  157. package/tsconfig.json +11 -0
  158. package/LICENSE +0 -47
@@ -0,0 +1,305 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { Interval } from '../PlotTypes.js';
3
+ import { MarkOptions } from './Marks.js';
4
+ import { RuleXOptions, RuleYOptions } from './Rule.js';
5
+ import { TextOptions } from './Text.js';
6
+ import { TickXOptions, TickYOptions } from './Tick.js';
7
+
8
+ /** The scale options used by axis and grid marks. */
9
+ interface ScaleOptions {
10
+ /**
11
+ * Enforces uniformity for data at regular intervals, such as integer values
12
+ * or daily samples. The interval may be one of:
13
+ *
14
+ * - a named time interval such as *day* (for date intervals)
15
+ * - a number (for number intervals), defining intervals at integer multiples of *n*
16
+ *
17
+ * This option sets the internal transform to the given interval’s
18
+ * *interval*.floor function. In addition, the default **domain** will align
19
+ * with interval boundaries.
20
+ */
21
+ interval?: Interval | ParamRef;
22
+
23
+ /**
24
+ * The desired approximate number of axis ticks, or an explicit array of tick
25
+ * values, or an interval such as *day* or *month*.
26
+ */
27
+ ticks?: number | Interval | any[] | ParamRef;
28
+
29
+ /**
30
+ * The length of axis tick marks in pixels; negative values extend in the
31
+ * opposite direction. Defaults to 6 for *x* and *y* axes and *color* and
32
+ * *opacity* *ramp* legends, and 0 for *fx* and *fy* axes.
33
+ */
34
+ tickSize?: number | ParamRef;
35
+
36
+ /**
37
+ * The desired approximate spacing between adjacent axis ticks, affecting the
38
+ * default **ticks**; defaults to 80 pixels for *x* and *fx*, and 35 pixels
39
+ * for *y* and *fy*.
40
+ */
41
+ tickSpacing?: number | ParamRef;
42
+
43
+ /**
44
+ * The distance between an axis tick mark and its associated text label (in
45
+ * pixels); often defaults to 3, but may be affected by **xTickSize** and
46
+ * **xTickRotate**.
47
+ */
48
+ tickPadding?: number | ParamRef;
49
+
50
+ /**
51
+ * How to format inputs (abstract values) for axis tick labels; one of:
52
+ *
53
+ * - a [d3-format][1] string for numeric scales
54
+ * - a [d3-time-format][2] string for temporal scales
55
+ *
56
+ * [1]: https://d3js.org/d3-time
57
+ * [2]: https://d3js.org/d3-time-format
58
+ */
59
+ tickFormat?: string | null | ParamRef;
60
+
61
+ /**
62
+ * The rotation angle of axis tick labels in degrees clocksize; defaults to 0.
63
+ */
64
+ tickRotate?: number | ParamRef;
65
+
66
+ /**
67
+ * A textual label to show on the axis or legend; if null, show no label. By
68
+ * default the scale label is inferred from channel definitions, possibly with
69
+ * an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value.
70
+ *
71
+ * For axes and legends only.
72
+ */
73
+ label?: string | null | ParamRef;
74
+
75
+ /**
76
+ * Where to place the axis **label** relative to the plot’s frame. For
77
+ * vertical position scales (*y* and *fy*), may be *top*, *bottom*, or
78
+ * *center*; for horizontal position scales (*x* and *fx*), may be *left*,
79
+ * *right*, or *center*. Defaults to *center* for ordinal scales (including
80
+ * *fx* and *fy*), and otherwise *top* for *y*, and *right* for *x*.
81
+ */
82
+ labelAnchor?: 'top' | 'right' | 'bottom' | 'left' | 'center' | ParamRef;
83
+
84
+ /**
85
+ * The axis **label** position offset (in pixels); default depends on margins
86
+ * and orientation.
87
+ */
88
+ labelOffset?: number | ParamRef;
89
+
90
+ /**
91
+ * Whether to apply a directional arrow such as → or ↑ to the scale label. If
92
+ * *auto* (the default), the presence of the arrow depends on whether the
93
+ * scale is ordinal.
94
+ */
95
+ labelArrow?: 'auto' | 'up' | 'right' | 'down' | 'left' | 'none' | true | false | null | ParamRef;
96
+ }
97
+
98
+ /** The subset of scale options for grids. */
99
+ type GridScaleOptions = Pick<ScaleOptions, 'interval' | 'ticks' | 'tickSpacing'>;
100
+
101
+ /** The subset of scale options for axes. */
102
+ type AxisScaleOptions = Pick<ScaleOptions, 'tickSize' | 'tickPadding' | 'tickFormat' | 'tickRotate' | 'label' | 'labelOffset' | 'labelAnchor' | 'labelArrow'>;
103
+
104
+ /** Options for the grid marks. */
105
+ export interface GridOptions extends GridScaleOptions {
106
+ /**
107
+ * The side of the frame on which to place the axis: *top* or *bottom* for
108
+ * horizontal axes (axisX and axisFx) and their associated vertical grids
109
+ * (gridX and gridFx), or *left* or *right* for vertical axes (axisY and
110
+ * axisFY) and their associated horizontal grids (gridY and gridFy).
111
+ *
112
+ * The default **anchor** depends on the associated scale:
113
+ *
114
+ * - *x* - *bottom*
115
+ * - *y* - *left*
116
+ * - *fx* - *top* if there is a *bottom* *x* axis, and otherwise *bottom*
117
+ * - *fy* - *right* if there is a *left* *y* axis, and otherwise *right*
118
+ *
119
+ * For grids, the **anchor** also affects the extent of grid lines when the
120
+ * opposite dimension is specified (**x** for gridY and **y** for gridX).
121
+ */
122
+ anchor?: 'top' | 'right' | 'bottom' | 'left' | ParamRef;
123
+
124
+ /**
125
+ * A shorthand for setting both **fill** and **stroke**; affects the stroke of
126
+ * tick vectors and grid rules, and the fill of tick texts and axis label
127
+ * texts; defaults to *currentColor*.
128
+ */
129
+ color?: MarkOptions['stroke'];
130
+
131
+ /**
132
+ * A shorthand for setting both **fillOpacity** and **strokeOpacity**; affects
133
+ * the stroke opacity of tick vectors and grid rules, and the fill opacity of
134
+ * tick texts and axis label texts; defaults to 1 for axes and 0.1 for grids.
135
+ */
136
+ opacity?: MarkOptions['opacity'];
137
+ }
138
+
139
+ /** Options for the axis marks. */
140
+ export interface AxisOptions extends GridOptions, MarkOptions, TextOptions, AxisScaleOptions {
141
+ /** The tick text **stroke**, say for a *white* outline to improve legibility; defaults to null. */
142
+ textStroke?: MarkOptions['stroke'];
143
+ /** The tick text **strokeOpacity**; defaults to 1; has no effect unless **textStroke** is set. */
144
+ textStrokeOpacity?: MarkOptions['strokeOpacity'];
145
+ /** The tick text **strokeWidth**; defaults to 4; has no effect unless **textStroke** is set. */
146
+ textStrokeWidth?: MarkOptions['strokeWidth'];
147
+ }
148
+
149
+ /** Options for the axisX and axisFx marks. */
150
+ export interface AxisXOptions extends AxisOptions, Omit<TickXOptions, 'data'> {}
151
+
152
+ /** Options for the axisY and axisFy marks. */
153
+ export interface AxisYOptions extends AxisOptions, Omit<TickYOptions, 'data'> {}
154
+
155
+ /** Options for the gridX and gridFx marks. */
156
+ export interface GridXOptions extends GridOptions, Omit<RuleXOptions, 'data' | 'interval'> {}
157
+
158
+ /** Options for the gridY and gridFy marks. */
159
+ export interface GridYOptions extends GridOptions, Omit<RuleYOptions, 'data' | 'interval'> {}
160
+
161
+ /** The axisX mark. */
162
+ export interface AxisX extends AxisXOptions {
163
+ /**
164
+ * An axis mark to document the visual encoding of the horizontal position
165
+ * *x* scale, comprised of (up to) three marks: a vector for ticks, a text
166
+ * for tick labels, and another text for an axis label. The data defaults to
167
+ * tick values sampled from the *x* scale’s domain; if desired, use one of
168
+ * the **ticks**, **tickSpacing**, or **interval** options.
169
+ *
170
+ * The **facetAnchor** option defaults to *bottom-empty* if **anchor** is
171
+ * *bottom*, and *top-empty* if **anchor** is *top*. The default margins
172
+ * likewise depend on **anchor** as follows; in order of **marginTop**,
173
+ * **marginRight**, **marginBottom**, and **marginLeft**, in pixels:
174
+ *
175
+ * - *top* - 30, 20, 0, 20
176
+ * - *bottom* - 0, 20, 30, 20
177
+ *
178
+ * For simplicity, and for consistent layout across plots, default axis margins
179
+ * are not affected by tick labels. If tick labels are too long, either increase
180
+ * the margin or shorten the labels: use the *k* SI-prefix tick format; use the
181
+ * **transform** *y*-scale option to show thousands or millions; or use the
182
+ * **textOverflow** and **lineWidth** options to clip.
183
+ */
184
+ mark: 'axisX';
185
+ }
186
+
187
+ /** The axisFx mark. */
188
+ export interface AxisFx extends AxisXOptions {
189
+ /**
190
+ * An axis mark to document the visual encoding of the horizontal facet
191
+ * position *fx* scale, comprised of (up to) three marks: a vector for ticks,
192
+ * a text for tick labels, and another text for an axis label. The data
193
+ * defaults to the *fx* scale’s domain; if desired, use one of the **ticks**,
194
+ * **tickSpacing**, or **interval** options.
195
+ *
196
+ * The **facetAnchor** and **frameAnchor** options defaults to **anchor**. The
197
+ * default margins likewise depend on **anchor** as follows; in order of
198
+ * **marginTop**, **marginRight**, **marginBottom**, and **marginLeft**, in
199
+ * pixels:
200
+ *
201
+ * - *top* - 30, 20, 0, 20
202
+ * - *bottom* - 0, 20, 30, 20
203
+ *
204
+ * For simplicity, and for consistent layout across plots, default axis margins
205
+ * are not affected by tick labels. If tick labels are too long, either increase
206
+ * the margin or shorten the labels: use the *k* SI-prefix tick format; use the
207
+ * **transform** *y*-scale option to show thousands or millions; or use the
208
+ * **textOverflow** and **lineWidth** options to clip.
209
+ */
210
+ mark: 'axisFx';
211
+ }
212
+
213
+ /** The axisY mark. */
214
+ export interface AxisY extends AxisYOptions {
215
+ /**
216
+ * An axis mark to document the visual encoding of the vertical position *y*
217
+ * scale, comprised of (up to) three marks: a vector for ticks, a text for
218
+ * tick labels, and another text for an axis label. The data defaults to tick
219
+ * values sampled from the *y* scale’s domain; if desired, use one of the
220
+ * **ticks**, **tickSpacing**, or **interval** options.
221
+ *
222
+ * The **facetAnchor** option defaults to *right-empty* if **anchor** is
223
+ * *right*, and *left-empty* if **anchor** is *left*. The default margins
224
+ * likewise depend on **anchor** as follows; in order of **marginTop**,
225
+ * **marginRight**, **marginBottom**, and **marginLeft**, in pixels:
226
+ *
227
+ * - *right* - 20, 40, 20, 0
228
+ * - *left* - 20, 0, 20, 40
229
+ *
230
+ * For simplicity, and for consistent layout across plots, default axis
231
+ * margins are not affected by tick labels. If tick labels are too long,
232
+ * either increase the margin or shorten the labels: use the *k* SI-prefix
233
+ * tick format; or use the **textOverflow** and **lineWidth** options to
234
+ * clip.
235
+ */
236
+ mark: 'axisY';
237
+ }
238
+
239
+ /** The axisFy mark. */
240
+ export interface AxisFy extends AxisYOptions {
241
+ /**
242
+ * An axis mark to document the visual encoding of the vertical facet
243
+ * position *fy* scale, comprised of (up to) three marks: a vector for ticks,
244
+ * a text for tick labels, and another text for an axis label. The data
245
+ * defaults to the *fy* scale’s domain; if desired, use one of the **ticks**,
246
+ * **tickSpacing**, or **interval** options.
247
+ *
248
+ * The **facetAnchor** option defaults to *right-empty* if **anchor** is
249
+ * *right*, and *left-empty* if **anchor** is *left*. The default margins
250
+ * likewise depend on **anchor** as follows; in order of **marginTop**,
251
+ * **marginRight**, **marginBottom**, and **marginLeft**, in pixels:
252
+ *
253
+ * - *right* - 20, 40, 20, 0
254
+ * - *left* - 20, 0, 20, 40
255
+ *
256
+ * For simplicity, and for consistent layout across plots, default axis
257
+ * margins are not affected by tick labels. If tick labels are too long,
258
+ * either increase the margin or shorten the labels: use the *k* SI-prefix
259
+ * tick format; or use the **textOverflow** and **lineWidth** options to
260
+ * clip.
261
+ */
262
+ mark: 'axisFy';
263
+ }
264
+
265
+ /** The gridX mark. */
266
+ export interface GridX extends GridXOptions {
267
+ /**
268
+ * A horizontally-positioned ruleX mark (a vertical line, |) that renders a
269
+ * grid for the *x* scale. The data defaults to tick values sampled from the
270
+ * *x* scale’s domain; if desired, use one of the **ticks**, **tickSpacing**,
271
+ * or **interval** options.
272
+ */
273
+ mark: 'gridX';
274
+ }
275
+
276
+ /** The gridFx mark. */
277
+ export interface GridFx extends GridXOptions {
278
+ /**
279
+ * A horizontally-positioned ruleX mark (a vertical line, |) that renders a
280
+ * grid for the *fx* scale. The data defaults to the *fx* scale’s domain;
281
+ * if desired, use the **ticks** option.
282
+ */
283
+ mark: 'gridFx';
284
+ }
285
+
286
+ /** The gridY mark. */
287
+ export interface GridY extends GridYOptions {
288
+ /**
289
+ * A vertically-positioned ruleY mark (a horizontal line, —) that renders a
290
+ * grid for the *y* scale. The data defaults to tick values sampled from the
291
+ * *y* scale’s domain; if desired, use one of the **ticks**, **tickSpacing**,
292
+ * or **interval** options.
293
+ */
294
+ mark: 'gridY';
295
+ }
296
+
297
+ /** The gridFy mark. */
298
+ export interface GridFy extends GridYOptions {
299
+ /**
300
+ * A vertically-positioned ruleY mark (a horizontal line, —) that renders a
301
+ * grid for the *fy* scale. The data defaults to the *fy* scale’s domain;
302
+ * if desired, use the **ticks** option.
303
+ */
304
+ mark: 'gridFy';
305
+ }
@@ -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
+ }