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