ggaction 0.0.3 → 0.0.5

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 (223) hide show
  1. package/CHANGELOG.md +58 -3
  2. package/README.md +117 -83
  3. package/package.json +27 -11
  4. package/src/actions/boxPlots/create.js +13 -7
  5. package/src/actions/boxPlots/edit.js +31 -35
  6. package/src/actions/boxPlots/materialize.js +3 -0
  7. package/src/actions/boxPlots/options.js +8 -1
  8. package/src/actions/boxPlots/resolve.js +10 -2
  9. package/src/actions/charts/bar.js +50 -0
  10. package/src/actions/charts/heatmap.js +205 -0
  11. package/src/actions/charts/histogram.js +58 -0
  12. package/src/actions/charts/index.js +15 -0
  13. package/src/actions/charts/line.js +69 -0
  14. package/src/actions/charts/parallel.js +76 -0
  15. package/src/actions/charts/scatter.js +56 -0
  16. package/src/actions/charts/shared.js +121 -0
  17. package/src/actions/coordinates/parallel.js +50 -0
  18. package/src/actions/data/bin2d.js +137 -0
  19. package/src/actions/data/density.js +54 -13
  20. package/src/actions/data/derived.js +22 -0
  21. package/src/actions/data/filter.js +5 -0
  22. package/src/actions/data/gradientProfile.js +65 -0
  23. package/src/actions/data/horizon.js +71 -0
  24. package/src/actions/data/index.js +29 -2
  25. package/src/actions/data/regression.js +1 -1
  26. package/src/actions/data/window.js +50 -0
  27. package/src/actions/encodings/appearance.js +1 -1
  28. package/src/actions/encodings/color/continuous.js +137 -0
  29. package/src/actions/encodings/color/index.js +167 -0
  30. package/src/actions/encodings/color/layout.js +99 -0
  31. package/src/actions/encodings/color/policy.js +88 -0
  32. package/src/actions/encodings/density/resolve.js +109 -0
  33. package/src/actions/encodings/density.js +193 -88
  34. package/src/actions/encodings/horizon/resolve.js +283 -0
  35. package/src/actions/encodings/horizon.js +364 -0
  36. package/src/actions/encodings/index.js +8 -2
  37. package/src/actions/encodings/offset.js +1 -1
  38. package/src/actions/encodings/parallel.js +115 -0
  39. package/src/actions/encodings/pathOrder.js +131 -0
  40. package/src/actions/encodings/position/apply.js +73 -4
  41. package/src/actions/encodings/{position.js → position/index.js} +21 -8
  42. package/src/actions/encodings/position/policies/arc.js +27 -4
  43. package/src/actions/encodings/position/policies/area.js +33 -2
  44. package/src/actions/encodings/position/policies/index.js +7 -2
  45. package/src/actions/encodings/position/policies/line.js +18 -2
  46. package/src/actions/encodings/position/resolve.js +25 -3
  47. package/src/actions/encodings/ranged.js +5 -3
  48. package/src/actions/encodings/ruleAppearance.js +88 -10
  49. package/src/actions/encodings/strokeDash.js +1 -1
  50. package/src/actions/encodings/text.js +1 -1
  51. package/src/actions/errorBands/options.js +1 -1
  52. package/src/actions/errorBars/options.js +1 -1
  53. package/src/actions/facets/actions.js +2 -3
  54. package/src/actions/facets/derive.js +35 -5
  55. package/src/actions/facets/guides.js +1 -1
  56. package/src/actions/facets/replay.js +7 -36
  57. package/src/actions/gradientPlots/components.js +177 -0
  58. package/src/actions/gradientPlots/create.js +96 -0
  59. package/src/actions/gradientPlots/edit.js +153 -0
  60. package/src/actions/gradientPlots/index.js +24 -0
  61. package/src/actions/gradientPlots/materialize.js +287 -0
  62. package/src/actions/gradientPlots/options.js +120 -0
  63. package/src/actions/gradientPlots/paint.js +107 -0
  64. package/src/actions/gradientPlots/rebind.js +51 -0
  65. package/src/actions/gradientPlots/resolve.js +81 -0
  66. package/src/actions/guides/applicability.js +44 -17
  67. package/src/actions/guides/axes/axes.js +37 -3
  68. package/src/actions/guides/axes/index.js +2 -0
  69. package/src/actions/guides/axes/labels.js +12 -7
  70. package/src/actions/guides/axes/parallel/resolve.js +86 -0
  71. package/src/actions/guides/axes/parallel.js +228 -0
  72. package/src/actions/guides/axes/ticks.js +1 -1
  73. package/src/actions/guides/axes/titles.js +12 -9
  74. package/src/actions/guides/grids/resolve.js +1 -1
  75. package/src/actions/guides/guides.js +60 -5
  76. package/src/actions/guides/legends/categorical/actions.js +48 -11
  77. package/src/actions/guides/legends/categorical/layout.js +4 -2
  78. package/src/actions/guides/legends/continuous/interval.js +1 -1
  79. package/src/actions/guides/legends/continuous/opacity.js +1 -1
  80. package/src/actions/guides/legends/edit.js +7 -20
  81. package/src/actions/guides/legends/index.js +2 -0
  82. package/src/actions/guides/legends/remove.js +6 -31
  83. package/src/actions/guides/legends/size.js +1 -1
  84. package/src/actions/guides/legends/strokeWidth.js +170 -0
  85. package/src/actions/guides/legends/target.js +25 -0
  86. package/src/actions/guides/polar/{axes.js → axes/index.js} +5 -5
  87. package/src/actions/guides/polar/index.js +1 -1
  88. package/src/actions/guides/polar/resolve.js +1 -1
  89. package/src/actions/guides/tickValues.js +1 -1
  90. package/src/actions/index.js +6 -0
  91. package/src/actions/intervals/resolve.js +1 -1
  92. package/src/actions/marks/arc/actions.js +2 -2
  93. package/src/actions/marks/area/actions.js +61 -137
  94. package/src/actions/marks/area/materialize.js +163 -0
  95. package/src/actions/marks/bar/edit.js +1 -1
  96. package/src/actions/marks/index.js +5 -1
  97. package/src/actions/marks/line/actions.js +100 -81
  98. package/src/actions/marks/line/materialize.js +146 -0
  99. package/src/actions/marks/point/create.js +76 -0
  100. package/src/actions/marks/point/edit.js +85 -0
  101. package/src/actions/marks/point/index.js +11 -1
  102. package/src/actions/marks/point/jitter.js +72 -0
  103. package/src/actions/marks/point/{actions.js → materialize.js} +175 -170
  104. package/src/actions/marks/rect/actions.js +4 -1
  105. package/src/actions/marks/remove.js +13 -2
  106. package/src/actions/marks/rule/actions.js +26 -4
  107. package/src/actions/marks/shared.js +1 -1
  108. package/src/actions/marks/text/actions.js +20 -5
  109. package/src/actions/marks/text/index.js +7 -1
  110. package/src/actions/marks/text/layout.js +321 -0
  111. package/src/actions/primitives/semanticValidation/dataset.js +22 -0
  112. package/src/actions/primitives/semanticValidation/guide.js +43 -0
  113. package/src/actions/primitives/semanticValidation/index.js +23 -0
  114. package/src/actions/primitives/semanticValidation/layer.js +74 -0
  115. package/src/actions/primitives/semanticValidation/scale.js +74 -0
  116. package/src/actions/primitives/semanticValidation/shared.js +5 -0
  117. package/src/actions/primitives/semanticValue.js +1 -204
  118. package/src/actions/regression/components.js +1 -1
  119. package/src/actions/regression/create.js +1 -1
  120. package/src/actions/regression/edit.js +20 -22
  121. package/src/actions/scales/consumers/common.js +109 -0
  122. package/src/actions/scales/consumers/families.js +58 -0
  123. package/src/actions/scales/consumers/index.js +41 -0
  124. package/src/actions/scales/{consumers.js → consumers/seriesLayout.js} +10 -132
  125. package/src/actions/scales/create.js +1 -1
  126. package/src/actions/scales/definitions.js +32 -2
  127. package/src/actions/scales/edit.js +8 -206
  128. package/src/actions/scales/editPolicy.js +214 -0
  129. package/src/actions/scales/materialize.js +3 -3
  130. package/src/actions/scales/patch.js +26 -0
  131. package/src/actions/selection/actions.js +28 -3
  132. package/src/actions/violinPlots/create.js +198 -0
  133. package/src/actions/violinPlots/index.js +5 -0
  134. package/src/core/ChartProgram.js +22 -236
  135. package/src/core/compositionState.js +169 -0
  136. package/src/core/materializationState.js +65 -0
  137. package/src/core/programState.js +28 -0
  138. package/src/core/textMetrics.js +47 -0
  139. package/src/core/vocabulary.js +7 -2
  140. package/src/grammar/arcs.js +50 -13
  141. package/src/grammar/areaSeries.js +42 -6
  142. package/src/grammar/bars/aggregate.js +1 -1
  143. package/src/grammar/bin2d.js +333 -0
  144. package/src/grammar/categoricalDensity.js +192 -0
  145. package/src/grammar/coordinates.js +1 -1
  146. package/src/grammar/curveCommands.js +3 -1
  147. package/src/grammar/density.js +253 -27
  148. package/src/grammar/facets/dependencies.js +3 -11
  149. package/src/grammar/{facets.js → facets/index.js} +8 -6
  150. package/src/grammar/gradientProfile.js +213 -0
  151. package/src/grammar/horizon.js +455 -0
  152. package/src/grammar/interval.js +2 -96
  153. package/src/grammar/jitter.js +197 -0
  154. package/src/grammar/lineSeries.js +70 -1
  155. package/src/grammar/paint.js +88 -0
  156. package/src/grammar/palettes.js +5 -7
  157. package/src/grammar/parallelCoordinates.js +213 -0
  158. package/src/grammar/pathOrder.js +35 -0
  159. package/src/grammar/pointShapes.js +24 -0
  160. package/src/grammar/polarLineCommands.js +1 -1
  161. package/src/grammar/regression/derive.js +97 -0
  162. package/src/grammar/regression/index.js +22 -0
  163. package/src/grammar/regression/models.js +282 -0
  164. package/src/grammar/regression/parameters.js +106 -0
  165. package/src/grammar/rules.js +2 -1
  166. package/src/grammar/scales/appearance.js +21 -0
  167. package/src/grammar/scales/color.js +4 -2
  168. package/src/grammar/schemas/concreteGraphic.js +11 -1
  169. package/src/grammar/schemas/graphicBounds.js +19 -37
  170. package/src/grammar/schemas/semanticPath.js +17 -2
  171. package/src/grammar/statistics/studentT.js +98 -0
  172. package/src/grammar/transforms.js +101 -12
  173. package/src/grammar/window.js +339 -0
  174. package/src/layout/labels.js +270 -0
  175. package/src/layout/text.js +4 -1
  176. package/src/layout/title.js +10 -20
  177. package/src/materialization/bars/aggregate.js +1 -1
  178. package/src/materialization/bars/grouped.js +1 -1
  179. package/src/materialization/bars/histogram.js +1 -1
  180. package/src/materialization/bars/ranged.js +1 -1
  181. package/src/materialization/dataProvenance.js +56 -2
  182. package/src/materialization/density.js +1 -1
  183. package/src/materialization/dependencies.js +15 -101
  184. package/src/materialization/encodings.js +2 -2
  185. package/src/materialization/facetGuides/index.js +2 -0
  186. package/src/materialization/facetGuides/legacyCategorical.js +125 -0
  187. package/src/materialization/facetGuides/placement.js +126 -0
  188. package/src/materialization/facetGuides/preparation.js +188 -0
  189. package/src/materialization/facets.js +1 -1
  190. package/src/materialization/guides/resources.js +74 -24
  191. package/src/materialization/horizon.js +29 -0
  192. package/src/materialization/layout.js +15 -0
  193. package/src/materialization/marks/capabilities.js +161 -0
  194. package/src/materialization/marks/index.js +108 -0
  195. package/src/materialization/marks/pathOrder.js +71 -0
  196. package/src/materialization/marks/policies.js +91 -0
  197. package/src/materialization/rect.js +1 -1
  198. package/src/materialization/rowEncoding.js +1 -1
  199. package/src/materialization/scaleGuideDependencies.js +102 -0
  200. package/src/materialization/scales/map.js +1 -1
  201. package/src/materialization/scales/policies/series.js +1 -1
  202. package/src/materialization/scales/resolve.js +3 -1
  203. package/src/materialization/selection/items/bar.js +1 -1
  204. package/src/materialization/selection/items/path.js +27 -1
  205. package/src/materialization/selection/items/point.js +1 -5
  206. package/src/materialization/selection/items/rect.js +21 -0
  207. package/src/materialization/selection/styles.js +21 -10
  208. package/src/materialization/text.js +12 -4
  209. package/src/renderers/canvas/fill.js +33 -0
  210. package/src/renderers/canvas/index.js +7 -0
  211. package/src/renderers/canvas/path.js +7 -4
  212. package/src/renderers/canvas/rect.js +9 -3
  213. package/src/renderers/canvas/text.js +14 -1
  214. package/src/selectors/datasets.js +4 -0
  215. package/src/theme/defaults.js +4 -0
  216. package/types/extension.d.ts +10 -1
  217. package/types/index.d.ts +76 -0
  218. package/types/program.d.ts +632 -10
  219. package/src/actions/encodings/color.js +0 -424
  220. package/src/grammar/regression.js +0 -578
  221. package/src/grammar/scales.js +0 -1
  222. package/src/materialization/facetGuides.js +0 -426
  223. package/src/materialization/marks.js +0 -316
@@ -20,6 +20,25 @@ export type ConcretePathCommand =
20
20
  readonly y: number;
21
21
  }
22
22
  | { readonly op: "Z" };
23
+ export interface LinearGradientPoint {
24
+ readonly x: number;
25
+ readonly y: number;
26
+ }
27
+ export interface LinearGradientStop {
28
+ readonly offset: number;
29
+ readonly color: string;
30
+ }
31
+ export interface LinearGradientPaint {
32
+ readonly type: "linear-gradient";
33
+ readonly from: LinearGradientPoint;
34
+ readonly to: LinearGradientPoint;
35
+ readonly stops: readonly [
36
+ LinearGradientStop,
37
+ LinearGradientStop,
38
+ ...LinearGradientStop[]
39
+ ];
40
+ }
41
+ export type FillPaint = string | LinearGradientPaint;
23
42
  export type CurveInterpolation =
24
43
  | "linear"
25
44
  | "step"
@@ -31,6 +50,19 @@ export type CurveInterpolation =
31
50
  | "natural";
32
51
  export type DashStyle = "solid" | "dashed" | "dotted" | "dashdot";
33
52
  export type DashPattern = readonly number[];
53
+ export type JitterMaxOffset =
54
+ | { pixels: number; band?: never }
55
+ | { pixels?: never; band: number };
56
+ export interface JitterPointsOptions {
57
+ target?: string;
58
+ channel: "x" | "y";
59
+ maxOffset: JitterMaxOffset;
60
+ seed?: string | number;
61
+ key?: string;
62
+ }
63
+ export interface RemoveJitterOptions {
64
+ target?: string;
65
+ }
34
66
  export type ScaleType =
35
67
  | "linear"
36
68
  | "log"
@@ -140,6 +172,34 @@ export type DensityKernel =
140
172
  | "uniform"
141
173
  | "triangular";
142
174
  export type DensityNormalization = "unit" | "count";
175
+ export type DensityPlacementSide =
176
+ | "both"
177
+ | "left"
178
+ | "right"
179
+ | "top"
180
+ | "bottom";
181
+ export type DensityWidthResolution = "shared" | "independent";
182
+ export interface DensityPlacementWidth {
183
+ band?: number;
184
+ resolve?: DensityWidthResolution;
185
+ }
186
+ export interface DensityPlacementSplit {
187
+ field: string;
188
+ domain?: readonly [unknown, unknown];
189
+ }
190
+ export interface BaselineDensityPlacement {
191
+ type: "baseline";
192
+ }
193
+ export interface CategoryDensityPlacement {
194
+ type: "category";
195
+ side?: DensityPlacementSide;
196
+ width?: DensityPlacementWidth;
197
+ split?: DensityPlacementSplit;
198
+ scale?: ScaleOptions;
199
+ }
200
+ export type DensityPlacement =
201
+ | BaselineDensityPlacement
202
+ | CategoryDensityPlacement;
143
203
  export type FilterComparison =
144
204
  | { op: "eq" | "neq"; value: unknown }
145
205
  | { op: "lt" | "lte" | "gt" | "gte"; value: number | string };
@@ -205,9 +265,67 @@ export interface DatasetDensityTransform {
205
265
  normalization?: DensityNormalization;
206
266
  as: readonly [string, string];
207
267
  resolve: "shared";
268
+ placement?: {
269
+ readonly type: "category";
270
+ readonly channel: "x" | "y";
271
+ readonly categoryField: string;
272
+ readonly side: DensityPlacementSide;
273
+ readonly width: {
274
+ readonly band: number;
275
+ readonly resolve: DensityWidthResolution;
276
+ };
277
+ readonly split?: {
278
+ readonly field: string;
279
+ readonly domain?: readonly [unknown, unknown];
280
+ };
281
+ };
208
282
  resolved?: {
209
283
  readonly bandwidth: number;
210
284
  readonly extent: readonly [number, number];
285
+ readonly splitDomain?: readonly [unknown, unknown];
286
+ };
287
+ }
288
+ export type HorizonResolution = "shared" | "independent";
289
+ export type HorizonMissingPolicy = "break" | "error";
290
+ export type HorizonOverflowPolicy = "clip" | "error";
291
+ export interface HorizonOutputFields {
292
+ readonly x: string;
293
+ readonly lower: string;
294
+ readonly upper: string;
295
+ readonly group: string;
296
+ readonly color: string;
297
+ readonly sign: string;
298
+ readonly band: string;
299
+ readonly segment: string;
300
+ }
301
+ export interface DatasetHorizonTransform {
302
+ readonly type: "horizon";
303
+ readonly x: {
304
+ readonly field: string;
305
+ readonly fieldType: "quantitative" | "temporal";
306
+ };
307
+ readonly y: {
308
+ readonly field: string;
309
+ readonly fieldType: "quantitative";
310
+ };
311
+ readonly groupBy?: string;
312
+ readonly bands: number;
313
+ readonly baseline: number;
314
+ readonly extent: "auto" | number;
315
+ readonly resolve: HorizonResolution;
316
+ readonly missing: HorizonMissingPolicy;
317
+ readonly overflow: HorizonOverflowPolicy;
318
+ readonly palette: {
319
+ readonly positive: Readonly<Exclude<Palette, string>>;
320
+ readonly negative: Readonly<Exclude<Palette, string>>;
321
+ };
322
+ readonly as: HorizonOutputFields;
323
+ readonly resolved?: {
324
+ readonly extents: readonly {
325
+ readonly group?: DatasetScalar;
326
+ readonly extent: number;
327
+ readonly bandHeight: number;
328
+ }[];
211
329
  };
212
330
  }
213
331
  export interface DatasetIntervalOutputFields {
@@ -237,15 +355,106 @@ export type DatasetIntervalTransform = {
237
355
  level?: never;
238
356
  }
239
357
  );
358
+ export type WindowSortOrder = "ascending" | "descending";
359
+ export interface WindowSort {
360
+ field: string;
361
+ order?: WindowSortOrder;
362
+ }
363
+ export type WindowOperation =
364
+ | { op: "rowNumber" | "rank" | "denseRank"; as: string }
365
+ | { op: "cumulativeSum"; field: string; as: string }
366
+ | {
367
+ op: "lag" | "lead";
368
+ field: string;
369
+ as: string;
370
+ offset?: number;
371
+ default?: unknown;
372
+ };
373
+ export interface DatasetWindowSort {
374
+ readonly field: string;
375
+ readonly order: WindowSortOrder;
376
+ }
377
+ export type DatasetWindowOperation =
378
+ | { readonly op: "rowNumber" | "rank" | "denseRank"; readonly as: string }
379
+ | {
380
+ readonly op: "cumulativeSum";
381
+ readonly field: string;
382
+ readonly as: string;
383
+ }
384
+ | {
385
+ readonly op: "lag" | "lead";
386
+ readonly field: string;
387
+ readonly as: string;
388
+ readonly offset: number;
389
+ readonly default: unknown;
390
+ };
391
+ export interface DatasetWindowTransform {
392
+ readonly type: "window";
393
+ readonly partitionBy: readonly string[];
394
+ readonly sortBy: readonly DatasetWindowSort[];
395
+ readonly operations: readonly DatasetWindowOperation[];
396
+ }
397
+ export interface Bin2DCounts {
398
+ x: number;
399
+ y: number;
400
+ }
401
+ export interface Bin2DExtent {
402
+ x?: readonly [number, number];
403
+ y?: readonly [number, number];
404
+ }
405
+ export interface Bin2DOutputFields {
406
+ x0?: string;
407
+ x1?: string;
408
+ y0?: string;
409
+ y1?: string;
410
+ count?: string;
411
+ members?: string;
412
+ }
413
+ export interface DatasetBin2DOutputFields {
414
+ readonly x0: string;
415
+ readonly x1: string;
416
+ readonly y0: string;
417
+ readonly y1: string;
418
+ readonly count: string;
419
+ readonly members?: string;
420
+ }
421
+ export interface DatasetBin2DTransform {
422
+ readonly type: "bin2d";
423
+ readonly x: string;
424
+ readonly y: string;
425
+ readonly bins: Readonly<Bin2DCounts>;
426
+ readonly extent: {
427
+ readonly x: "auto" | readonly [number, number];
428
+ readonly y: "auto" | readonly [number, number];
429
+ };
430
+ readonly includeEmpty: boolean;
431
+ readonly members: boolean;
432
+ readonly as: DatasetBin2DOutputFields;
433
+ readonly resolved?: {
434
+ readonly extent: {
435
+ readonly x: readonly [number, number];
436
+ readonly y: readonly [number, number];
437
+ };
438
+ readonly edges: {
439
+ readonly x: readonly number[];
440
+ readonly y: readonly number[];
441
+ };
442
+ readonly eligibleCount: number;
443
+ readonly occupiedCount: number;
444
+ };
445
+ }
240
446
  export type DatasetTransform =
447
+ | DatasetBin2DTransform
241
448
  | DatasetFilterTransform
242
449
  | DatasetRegressionTransform
243
450
  | DatasetDensityTransform
244
- | DatasetIntervalTransform;
451
+ | DatasetHorizonTransform
452
+ | DatasetIntervalTransform
453
+ | DatasetWindowTransform;
245
454
  export interface CreateDerivedDataOptions {
246
455
  id: string;
247
456
  source: string;
248
- transform: readonly [DatasetTransform, ...DatasetTransform[]];
457
+ transform: readonly [DatasetTransform];
249
458
  }
250
459
  export type MarkGraphicProperty =
251
460
  | "x" | "y" | "width" | "height" | "radius"
@@ -509,7 +718,7 @@ export interface CompleteAxisOptions<P extends string> {
509
718
  export interface CreateAxesOptions {
510
719
  coordinate?: {
511
720
  id?: string;
512
- type?: "auto" | "cartesian" | "polar";
721
+ type?: "auto" | "cartesian" | "polar" | "parallel";
513
722
  };
514
723
  x?: false | CompleteAxisOptions<XAxisPosition>;
515
724
  y?: false | CompleteAxisOptions<YAxisPosition>;
@@ -636,7 +845,7 @@ export interface CreateGuidesOptions {
636
845
 
637
846
  export interface CreateCoordinateOptions {
638
847
  id?: string;
639
- type?: "cartesian" | "polar";
848
+ type?: "cartesian" | "polar" | "parallel";
640
849
  layers?: readonly string[];
641
850
  }
642
851
 
@@ -739,7 +948,8 @@ export interface ThetaEncodingOptions {
739
948
  fieldType?: FieldType;
740
949
  scale?: ThetaScaleOptions;
741
950
  coordinate?: string;
742
- aggregate?: "count";
951
+ aggregate?: "count" | "sum";
952
+ weight?: string;
743
953
  }
744
954
 
745
955
  export interface RadialEncodingOptions {
@@ -811,13 +1021,59 @@ export interface DensityDataOptions {
811
1021
  as?: readonly [string, string];
812
1022
  }
813
1023
 
814
- export interface DensityEncodingOptions
815
- extends Omit<DensityDataOptions, "id"> {
1024
+ type DensityEncodingBase = Omit<DensityDataOptions, "id"> & {
816
1025
  target?: string;
817
1026
  densityChannel?: "x" | "y";
818
1027
  coordinate?: string;
819
1028
  valueScale?: ScaleOptions;
820
- densityScale?: ScaleOptions;
1029
+ };
1030
+
1031
+ export type DensityEncodingOptions = DensityEncodingBase & (
1032
+ | {
1033
+ placement?: BaselineDensityPlacement;
1034
+ densityScale?: ScaleOptions;
1035
+ }
1036
+ | {
1037
+ placement: CategoryDensityPlacement;
1038
+ densityScale?: never;
1039
+ }
1040
+ );
1041
+
1042
+ export interface HorizonXEncoding {
1043
+ field: string;
1044
+ fieldType?: "quantitative" | "temporal";
1045
+ scale?: ScaleOptions;
1046
+ }
1047
+
1048
+ export interface HorizonYEncoding {
1049
+ field: string;
1050
+ fieldType?: "quantitative";
1051
+ scale?: ScaleOptions;
1052
+ }
1053
+
1054
+ export interface HorizonPaletteOptions {
1055
+ positive?: Palette;
1056
+ negative?: Palette;
1057
+ }
1058
+
1059
+ export interface HorizonEncodingOptions {
1060
+ target?: string;
1061
+ source?: string;
1062
+ x?: string | HorizonXEncoding;
1063
+ y?: string | HorizonYEncoding;
1064
+ groupBy?: string;
1065
+ bands?: number;
1066
+ baseline?: number;
1067
+ extent?: "auto" | number;
1068
+ resolve?: HorizonResolution;
1069
+ missing?: HorizonMissingPolicy;
1070
+ overflow?: HorizonOverflowPolicy;
1071
+ palette?: HorizonPaletteOptions;
1072
+ }
1073
+
1074
+ export interface EditHorizonOptions
1075
+ extends Omit<HorizonEncodingOptions, "groupBy"> {
1076
+ groupBy?: string | false;
821
1077
  }
822
1078
 
823
1079
  export type IntervalCenter = "mean" | "median";
@@ -840,6 +1096,26 @@ export interface IntervalDataOptions {
840
1096
  as?: IntervalOutputFields;
841
1097
  }
842
1098
 
1099
+ export interface WindowDataOptions {
1100
+ id: string;
1101
+ source?: string;
1102
+ partitionBy?: string | readonly string[];
1103
+ sortBy?: readonly WindowSort[];
1104
+ operations: readonly WindowOperation[];
1105
+ }
1106
+
1107
+ export interface Bin2DDataOptions {
1108
+ id: string;
1109
+ source?: string;
1110
+ x: string;
1111
+ y: string;
1112
+ bins?: number | Bin2DCounts;
1113
+ extent?: Bin2DExtent;
1114
+ includeEmpty?: boolean;
1115
+ members?: boolean;
1116
+ as?: Bin2DOutputFields;
1117
+ }
1118
+
843
1119
  export interface ErrorBarPositionChannel {
844
1120
  field?: string;
845
1121
  fieldType?: "nominal" | "ordinal" | "temporal";
@@ -936,6 +1212,7 @@ export interface BoxPlotOptions {
936
1212
  radius?: number;
937
1213
  opacity?: number;
938
1214
  };
1215
+ guides?: false | CreateGuidesOptions;
939
1216
  }
940
1217
 
941
1218
  export interface EditBoxPlotOptions {
@@ -960,6 +1237,266 @@ export interface EditBoxPlotOptions {
960
1237
  };
961
1238
  }
962
1239
 
1240
+ export type GradientPlotPositionChannel = BoxPlotPositionChannel;
1241
+
1242
+ export interface GradientPlotDensityOptions {
1243
+ bandwidth?: "auto" | number;
1244
+ extent?: "auto" | readonly [number, number];
1245
+ steps?: number;
1246
+ kernel?: DensityKernel;
1247
+ normalization?: DensityNormalization;
1248
+ }
1249
+
1250
+ export interface GradientPlotAppearanceOptions {
1251
+ palette?: Palette;
1252
+ opacity?: readonly [number, number];
1253
+ }
1254
+
1255
+ export interface GradientPlotCenterOptions {
1256
+ type?: "mean" | "median";
1257
+ stroke?: string;
1258
+ strokeWidth?: number;
1259
+ }
1260
+
1261
+ export interface GradientPlotOptions {
1262
+ id?: string;
1263
+ target?: string;
1264
+ data?: string;
1265
+ x?: GradientPlotPositionChannel;
1266
+ y?: GradientPlotPositionChannel;
1267
+ coordinate?: string;
1268
+ density?: GradientPlotDensityOptions;
1269
+ width?: { band?: number };
1270
+ gradient?: GradientPlotAppearanceOptions;
1271
+ center?: false | GradientPlotCenterOptions;
1272
+ guides?: false | CreateGuidesOptions;
1273
+ }
1274
+
1275
+ export type ViolinPlotPositionChannel =
1276
+ | string
1277
+ | BoxPlotPositionChannel;
1278
+
1279
+ export interface ViolinPlotDensityOptions
1280
+ extends GradientPlotDensityOptions {
1281
+ width?: DensityPlacementWidth;
1282
+ }
1283
+
1284
+ export interface ViolinPlotSplitOptions {
1285
+ field: string;
1286
+ domain?: readonly [unknown, unknown];
1287
+ }
1288
+
1289
+ export type ViolinPlotColorOptions =
1290
+ | string
1291
+ | Omit<CategoricalEncodingOptions, "target">;
1292
+
1293
+ export interface ViolinPlotAreaOptions {
1294
+ fill?: string;
1295
+ opacity?: number;
1296
+ stroke?: string;
1297
+ strokeWidth?: number;
1298
+ curve?: CurveInterpolation;
1299
+ }
1300
+
1301
+ export interface ViolinPlotOptions {
1302
+ id?: string;
1303
+ data?: string;
1304
+ coordinate?: string;
1305
+ x: ViolinPlotPositionChannel;
1306
+ y: ViolinPlotPositionChannel;
1307
+ split?: ViolinPlotSplitOptions;
1308
+ color?: ViolinPlotColorOptions;
1309
+ density?: ViolinPlotDensityOptions;
1310
+ area?: ViolinPlotAreaOptions;
1311
+ guides?: false | CreateGuidesOptions;
1312
+ }
1313
+
1314
+ export interface EditGradientPlotOptions {
1315
+ target?: string;
1316
+ density?: GradientPlotDensityOptions;
1317
+ width?: { band?: number };
1318
+ gradient?: GradientPlotAppearanceOptions;
1319
+ center?: false | GradientPlotCenterOptions;
1320
+ }
1321
+
1322
+ type BasicPositionChannel =
1323
+ | string
1324
+ | Omit<PositionEncodingOptions, "target" | "coordinate">;
1325
+ type BasicColorChannel =
1326
+ | string
1327
+ | (ColorEncodingOptions extends infer T
1328
+ ? T extends unknown ? Omit<T, "target"> : never
1329
+ : never);
1330
+ export type BasicSizeChannel = string | {
1331
+ field: string;
1332
+ fieldType?: "quantitative";
1333
+ scale?: ScaleOptions;
1334
+ };
1335
+ export type BasicShapeChannel = string | {
1336
+ field: string;
1337
+ fieldType?: "nominal";
1338
+ scale?: ScaleOptions;
1339
+ };
1340
+ export type BasicStrokeDashChannel =
1341
+ StrokeDashEncodingOptions extends infer T
1342
+ ? T extends unknown ? Omit<T, "target"> : never
1343
+ : never;
1344
+
1345
+ export type ParallelMissingPolicy = "break" | "drop-row" | "error";
1346
+ export type ParallelDimension = string | {
1347
+ field: string;
1348
+ fieldType?: "quantitative" | "ordinal";
1349
+ title?: string;
1350
+ scale?: Omit<ScaleOptions, "id">;
1351
+ };
1352
+ export interface ParallelCoordinatesEncodingOptions {
1353
+ target?: string;
1354
+ coordinate?: string;
1355
+ dimensions: readonly [ParallelDimension, ParallelDimension, ...ParallelDimension[]];
1356
+ key?: string;
1357
+ missing?: ParallelMissingPolicy;
1358
+ }
1359
+ export interface CreateParallelCoordinatesOptions {
1360
+ id?: string;
1361
+ data?: string;
1362
+ coordinate?: string;
1363
+ dimensions: readonly [ParallelDimension, ParallelDimension, ...ParallelDimension[]];
1364
+ key?: string;
1365
+ missing?: ParallelMissingPolicy;
1366
+ color?: BasicColorChannel;
1367
+ strokeDash?: BasicStrokeDashChannel;
1368
+ line?: {
1369
+ strokeWidth?: number;
1370
+ stroke?: string;
1371
+ opacity?: number;
1372
+ curve?: "linear";
1373
+ closed?: false;
1374
+ };
1375
+ guides?: false | CreateGuidesOptions;
1376
+ }
1377
+
1378
+ export interface CreateScatterPlotOptions {
1379
+ id?: string;
1380
+ data?: string;
1381
+ coordinate?: string;
1382
+ x: BasicPositionChannel;
1383
+ y: BasicPositionChannel;
1384
+ color?: BasicColorChannel;
1385
+ size?: BasicSizeChannel;
1386
+ shape?: BasicShapeChannel;
1387
+ point?: {
1388
+ shape?: PointShape;
1389
+ fill?: string;
1390
+ opacity?: number;
1391
+ stroke?: string;
1392
+ strokeWidth?: number;
1393
+ };
1394
+ guides?: false | CreateGuidesOptions;
1395
+ }
1396
+
1397
+ export interface CreateLinePlotOptions {
1398
+ id?: string;
1399
+ data?: string;
1400
+ coordinate?: string;
1401
+ x: BasicPositionChannel;
1402
+ y: BasicPositionChannel;
1403
+ color?: BasicColorChannel;
1404
+ groupBy?: string;
1405
+ strokeDash?: BasicStrokeDashChannel;
1406
+ line?: {
1407
+ strokeWidth?: number;
1408
+ curve?: CurveInterpolation;
1409
+ stroke?: string;
1410
+ opacity?: number;
1411
+ closed?: boolean;
1412
+ };
1413
+ guides?: false | CreateGuidesOptions;
1414
+ }
1415
+
1416
+ type BasicHistogramEncoding =
1417
+ HistogramEncodingOptions extends infer T
1418
+ ? T extends unknown ? Omit<T, "field" | "target" | "coordinate"> : never
1419
+ : never;
1420
+
1421
+ export interface CreateBarPlotOptions {
1422
+ id?: string;
1423
+ data?: string;
1424
+ coordinate?: string;
1425
+ x: BasicPositionChannel;
1426
+ y: BasicPositionChannel;
1427
+ color?: BasicColorChannel;
1428
+ width?: Omit<BarWidthOptions, "target">;
1429
+ bar?: {
1430
+ fill?: string;
1431
+ opacity?: number;
1432
+ stroke?: string;
1433
+ strokeWidth?: number;
1434
+ };
1435
+ guides?: false | CreateGuidesOptions;
1436
+ }
1437
+
1438
+ export type CreateHistogramOptions = BasicHistogramEncoding & {
1439
+ id?: string;
1440
+ data?: string;
1441
+ coordinate?: string;
1442
+ field: string;
1443
+ color?: BasicColorChannel;
1444
+ bar?: {
1445
+ fill?: string;
1446
+ opacity?: number;
1447
+ stroke?: string;
1448
+ strokeWidth?: number;
1449
+ };
1450
+ guides?: false | CreateGuidesOptions;
1451
+ };
1452
+
1453
+ export interface HeatmapBaseOptions {
1454
+ id?: string;
1455
+ data?: string;
1456
+ coordinate?: string;
1457
+ rect?: {
1458
+ opacity?: number;
1459
+ stroke?: string | false;
1460
+ strokeWidth?: number;
1461
+ };
1462
+ guides?: false | CreateGuidesOptions;
1463
+ }
1464
+
1465
+ export interface PreGriddedHeatmapOptions extends HeatmapBaseOptions {
1466
+ x: BasicPositionChannel;
1467
+ y: BasicPositionChannel;
1468
+ bin?: never;
1469
+ color: BasicColorChannel;
1470
+ }
1471
+
1472
+ export interface BinnedHeatmapPositionChannel {
1473
+ field: string;
1474
+ fieldType?: "quantitative";
1475
+ scale?: ScaleOptions;
1476
+ }
1477
+
1478
+ export interface BinnedHeatmapColorOptions {
1479
+ scale?: ContinuousColorScaleOptions | DiscretizedColorScaleOptions;
1480
+ palette?: Palette;
1481
+ }
1482
+
1483
+ export interface HeatmapBinOptions {
1484
+ bins?: number | Bin2DCounts;
1485
+ extent?: Bin2DExtent;
1486
+ includeEmpty?: boolean;
1487
+ }
1488
+
1489
+ export interface BinnedHeatmapOptions extends HeatmapBaseOptions {
1490
+ x: string | BinnedHeatmapPositionChannel;
1491
+ y: string | BinnedHeatmapPositionChannel;
1492
+ bin: HeatmapBinOptions;
1493
+ color?: BinnedHeatmapColorOptions;
1494
+ }
1495
+
1496
+ export type CreateHeatmapOptions =
1497
+ | PreGriddedHeatmapOptions
1498
+ | BinnedHeatmapOptions;
1499
+
963
1500
  export interface ErrorBandPositionChannel {
964
1501
  field?: string;
965
1502
  fieldType?: "quantitative" | "temporal";
@@ -1029,6 +1566,7 @@ export interface EditDensityOptions {
1029
1566
  steps?: number;
1030
1567
  kernel?: DensityKernel;
1031
1568
  normalization?: DensityNormalization;
1569
+ placement?: DensityPlacement;
1032
1570
  }
1033
1571
 
1034
1572
  export interface OffsetScaleOptions {
@@ -1072,6 +1610,29 @@ export interface EditTextMarkOptions extends Omit<TextMarkOptions, "id" | "data"
1072
1610
  target?: string;
1073
1611
  }
1074
1612
 
1613
+ export type LabelLayoutAxis = "x" | "y" | "both";
1614
+ export type LabelLayoutBounds = "plot" | "canvas";
1615
+
1616
+ export interface LabelLeaderOptions {
1617
+ stroke?: string;
1618
+ strokeWidth?: number;
1619
+ strokeDash?: readonly number[];
1620
+ opacity?: number;
1621
+ }
1622
+
1623
+ export interface LabelLayoutOptions {
1624
+ target?: string;
1625
+ axis?: LabelLayoutAxis;
1626
+ padding?: number;
1627
+ maxDisplacement?: number;
1628
+ bounds?: LabelLayoutBounds;
1629
+ leader?: false | LabelLeaderOptions;
1630
+ }
1631
+
1632
+ export interface RemoveLabelLayoutOptions {
1633
+ target?: string;
1634
+ }
1635
+
1075
1636
  export interface RectMarkOptions {
1076
1637
  id?: string;
1077
1638
  data?: string;
@@ -1204,6 +1765,36 @@ export type OpacityEncodingOptions =
1204
1765
  scale?: OpacityScaleOptions;
1205
1766
  };
1206
1767
 
1768
+ export interface StrokeWidthScaleOptions {
1769
+ id?: string;
1770
+ type?: "linear" | "log" | "pow" | "sqrt" | "symlog";
1771
+ domain?: "auto" | readonly [number, number];
1772
+ range?: "auto" | readonly [number, number];
1773
+ nice?: boolean;
1774
+ zero?: boolean;
1775
+ clamp?: boolean;
1776
+ reverse?: boolean;
1777
+ base?: number;
1778
+ exponent?: number;
1779
+ constant?: number;
1780
+ }
1781
+
1782
+ export type StrokeWidthEncodingOptions =
1783
+ | {
1784
+ value: number;
1785
+ field?: never;
1786
+ target?: string;
1787
+ fieldType?: never;
1788
+ scale?: never;
1789
+ }
1790
+ | {
1791
+ field: string;
1792
+ value?: never;
1793
+ target?: string;
1794
+ fieldType?: "quantitative";
1795
+ scale?: StrokeWidthScaleOptions;
1796
+ };
1797
+
1207
1798
  export type RegressionMethod = "linear" | "polynomial" | "loess";
1208
1799
  export type RegressionInterval = "mean" | "prediction";
1209
1800
 
@@ -1376,7 +1967,7 @@ export interface LegendBorderOptions {
1376
1967
 
1377
1968
  export interface LegendOptions {
1378
1969
  target?: string;
1379
- channels?: readonly ("color" | "strokeDash" | "shape" | "size" | "opacity")[];
1970
+ channels?: readonly ("color" | "strokeDash" | "strokeWidth" | "shape" | "size" | "opacity")[];
1380
1971
  position?: "right" | "left" | "bottom" | "top";
1381
1972
  align?: "left" | "center" | "right";
1382
1973
  direction?: "horizontal" | "vertical";
@@ -1446,6 +2037,17 @@ export interface TitleTextStyleOptions {
1446
2037
  fontWeight?: string | number;
1447
2038
  }
1448
2039
 
2040
+ export interface PathOrderEncodingOptions {
2041
+ target?: string;
2042
+ field: string;
2043
+ fieldType?: "quantitative";
2044
+ order?: "ascending" | "descending";
2045
+ }
2046
+
2047
+ export interface RemovePathOrderOptions {
2048
+ target?: string;
2049
+ }
2050
+
1449
2051
  export interface TitleOptions {
1450
2052
  text: string;
1451
2053
  subtitle?: string;
@@ -1488,6 +2090,8 @@ export class ChartProgram {
1488
2090
  createDensityData(options: DensityDataOptions): ChartProgram;
1489
2091
  createRegressionData(options: RegressionDataOptions): ChartProgram;
1490
2092
  createIntervalData(options: IntervalDataOptions): ChartProgram;
2093
+ createWindowData(options: WindowDataOptions): ChartProgram;
2094
+ createBin2DData(options: Bin2DDataOptions): ChartProgram;
1491
2095
 
1492
2096
  createPointMark(options?: {
1493
2097
  id?: string;
@@ -1506,6 +2110,8 @@ export class ChartProgram {
1506
2110
  stroke?: string;
1507
2111
  strokeWidth?: number;
1508
2112
  }): ChartProgram;
2113
+ jitterPoints(options: JitterPointsOptions): ChartProgram;
2114
+ removeJitter(options?: RemoveJitterOptions): ChartProgram;
1509
2115
  createLineMark(options?: {
1510
2116
  id?: string;
1511
2117
  data?: string;
@@ -1571,6 +2177,8 @@ export class ChartProgram {
1571
2177
  createRuleMark(options?: { id?: string; data?: string }): ChartProgram;
1572
2178
  createTextMark(options?: TextMarkOptions): ChartProgram;
1573
2179
  editTextMark(options: EditTextMarkOptions): ChartProgram;
2180
+ layoutLabels(options?: LabelLayoutOptions): ChartProgram;
2181
+ removeLabelLayout(options?: RemoveLabelLayoutOptions): ChartProgram;
1574
2182
  editAreaMark(options: {
1575
2183
  target?: string;
1576
2184
  fill?: string;
@@ -1612,13 +2220,18 @@ export class ChartProgram {
1612
2220
  scale?: ScaleOptions;
1613
2221
  }): ChartProgram;
1614
2222
  encodeGroup(options: { field: string; target?: string; fieldType?: "nominal" }): ChartProgram;
2223
+ encodePathOrder(options: PathOrderEncodingOptions): ChartProgram;
2224
+ encodeParallelCoordinates(options: ParallelCoordinatesEncodingOptions): ChartProgram;
2225
+ removePathOrder(options?: RemovePathOrderOptions): ChartProgram;
1615
2226
  encodeText(options: TextEncodingOptions): ChartProgram;
1616
2227
  encodeHistogram(options: HistogramEncodingOptions): ChartProgram;
1617
2228
  encodeDensity(options: DensityEncodingOptions): ChartProgram;
1618
2229
  editDensity(options: EditDensityOptions): ChartProgram;
2230
+ encodeHorizon(options?: HorizonEncodingOptions): ChartProgram;
2231
+ editHorizon(options: EditHorizonOptions): ChartProgram;
1619
2232
  encodeBarWidth(options?: BarWidthOptions): ChartProgram;
1620
2233
  encodeStroke(options: { target?: string; value: string }): ChartProgram;
1621
- encodeStrokeWidth(options: { target?: string; value: number }): ChartProgram;
2234
+ encodeStrokeWidth(options: StrokeWidthEncodingOptions): ChartProgram;
1622
2235
 
1623
2236
  createRegression(options?: RegressionOptions): ChartProgram;
1624
2237
  editRegression(options: EditRegressionOptions): ChartProgram;
@@ -1629,6 +2242,15 @@ export class ChartProgram {
1629
2242
  editErrorBandBoundary(options: EditErrorBandBoundaryOptions): ChartProgram;
1630
2243
  createBoxPlot(options?: BoxPlotOptions): ChartProgram;
1631
2244
  editBoxPlot(options: EditBoxPlotOptions): ChartProgram;
2245
+ createGradientPlot(options?: GradientPlotOptions): ChartProgram;
2246
+ editGradientPlot(options: EditGradientPlotOptions): ChartProgram;
2247
+ createViolinPlot(options: ViolinPlotOptions): ChartProgram;
2248
+ createScatterPlot(options: CreateScatterPlotOptions): ChartProgram;
2249
+ createLinePlot(options: CreateLinePlotOptions): ChartProgram;
2250
+ createBarPlot(options: CreateBarPlotOptions): ChartProgram;
2251
+ createHistogram(options: CreateHistogramOptions): ChartProgram;
2252
+ createHeatmap(options: CreateHeatmapOptions): ChartProgram;
2253
+ createParallelCoordinates(options: CreateParallelCoordinatesOptions): ChartProgram;
1632
2254
  removeMark(options?: RemoveMarkOptions): ChartProgram;
1633
2255
  createAxes(options?: CreateAxesOptions): ChartProgram;
1634
2256
  createXAxis(options?: CompleteAxisOptions<XAxisPosition>): ChartProgram;