@uwdata/mosaic-spec 0.7.1 → 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 +2977 -4237
  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 +9 -3
  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,1062 @@
1
+ import { AggregateExpression, SQLExpression } from '../Expression.js';
2
+ import { ParamRef } from '../Param.js';
3
+ import { PlotMarkData } from '../PlotFrom.js';
4
+ import { CurveName, FrameAnchor, Interval, Reducer, ScaleName } from '../PlotTypes.js';
5
+ import { Transform } from '../Transform.js';
6
+
7
+ /** The set of known channel names. */
8
+ export type ChannelName =
9
+ | 'ariaLabel'
10
+ | 'fill'
11
+ | 'fillOpacity'
12
+ | 'fontSize'
13
+ | 'fx'
14
+ | 'fy'
15
+ | 'geometry'
16
+ | 'height'
17
+ | 'href'
18
+ | 'length'
19
+ | 'opacity'
20
+ | 'path'
21
+ | 'r'
22
+ | 'rotate'
23
+ | 'src'
24
+ | 'stroke'
25
+ | 'strokeOpacity'
26
+ | 'strokeWidth'
27
+ | 'symbol'
28
+ | 'text'
29
+ | 'title'
30
+ | 'weight'
31
+ | 'width'
32
+ | 'x'
33
+ | 'x1'
34
+ | 'x2'
35
+ | 'y'
36
+ | 'y1'
37
+ | 'y2'
38
+ | 'z';
39
+
40
+ type ChannelScale = ScaleName | 'auto' | boolean | null;
41
+
42
+ /**
43
+ * A channel’s values may be expressed as:
44
+ *
45
+ * - a field name, to extract the corresponding value for each datum
46
+ * - an iterable of values, typically of the same length as the data
47
+ * - a channel transform or SQL expression
48
+ * - a constant number or boolean
49
+ * - null to represent no value
50
+ */
51
+ export type ChannelValue =
52
+ | any[] // column of values
53
+ | (string & Record<never, never>) // field or literal color; see also https://github.com/microsoft/TypeScript/issues/29729
54
+ | number // constant
55
+ | boolean // constant
56
+ | null // constant
57
+ | Transform
58
+ | SQLExpression
59
+ | AggregateExpression;
60
+
61
+ /**
62
+ * When specifying a mark channel’s value, you can provide a {value, scale}
63
+ * object to override the scale that would normally be associated with the
64
+ * channel.
65
+ */
66
+ export type ChannelValueSpec =
67
+ | ChannelValue
68
+ | {
69
+ value: ChannelValue;
70
+ label?: string;
71
+ scale?: ScaleName | 'auto' | boolean | null;
72
+ };
73
+
74
+ /**
75
+ * In some contexts, when specifying a mark channel’s value, you can provide a
76
+ * {value, interval} object to specify an associated interval.
77
+ */
78
+ export type ChannelValueIntervalSpec =
79
+ | ChannelValueSpec
80
+ | { value: ChannelValue; interval: Interval };
81
+
82
+ /** A channel name, or an implied one for domain sorting. */
83
+ type ChannelDomainName = ChannelName | 'data' | 'width' | 'height';
84
+
85
+ /**
86
+ * The available inputs for imputing scale domains. In addition to a named
87
+ * channel, an input may be specified as:
88
+ *
89
+ * - *data* - impute from mark data
90
+ * - *width* - impute from |*x2* - *x1*|
91
+ * - *height* - impute from |*y2* - *y1*|
92
+ * - null - impute from input order
93
+ *
94
+ * If the *x* channel is not defined, the *x2* channel will be used instead if
95
+ * available, and similarly for *y* and *y2*; this is useful for marks that
96
+ * implicitly stack. The *data* input is typically used in conjunction with a
97
+ * custom **reduce** function, as when the built-in single-channel reducers are
98
+ * insufficient.
99
+ */
100
+ export type ChannelDomainValue = ChannelDomainName | `-${ChannelDomainName}` | null;
101
+
102
+ /** Options for imputing scale domains from channel values. */
103
+ export interface ChannelDomainOptions {
104
+ /**
105
+ * How to produce a singular value (for subsequent sorting) from aggregated
106
+ * channel values; one of:
107
+ *
108
+ * - true (default) - alias for *max*
109
+ * - false or null - disabled; don’t impute the scale domain
110
+ * - a named reducer implementation such as *count* or *sum*
111
+ * - a function that takes an array of values and returns the reduced value
112
+ * - an object that implements the *reduceIndex* method
113
+ */
114
+ reduce?: Reducer | boolean | null;
115
+
116
+ /** How to order reduced values. */
117
+ order?: 'ascending' | 'descending' | null;
118
+
119
+ /** If true, reverse the order after sorting. */
120
+ reverse?: boolean;
121
+
122
+ /**
123
+ * If a positive number, limit the domain to the first *n* sorted values. If a
124
+ * negative number, limit the domain to the last *-n* sorted values. Hence, a
125
+ * positive **limit** with **reverse** true will return the top *n* values in
126
+ * descending order.
127
+ *
128
+ * If an array [*lo*, *hi*], slices the sorted domain from *lo* (inclusive) to
129
+ * *hi* (exclusive). As with [*array*.slice][1], if either *lo* or *hi* are
130
+ * negative, it indicates an offset from the end of the array; if *lo* is
131
+ * undefined it defaults to 0, and if *hi* is undefined it defaults to
132
+ * Infinity.
133
+ *
134
+ * Note: limiting the imputed domain of one scale, say *x*, does not affect
135
+ * the imputed domain of another scale, say *y*; each scale domain is imputed
136
+ * independently.
137
+ *
138
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice
139
+ */
140
+ limit?: number | [lo?: number, hi?: number];
141
+ }
142
+
143
+ /** How to derive a scale’s domain from a channel’s values. */
144
+ export type ChannelDomainValueSpec =
145
+ | ChannelDomainValue
146
+ | ({ value: ChannelDomainValue } & ChannelDomainOptions);
147
+
148
+ /** How to impute scale domains from channel values. */
149
+ export type ChannelDomainSort = {
150
+ [key in ScaleName]?: ChannelDomainValueSpec
151
+ } & ChannelDomainOptions;
152
+
153
+ /**
154
+ * Output channels for aggregating transforms, such as bin and group. Each
155
+ * declared output channel has an associated reducer, and typically a
156
+ * corresponding input channel in *options*. Non-grouping channels declared in
157
+ * *options* but not *outputs* are computed on reduced data after grouping,
158
+ * which defaults to the array of data for the current group.
159
+ *
160
+ * If **title** is in *options* but not *outputs*, the reducer defaults to
161
+ * summarizing the most common values. If **href** is in *options* but not
162
+ * *outputs*, the reducer defaults to *first*. When **x1** or **x2** is in
163
+ * *outputs*, reads the input channel **x** if **x1** or **x2** is not in
164
+ * *options*; likewise for **y1** or **y2**, reads the input channel **y** if
165
+ * **y1** or **y2** is not in *options*.
166
+ */
167
+ export type ChannelReducers<T = Reducer> = {
168
+ [key in ChannelName]?: T | { reduce: T; scale?: ChannelScale } | null
169
+ };
170
+
171
+ /** Abstract (unscaled) values, and associated scale, per channel. */
172
+ export type ChannelStates = {
173
+ [key in ChannelName]?: { value: any[]; scale: ScaleName | null }
174
+ };
175
+
176
+ /** Possibly-scaled values for each channel. */
177
+ export type ChannelValues = {
178
+ [key in ChannelName]?: any[]
179
+ } & { channels: ChannelStates };
180
+
181
+ /**
182
+ * How to order values; one of:
183
+ *
184
+ * - a function for comparing data, returning a signed number
185
+ * - a channel value definition for sorting given values in ascending order
186
+ * - a {value, order} object for sorting given values
187
+ * - a {channel, order} object for sorting the named channel’s values
188
+ */
189
+ export type SortOrder =
190
+ | ChannelValue
191
+ | { value?: ChannelValue; order?: 'ascending' | 'descending' }
192
+ | { channel?: ChannelName | `-${ChannelName}`; order?: 'ascending' | 'descending' };
193
+
194
+ /** The pointer mode for the tip; corresponds to pointerX, pointerY, and pointer. */
195
+ export type TipPointer = 'x' | 'y' | 'xy';
196
+
197
+ export interface MarkData {
198
+ /**
199
+ * The data source for the mark.
200
+ */
201
+ data: PlotMarkData;
202
+ }
203
+
204
+ export interface MarkDataOptional {
205
+ /**
206
+ * The data source for the mark.
207
+ */
208
+ data?: PlotMarkData;
209
+ }
210
+
211
+ /** Shared options for all marks. */
212
+ export interface MarkOptions {
213
+ /**
214
+ * Applies a transform to filter the mark’s index according to the given
215
+ * channel values; only truthy values are retained.
216
+ *
217
+ * Note that filtering only affects the rendered mark index, not the
218
+ * associated channel values, and thus has no effect on imputed scale domains.
219
+ */
220
+ filter?: ChannelValue;
221
+
222
+ /**
223
+ * Applies a transform to reverse the order of the mark’s index, say for
224
+ * reverse input order.
225
+ */
226
+ reverse?: boolean | ParamRef;
227
+
228
+ /**
229
+ * Either applies a transform to sort the mark’s index by the specified
230
+ * channel values, or imputes ordinal scale domains from this mark’s channels.
231
+ *
232
+ * When imputing ordinal scale domains from channel values, the **sort**
233
+ * option is an object whose keys are ordinal scale names such as *x* or *fx*,
234
+ * and whose values are channel names such as *y*, *y1*, or *y2*. For example,
235
+ * to impute the *y* scale’s domain from the associated *x* channel values in
236
+ * ascending order:
237
+ *
238
+ * ```js
239
+ * sort: {y: "x"}
240
+ * ```
241
+ *
242
+ * For different sort options for different scales, replace the channel name
243
+ * with a *value* object and per-scale options:
244
+ *
245
+ * ```js
246
+ * sort: {y: {value: "-x"}}
247
+ * ```
248
+ *
249
+ * When sorting the mark’s index, the **sort** option is instead one of:
250
+ *
251
+ * - a channel value definition for sorting given values in ascending order
252
+ * - a {value, order} object for sorting given values
253
+ * - a {channel, order} object for sorting the named channel’s values
254
+ */
255
+ sort?: SortOrder | ChannelDomainSort;
256
+
257
+ /**
258
+ * The horizontal facet position channel, for mark-level faceting, bound to
259
+ * the *fx* scale.
260
+ */
261
+ fx?: ChannelValue;
262
+
263
+ /**
264
+ * The vertical facet position channel, for mark-level faceting, bound to the
265
+ * *fy* scale.
266
+ */
267
+ fy?: ChannelValue;
268
+
269
+ /**
270
+ * Whether to enable or disable faceting; one of:
271
+ *
272
+ * - *auto* (default) - automatically determine if this mark should be faceted
273
+ * - *include* (or true) - draw the subset of the mark’s data in the current facet
274
+ * - *exclude* - draw the subset of the mark’s data *not* in the current facet
275
+ * - *super* - draw this mark in a single frame that covers all facets
276
+ * - null (or false) - repeat this mark’s data across all facets (*i.e.*, no faceting)
277
+ *
278
+ * When a mark uses *super* faceting, it is not allowed to use position scales
279
+ * (*x*, *y*, *fx*, or *fy*); *super* faceting is intended for decorations,
280
+ * such as labels and legends.
281
+ *
282
+ * When top-level faceting is used, the default *auto* setting is equivalent
283
+ * to *include* when the mark data is strictly equal to the top-level facet
284
+ * data; otherwise it is equivalent to null. When the *include* or *exclude*
285
+ * facet mode is chosen, the mark data must be parallel to the top-level facet
286
+ * data: the data must have the same length and order. If the data are not
287
+ * parallel, then the wrong data may be shown in each facet. The default
288
+ * *auto* therefore requires strict equality (`===`) for safety, and using the
289
+ * facet data as mark data is recommended when using the *exclude* facet mode.
290
+ * (To construct parallel data safely, consider using [*array*.map][1] on the
291
+ * facet data.)
292
+ *
293
+ * When mark-level faceting is used, the default *auto* setting is equivalent
294
+ * to *include*: the mark will be faceted if either the **fx** or **fy**
295
+ * channel option (or both) is specified. The null or false option will
296
+ * disable faceting, while *exclude* draws the subset of the mark’s data *not*
297
+ * in the current facet.
298
+ *
299
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
300
+ */
301
+ facet?: 'auto' | 'include' | 'exclude' | 'super' | boolean | null | ParamRef;
302
+
303
+ /**
304
+ * How to place the mark with respect to facets; one of:
305
+ *
306
+ * - null (default for most marks) - display the mark in each non-empty facet
307
+ * - *top*, *right*, *bottom*, or *left* - display the mark only in facets on
308
+ * the given side
309
+ * - *top-empty*, *right-empty*, *bottom-empty*, or *left-empty* (default for
310
+ * axis marks) - display the mark only in facets that have empty space on
311
+ * the given side: either the margin, or an empty facet
312
+ * - *empty* - display the mark in empty facets only
313
+ */
314
+ facetAnchor?:
315
+ | 'top'
316
+ | 'right'
317
+ | 'bottom'
318
+ | 'left'
319
+ | 'top-left'
320
+ | 'top-right'
321
+ | 'bottom-left'
322
+ | 'bottom-right'
323
+ | 'top-empty'
324
+ | 'right-empty'
325
+ | 'bottom-empty'
326
+ | 'left-empty'
327
+ | 'empty'
328
+ | null
329
+ | ParamRef;
330
+
331
+ /**
332
+ * Shorthand to set the same default for all four mark margins: **marginTop**,
333
+ * **marginRight**, **marginBottom**, and **marginLeft**; typically defaults
334
+ * to 0, except for axis marks.
335
+ */
336
+ margin?: number | ParamRef;
337
+
338
+ /**
339
+ * The mark’s top margin; the minimum distance in pixels between the top edges
340
+ * of the inner and outer plot area.
341
+ */
342
+ marginTop?: number | ParamRef;
343
+
344
+ /**
345
+ * The mark’s right margin; the minimum distance in pixels between the right
346
+ * edges of the mark’s inner and outer plot area.
347
+ */
348
+ marginRight?: number | ParamRef;
349
+
350
+ /**
351
+ * The mark’s bottom margin; the minimum distance in pixels between the bottom
352
+ * edges of the inner and outer plot area.
353
+ */
354
+ marginBottom?: number | ParamRef;
355
+
356
+ /**
357
+ * The mark’s left margin; the minimum distance in pixels between the left
358
+ * edges of the inner and outer plot area.
359
+ */
360
+ marginLeft?: number | ParamRef;
361
+
362
+ /**
363
+ * The [aria-description][1]; a constant textual description.
364
+ *
365
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-description
366
+ */
367
+ ariaDescription?: string | ParamRef;
368
+
369
+ /**
370
+ * The [aria-hidden][1] state; a constant indicating whether the element is
371
+ * exposed to an accessibility API.
372
+ *
373
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden
374
+ */
375
+ ariaHidden?: string | ParamRef;
376
+
377
+ /**
378
+ * The [aria-label][1]; a channel specifying short textual labels representing
379
+ * the value in the accessibility tree.
380
+ *
381
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label
382
+ */
383
+ ariaLabel?: ChannelValue;
384
+
385
+ /**
386
+ * The [pointer-events][1] property; a constant string such as *none*.
387
+ *
388
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
389
+ */
390
+ pointerEvents?: string | ParamRef;
391
+
392
+ /**
393
+ * The title; a channel specifying accessible, short textual descriptions as
394
+ * strings (possibly with newlines). If the tip option is specified, the title
395
+ * will be displayed with an interactive tooltip instead of using the SVG
396
+ * [title element][1].
397
+ *
398
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title
399
+ */
400
+ title?: ChannelValue;
401
+
402
+ /** Whether to generate a tooltip for this mark, and any tip options. */
403
+ tip?:
404
+ | boolean
405
+ | TipPointer
406
+ | (TipOptions & { pointer?: TipPointer })
407
+ | ParamRef;
408
+
409
+ /**
410
+ * How to clip the mark; one of:
411
+ *
412
+ * - *frame* or true - clip to the plot’s frame (inner area)
413
+ * - *sphere* - clip to the projected sphere (*e.g.*, front hemisphere)
414
+ * - null or false - do not clip
415
+ *
416
+ * The *sphere* clip option requires a geographic projection.
417
+ */
418
+ clip?: 'frame' | 'sphere' | boolean | null | ParamRef;
419
+
420
+ /**
421
+ * The horizontal offset in pixels; a constant option. On low-density screens,
422
+ * an additional 0.5px offset may be applied for crisp edges.
423
+ */
424
+ dx?: number | ParamRef;
425
+
426
+ /**
427
+ * The vertical offset in pixels; a constant option. On low-density screens,
428
+ * an additional 0.5px offset may be applied for crisp edges.
429
+ */
430
+ dy?: number | ParamRef;
431
+
432
+ /**
433
+ * The [fill][1]; a constant CSS color string, or a channel typically bound to
434
+ * the *color* scale. If all channel values are valid CSS colors, by default
435
+ * the channel will not be bound to the *color* scale, interpreting the colors
436
+ * literally.
437
+ *
438
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill
439
+ */
440
+ fill?: ChannelValueSpec | ParamRef;
441
+
442
+ /**
443
+ * The [fill-opacity][1]; a constant number between 0 and 1, or a channel
444
+ * typically bound to the *opacity* scale. If all channel values are numbers
445
+ * in [0, 1], by default the channel will not be bound to the *opacity* scale,
446
+ * interpreting the opacities literally.
447
+ *
448
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-opacity
449
+ */
450
+ fillOpacity?: ChannelValueSpec | ParamRef;
451
+
452
+ /**
453
+ * The [stroke][1]; a constant CSS color string, or a channel typically bound
454
+ * to the *color* scale. If all channel values are valid CSS colors, by
455
+ * default the channel will not be bound to the *color* scale, interpreting
456
+ * the colors literally.
457
+ *
458
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke
459
+ */
460
+ stroke?: ChannelValueSpec | ParamRef;
461
+
462
+ /**
463
+ * The [stroke-dasharray][1]; a constant number indicating the length in
464
+ * pixels of alternating dashes and gaps, or a constant string of numbers
465
+ * separated by spaces or commas (_e.g._, *10 2* for dashes of 10 pixels
466
+ * separated by gaps of 2 pixels), or *none* (the default) for no dashing
467
+ *
468
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray
469
+ */
470
+ strokeDasharray?: string | number | ParamRef;
471
+
472
+ /**
473
+ * The [stroke-dashoffset][1]; a constant indicating the offset in pixels of
474
+ * the first dash along the stroke; defaults to zero.
475
+ *
476
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dashoffset
477
+ */
478
+ strokeDashoffset?: string | number | ParamRef;
479
+
480
+ /**
481
+ * The [stroke-linecap][1]; a constant specifying how to cap stroked paths,
482
+ * such as *butt*, *round*, or *square*.
483
+ *
484
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linecap
485
+ */
486
+ strokeLinecap?: string | ParamRef;
487
+
488
+ /**
489
+ * The [stroke-linejoin][1]; a constant specifying how to join stroked paths,
490
+ * such as *bevel*, *miter*, *miter-clip*, or *round*.
491
+ *
492
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linejoin
493
+ */
494
+ strokeLinejoin?: string | ParamRef;
495
+
496
+ /**
497
+ * The [stroke-miterlimit][1]; a constant number specifying how to limit the
498
+ * length of *miter* joins on stroked paths.
499
+ *
500
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-miterlimit
501
+ */
502
+ strokeMiterlimit?: number | ParamRef;
503
+
504
+ /**
505
+ * The [stroke-opacity][1]; a constant between 0 and 1, or a channel typically
506
+ * bound to the *opacity* scale. If all channel values are numbers in [0, 1],
507
+ * by default the channel will not be bound to the *opacity* scale,
508
+ * interpreting the opacities literally.
509
+ *
510
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-opacity
511
+ */
512
+ strokeOpacity?: ChannelValueSpec;
513
+
514
+ /**
515
+ * The [stroke-width][1]; a constant number in pixels, or a channel.
516
+ *
517
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-width
518
+ */
519
+ strokeWidth?: ChannelValueSpec;
520
+
521
+ /**
522
+ * The [opacity][1]; a constant between 0 and 1, or a channel typically bound
523
+ * to the *opacity* scale. If all channel values are numbers in [0, 1], by
524
+ * default the channel will not be bound to the *opacity* scale, interpreting
525
+ * the opacities literally. For faster rendering, prefer the **strokeOpacity**
526
+ * or **fillOpacity** option.
527
+ *
528
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/opacity
529
+ */
530
+ opacity?: ChannelValueSpec;
531
+
532
+ /**
533
+ * The [mix-blend-mode][1]; a constant string specifying how to blend content
534
+ * such as *multiply*.
535
+ *
536
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode
537
+ */
538
+ mixBlendMode?: string | ParamRef;
539
+
540
+ /**
541
+ * A CSS [filter][1]; a constant string used to adjust the rendering of
542
+ * images, such as *blur(5px)*.
543
+ *
544
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/CSS/filter
545
+ */
546
+ imageFilter?: string | ParamRef;
547
+
548
+ /**
549
+ * The [paint-order][1]; a constant string specifying the order in which the
550
+ * **fill**, **stroke**, and any markers are drawn; defaults to *normal*,
551
+ * which draws the fill, then stroke, then markers; defaults to *stroke* for
552
+ * the text mark to create a “halo” around text to improve legibility.
553
+ *
554
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/CSS/paint-order
555
+ */
556
+ paintOrder?: string | ParamRef;
557
+
558
+ /**
559
+ * The [shape-rendering][1]; a constant string such as *crispEdges*.
560
+ *
561
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering
562
+ */
563
+ shapeRendering?: string | ParamRef;
564
+
565
+ /**
566
+ * The [href][1]; a channel specifying URLs for clickable links. May be used
567
+ * in conjunction with the **target** option to open links in another window.
568
+ *
569
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/href
570
+ */
571
+ href?: ChannelValue;
572
+
573
+ /**
574
+ * The [target][1]; a constant string specifying the target window (_e.g._,
575
+ * *_blank*) for clickable links; used in conjunction with the **href**
576
+ * option.
577
+ *
578
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/target
579
+ */
580
+ target?: string | ParamRef;
581
+ }
582
+
583
+ /** Options for insetting rectangular shapes. */
584
+ export interface InsetOptions {
585
+ /**
586
+ * Shorthand to set the same default for all four insets: **insetTop**,
587
+ * **insetRight**, **insetBottom**, and **insetLeft**. All insets typically
588
+ * default to zero, though not always (say when using bin transform). A
589
+ * positive inset reduces effective area, while a negative inset increases it.
590
+ */
591
+ inset?: number | ParamRef;
592
+
593
+ /**
594
+ * Insets the top edge by the specified number of pixels. A positive value
595
+ * insets towards the bottom edge (reducing effective area), while a negative
596
+ * value insets away from the bottom edge (increasing it).
597
+ */
598
+ insetTop?: number | ParamRef;
599
+
600
+ /**
601
+ * Insets the right edge by the specified number of pixels. A positive value
602
+ * insets towards the left edge (reducing effective area), while a negative
603
+ * value insets away from the left edge (increasing it).
604
+ */
605
+ insetRight?: number | ParamRef;
606
+
607
+ /**
608
+ * Insets the bottom edge by the specified number of pixels. A positive value
609
+ * insets towards the top edge (reducing effective area), while a negative
610
+ * value insets away from the top edge (increasing it).
611
+ */
612
+ insetBottom?: number | ParamRef;
613
+
614
+ /**
615
+ * Insets the left edge by the specified number of pixels. A positive value
616
+ * insets towards the right edge (reducing effective area), while a negative
617
+ * value insets away from the right edge (increasing it).
618
+ */
619
+ insetLeft?: number | ParamRef;
620
+ }
621
+
622
+ /** Options for styling text (independent of anchor position). */
623
+ export interface TextStyles {
624
+ /**
625
+ * The [text anchor][1] controls how text is aligned (typically horizontally)
626
+ * relative to its anchor point; it is one of *start*, *end*, or *middle*. If
627
+ * the frame anchor is *left*, *top-left*, or *bottom-left*, the default text
628
+ * anchor is *start*; if the frame anchor is *right*, *top-right*, or
629
+ * *bottom-right*, the default is *end*; otherwise it is *middle*.
630
+ *
631
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/text-anchor
632
+ */
633
+ textAnchor?: 'start' | 'middle' | 'end' | ParamRef;
634
+
635
+ /**
636
+ * The line height in ems; defaults to 1. The line height affects the
637
+ * (typically vertical) separation between adjacent baselines of text, as well
638
+ * as the separation between the text and its anchor point.
639
+ */
640
+ lineHeight?: number | ParamRef;
641
+
642
+ /**
643
+ * The line width in ems (e.g., 10 for about 20 characters); defaults to
644
+ * infinity, disabling wrapping and clipping.
645
+ *
646
+ * If **textOverflow** is null, lines will be wrapped at the specified length.
647
+ * If a line is split at a soft hyphen (\xad), a hyphen (-) will be displayed
648
+ * at the end of the line. If **textOverflow** is not null, lines will be
649
+ * clipped according to the given strategy.
650
+ */
651
+ lineWidth?: number | ParamRef;
652
+
653
+ /**
654
+ * How truncate (or wrap) lines of text longer than the given **lineWidth**;
655
+ * one of:
656
+ *
657
+ * - null (default) - preserve overflowing characters (and wrap if needed)
658
+ * - *clip* or *clip-end* - remove characters from the end
659
+ * - *clip-start* - remove characters from the start
660
+ * - *ellipsis* or *ellipsis-end* - replace characters from the end with an ellipsis (…)
661
+ * - *ellipsis-start* - replace characters from the start with an ellipsis (…)
662
+ * - *ellipsis-middle* - replace characters from the middle with an ellipsis (…)
663
+ *
664
+ * If no **title** was specified, if text requires truncation, a title
665
+ * containing the non-truncated text will be implicitly added.
666
+ */
667
+ textOverflow?:
668
+ | null
669
+ | 'clip'
670
+ | 'ellipsis'
671
+ | 'clip-start'
672
+ | 'clip-end'
673
+ | 'ellipsis-start'
674
+ | 'ellipsis-middle'
675
+ | 'ellipsis-end'
676
+ | ParamRef;
677
+
678
+ /**
679
+ * If true, changes the default **fontFamily** to *monospace*, and uses
680
+ * simplified monospaced text metrics calculations.
681
+ */
682
+ monospace?: boolean | ParamRef;
683
+
684
+ /**
685
+ * The [font-family][1]; a constant; defaults to the plot’s font family, which
686
+ * is typically [*system-ui*][2].
687
+ *
688
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/CSS/font-family
689
+ * [2]: https://drafts.csswg.org/css-fonts-4/#valdef-font-family-system-ui
690
+ */
691
+ fontFamily?: string | ParamRef;
692
+
693
+ /**
694
+ * The [font size][1] in pixels; either a constant or a channel; defaults to
695
+ * the plot’s font size, which is typically 10. When a number, it is
696
+ * interpreted as a constant; otherwise it is interpreted as a channel.
697
+ *
698
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/CSS/font-size
699
+ */
700
+ fontSize?: ChannelValue | ParamRef;
701
+
702
+ /**
703
+ * The [font style][1]; a constant; defaults to the plot’s font style, which
704
+ * is typically *normal*.
705
+ *
706
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/CSS/font-style
707
+ */
708
+ fontStyle?: string | ParamRef;
709
+
710
+ /**
711
+ * The [font variant][1]; a constant; if the **text** channel contains numbers
712
+ * or dates, defaults to *tabular-nums* to facilitate comparing numbers;
713
+ * otherwise defaults to the plot’s font style, which is typically *normal*.
714
+ *
715
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant
716
+ */
717
+ fontVariant?: string | ParamRef;
718
+
719
+ /**
720
+ * The [font weight][1]; a constant; defaults to the plot’s font weight, which
721
+ * is typically *normal*.
722
+ *
723
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
724
+ */
725
+ fontWeight?: string | number | ParamRef;
726
+ }
727
+
728
+ /** Options for the tip mark. */
729
+ export interface TipOptions extends MarkOptions, TextStyles {
730
+ /**
731
+ * The horizontal position channel specifying the tip’s anchor, typically
732
+ * bound to the *x* scale.
733
+ */
734
+ x?: ChannelValueSpec;
735
+
736
+ /**
737
+ * The starting horizontal position channel specifying the tip’s anchor,
738
+ * typically bound to the *x* scale.
739
+ */
740
+ x1?: ChannelValueSpec;
741
+
742
+ /**
743
+ * The ending horizontal position channel specifying the tip’s anchor,
744
+ * typically bound to the *x* scale.
745
+ */
746
+ x2?: ChannelValueSpec;
747
+
748
+ /**
749
+ * The vertical position channel specifying the tip’s anchor, typically
750
+ * bound to the *y* scale.
751
+ */
752
+ y?: ChannelValueSpec;
753
+
754
+ /**
755
+ * The starting vertical position channel specifying the tip’s anchor,
756
+ * typically bound to the *y* scale.
757
+ */
758
+ y1?: ChannelValueSpec;
759
+
760
+ /**
761
+ * The ending vertical position channel specifying the tip’s anchor, typically
762
+ * bound to the *y* scale.
763
+ */
764
+ y2?: ChannelValueSpec;
765
+
766
+ /**
767
+ * The frame anchor specifies defaults for **x** and **y** based on the plot’s
768
+ * frame; it may be one of the four sides (*top*, *right*, *bottom*, *left*),
769
+ * one of the four corners (*top-left*, *top-right*, *bottom-right*,
770
+ * *bottom-left*), or the *middle* of the frame. For example, for tips
771
+ * distributed horizontally at the top of the frame:
772
+ *
773
+ * ```js
774
+ * Plot.tip(data, {x: "date", frameAnchor: "top"})
775
+ * ```
776
+ */
777
+ frameAnchor?: FrameAnchor | ParamRef;
778
+
779
+ /**
780
+ * The tip anchor specifies how to orient the tip box relative to its anchor
781
+ * position; it refers to the part of the tip box that is attached to the
782
+ * anchor point. For example, the *top-left* anchor places the top-left corner
783
+ * of tip box near the anchor position, hence placing the tip box below and to
784
+ * the right of the anchor position.
785
+ */
786
+ anchor?: FrameAnchor | ParamRef;
787
+
788
+ /**
789
+ * If an explicit tip anchor is not specified, an anchor is chosen
790
+ * automatically such that the tip fits within the plot’s frame; if the
791
+ * preferred anchor fits, it is chosen.
792
+ */
793
+ preferredAnchor?: FrameAnchor | null | ParamRef;
794
+
795
+ /**
796
+ * How channel values are formatted for display. If a format is a string, it
797
+ * is interpreted as a (UTC) time format for temporal channels, and otherwise
798
+ * a number format.
799
+ */
800
+ format?: {
801
+ [name in ChannelName]?: boolean | string | ParamRef
802
+ };
803
+
804
+ /** The image filter for the tip’s box; defaults to a drop shadow. */
805
+ pathFilter?: string | ParamRef;
806
+
807
+ /** The size of the tip’s pointer in pixels; defaults to 12. */
808
+ pointerSize?: number | ParamRef;
809
+
810
+ /** The padding around the text in pixels; defaults to 8. */
811
+ textPadding?: number | ParamRef;
812
+ }
813
+
814
+ /** How to interpolate between control points. */
815
+ export type Curve = CurveName;
816
+
817
+ /** Options for marks that support curves, such as lines and areas. */
818
+ export interface CurveOptions extends CurveAutoOptions {
819
+ /**
820
+ * The curve (interpolation) method for connecting adjacent points. One of:
821
+ *
822
+ * - *basis* - a cubic basis spline (repeating the end points)
823
+ * - *basis-open* - an open cubic basis spline
824
+ * - *basis-closed* - a closed cubic basis spline
825
+ * - *bump-x* - a Bézier curve with horizontal tangents
826
+ * - *bump-y* - a Bézier curve with vertical tangents
827
+ * - *bundle* - a straightened cubic basis spline (suitable for lines only, not areas)
828
+ * - *cardinal* - a cubic cardinal spline (with one-sided differences at the ends)
829
+ * - *cardinal-open* - an open cubic cardinal spline
830
+ * - *cardinal-closed* - an closed cubic cardinal spline
831
+ * - *catmull-rom* - a cubic Catmull–Rom spline (with one-sided differences at the ends)
832
+ * - *catmull-rom-open* - an open cubic Catmull–Rom spline
833
+ * - *catmull-rom-closed* - a closed cubic Catmull–Rom spline
834
+ * - *linear* - a piecewise linear curve (*i.e.*, straight line segments)
835
+ * - *linear-closed* - a closed piecewise linear curve (*i.e.*, straight line segments)
836
+ * - *monotone-x* - a cubic spline that preserves monotonicity in *x*
837
+ * - *monotone-y* - a cubic spline that preserves monotonicity in *y*
838
+ * - *natural* - a natural cubic spline
839
+ * - *step* - a piecewise constant function where *y* changes at the midpoint of *x*
840
+ * - *step-after* - a piecewise constant function where *y* changes after *x*
841
+ * - *step-before* - a piecewise constant function where *x* changes after *y*
842
+ */
843
+ curve?: Curve | ParamRef;
844
+ }
845
+
846
+ /** Options for marks that support possibly-projected curves. */
847
+ export interface CurveAutoOptions {
848
+ /**
849
+ * The curve (interpolation) method for connecting adjacent points. One of:
850
+ *
851
+ * - *basis* - a cubic basis spline (repeating the end points)
852
+ * - *basis-open* - an open cubic basis spline
853
+ * - *basis-closed* - a closed cubic basis spline
854
+ * - *bump-x* - a Bézier curve with horizontal tangents
855
+ * - *bump-y* - a Bézier curve with vertical tangents
856
+ * - *bundle* - a straightened cubic basis spline (suitable for lines only, not areas)
857
+ * - *cardinal* - a cubic cardinal spline (with one-sided differences at the ends)
858
+ * - *cardinal-open* - an open cubic cardinal spline
859
+ * - *cardinal-closed* - an closed cubic cardinal spline
860
+ * - *catmull-rom* - a cubic Catmull–Rom spline (with one-sided differences at the ends)
861
+ * - *catmull-rom-open* - an open cubic Catmull–Rom spline
862
+ * - *catmull-rom-closed* - a closed cubic Catmull–Rom spline
863
+ * - *linear* - a piecewise linear curve (*i.e.*, straight line segments)
864
+ * - *linear-closed* - a closed piecewise linear curve (*i.e.*, straight line segments)
865
+ * - *monotone-x* - a cubic spline that preserves monotonicity in *x*
866
+ * - *monotone-y* - a cubic spline that preserves monotonicity in *y*
867
+ * - *natural* - a natural cubic spline
868
+ * - *step* - a piecewise constant function where *y* changes at the midpoint of *x*
869
+ * - *step-after* - a piecewise constant function where *y* changes after *x*
870
+ * - *step-before* - a piecewise constant function where *x* changes after *y*
871
+ * - *auto* (default) - like *linear*, but use the (possibly spherical) projection, if any
872
+ *
873
+ * The *auto* curve is typically used in conjunction with a spherical
874
+ * projection to interpolate along geodesics.
875
+ */
876
+ curve?: Curve | 'auto' | ParamRef;
877
+
878
+ /**
879
+ * The tension option only has an effect on bundle, cardinal and Catmull–Rom
880
+ * splines (*bundle*, *cardinal*, *cardinal-open*, *cardinal-closed*,
881
+ * *catmull-rom*, *catmull-rom-open*, and *catmull-rom-closed*). For bundle
882
+ * splines, it corresponds to [beta][1]; for cardinal splines, [tension][2];
883
+ * for Catmull–Rom splines, [alpha][3].
884
+ *
885
+ * [1]: https://d3js.org/d3-shape/curve#curveBundle_beta
886
+ * [2]: https://d3js.org/d3-shape/curve#curveCardinal_tension
887
+ * [3]: https://d3js.org/d3-shape/curve#curveCatmullRom_alpha
888
+ */
889
+ tension?: number | ParamRef;
890
+ }
891
+
892
+ /**
893
+ * A built-in stack offset method; one of:
894
+ *
895
+ * - *normalize* - rescale each stack to fill [0, 1]
896
+ * - *center* - align the centers of all stacks
897
+ * - *wiggle* - translate stacks to minimize apparent movement
898
+ *
899
+ * If a given stack has zero total value, the *normalize* offset will not adjust
900
+ * the stack’s position. Both the *center* and *wiggle* offsets ensure that the
901
+ * lowest element across stacks starts at zero for better default axes. The
902
+ * *wiggle* offset is recommended for streamgraphs in conjunction with the
903
+ * *inside-out* order. For more, see [Byron & Wattenberg][1].
904
+ *
905
+ * [1]: https://leebyron.com/streamgraph/
906
+ */
907
+ export type StackOffsetName =
908
+ | 'center'
909
+ | 'normalize'
910
+ | 'wiggle';
911
+
912
+ /**
913
+ * A stack offset method; one of:
914
+ *
915
+ * - *normalize* - rescale each stack to fill [0, 1]
916
+ * - *center* - align the centers of all stacks
917
+ * - *wiggle* - translate stacks to minimize apparent movement
918
+ *
919
+ * If a given stack has zero total value, the *normalize* offset will not adjust
920
+ * the stack’s position. Both the *center* and *wiggle* offsets ensure that the
921
+ * lowest element across stacks starts at zero for better default axes. The
922
+ * *wiggle* offset is recommended for streamgraphs in conjunction with the
923
+ * *inside-out* order. For more, see [Byron & Wattenberg][1].
924
+ *
925
+ * [1]: https://leebyron.com/streamgraph/
926
+ */
927
+ export type StackOffset = StackOffsetName;
928
+
929
+ /**
930
+ * The built-in stack order methods; one of:
931
+ *
932
+ * - *x* - alias of *value*; for stackX only
933
+ * - *y* - alias of *value*; for stackY only
934
+ * - *value* - ascending value (or descending with **reverse**)
935
+ * - *sum* - total value per series
936
+ * - *appearance* - position of maximum value per series
937
+ * - *inside-out* (default with *wiggle*) - order the earliest-appearing series on the inside
938
+ *
939
+ * The *inside-out* order is recommended for streamgraphs in conjunction with
940
+ * the *wiggle* offset. For more, see [Byron & Wattenberg][1].
941
+ *
942
+ * [1]: https://leebyron.com/streamgraph/
943
+ */
944
+ export type StackOrderName = 'value' | 'x' | 'y' | 'z' | 'sum' | 'appearance' | 'inside-out';
945
+
946
+ /**
947
+ * How to order layers prior to stacking; one of:
948
+ *
949
+ * - a named stack order method such as *inside-out* or *sum*
950
+ * - a field name, for natural order of the corresponding values
951
+ * - an array of explicit **z** values in the desired order
952
+ */
953
+ export type StackOrder =
954
+ | StackOrderName
955
+ | `-${StackOrderName}`
956
+ | (string & Record<never, never>)
957
+ | any[];
958
+
959
+ /** Options for the stack transform. */
960
+ export interface StackOptions {
961
+ /**
962
+ * After stacking, an optional **offset** can be applied to translate and
963
+ * scale stacks, say to produce a streamgraph; defaults to null for a zero
964
+ * baseline (**y** = 0 for stackY, and **x** = 0 for stackX). If the *wiggle*
965
+ * offset is used, the default **order** changes to *inside-out*.
966
+ */
967
+ offset?: StackOffset | null | ParamRef;
968
+
969
+ /**
970
+ * The order in which stacks are layered; one of:
971
+ *
972
+ * - null (default) for input order
973
+ * - a named stack order method such as *inside-out* or *sum*
974
+ * - a field name, for natural order of the corresponding values
975
+ * - a function of data, for natural order of the corresponding values
976
+ * - an array of explicit **z** values in the desired order
977
+ *
978
+ * If the *wiggle* **offset** is used, as for a streamgraph, the default
979
+ * changes to *inside-out*.
980
+ */
981
+ order?: StackOrder | null | ParamRef;
982
+
983
+ /** If true, reverse the effective order of the stacks. */
984
+ reverse?: boolean | ParamRef;
985
+
986
+ /**
987
+ * The **z** channel defines the series of each value in the stack. Used when
988
+ * the **order** is *sum*, *appearance*, *inside-out*, or an explicit array of
989
+ * **z** values.
990
+ */
991
+ z?: ChannelValue;
992
+ }
993
+
994
+ /**
995
+ * The built-in marker implementations; one of:
996
+ *
997
+ * - *arrow* - an arrowhead with *auto* orientation
998
+ * - *arrow-reverse* - an arrowhead with *auto-start-reverse* orientation
999
+ * - *dot* - a filled *circle* with no stroke and 2.5px radius
1000
+ * - *circle-fill* - a filled circle with a white stroke and 3px radius
1001
+ * - *circle-stroke* - a stroked circle with a white fill and 3px radius
1002
+ * - *circle* - alias for *circle-fill*
1003
+ * - *tick* - a small opposing line
1004
+ * - *tick-x* - a small horizontal line
1005
+ * - *tick-y* - a small vertical line
1006
+ */
1007
+ export type MarkerName =
1008
+ | 'arrow'
1009
+ | 'arrow-reverse'
1010
+ | 'dot'
1011
+ | 'circle'
1012
+ | 'circle-fill'
1013
+ | 'circle-stroke'
1014
+ | 'tick'
1015
+ | 'tick-x'
1016
+ | 'tick-y';
1017
+
1018
+ /** Options for marks that support markers, such as lines and links. */
1019
+ export interface MarkerOptions {
1020
+ /**
1021
+ * Shorthand to set the same default for markerStart, markerMid, and
1022
+ * markerEnd; one of:
1023
+ *
1024
+ * - a marker name such as *arrow* or *circle*
1025
+ * - *none* (default) - no marker
1026
+ * * true - alias for *circle-fill*
1027
+ * * false or null - alias for *none*
1028
+ */
1029
+ marker?: MarkerName | 'none' | boolean | null | ParamRef;
1030
+
1031
+ /**
1032
+ * The marker for the starting point of a line segment; one of:
1033
+ *
1034
+ * - a marker name such as *arrow* or *circle*
1035
+ * * *none* (default) - no marker
1036
+ * * true - alias for *circle-fill*
1037
+ * * false or null - alias for *none*
1038
+ */
1039
+ markerStart?: MarkerName | 'none' | boolean | null | ParamRef;
1040
+
1041
+ /**
1042
+ * The marker for any middle (interior) points of a line segment. If the line
1043
+ * segment only has a start and end point, this option has no effect. One of:
1044
+ *
1045
+ * - a marker name such as *arrow* or *circle*
1046
+ * * *none* (default) - no marker
1047
+ * * true - alias for *circle-fill*
1048
+ * * false or null - alias for *none*
1049
+ * * a function - a custom marker function; see below
1050
+ */
1051
+ markerMid?: MarkerName | 'none' | boolean | null | ParamRef;
1052
+
1053
+ /**
1054
+ * The marker for the ending point of a line segment; one of:
1055
+ *
1056
+ * - a marker name such as *arrow* or *circle*
1057
+ * * *none* (default) - no marker
1058
+ * * true - alias for *circle-fill*
1059
+ * * false or null - alias for *none*
1060
+ */
1061
+ markerEnd?: MarkerName | 'none' | boolean | null | ParamRef;
1062
+ }