blockcharts 0.0.1 → 0.0.3

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 (87) hide show
  1. package/README.md +274 -171
  2. package/package.json +43 -6
  3. package/release/bc.d.ts +35 -2
  4. package/release/blocks/guide.axis.js +2 -2
  5. package/release/blocks/guide.grid.js +2 -2
  6. package/release/blocks/guide.kpi.js +2 -2
  7. package/release/blocks/guide.legend.js +2 -2
  8. package/release/blocks/interaction.animate.js +2 -2
  9. package/release/blocks/interaction.brush.js +2 -2
  10. package/release/blocks/interaction.click.js +3 -0
  11. package/release/blocks/interaction.crosshair.js +2 -2
  12. package/release/blocks/interaction.legend-filter.js +2 -2
  13. package/release/blocks/interaction.tooltip.js +2 -2
  14. package/release/blocks/interaction.zoom-controls.js +2 -2
  15. package/release/blocks/interaction.zoom.js +2 -2
  16. package/release/blocks/lib.columns.js +2 -2
  17. package/release/blocks/lib.curve.js +2 -2
  18. package/release/blocks/lib.pointer.js +2 -2
  19. package/release/blocks/lib.stats.js +2 -2
  20. package/release/blocks/lib.ticks.js +2 -2
  21. package/release/blocks/lib.view.js +2 -2
  22. package/release/blocks/mark.arc.js +2 -2
  23. package/release/blocks/mark.area.js +2 -2
  24. package/release/blocks/mark.boxplot.js +2 -2
  25. package/release/blocks/mark.candlestick.js +2 -2
  26. package/release/blocks/mark.line.js +2 -2
  27. package/release/blocks/mark.point.js +2 -2
  28. package/release/blocks/mark.polygon.js +2 -2
  29. package/release/blocks/mark.rect.js +2 -2
  30. package/release/blocks/mark.rule.js +2 -2
  31. package/release/blocks/mark.sankey.js +2 -2
  32. package/release/blocks/mark.text.js +2 -2
  33. package/release/blocks/mark.violin.js +2 -2
  34. package/release/blocks/renderer.canvas.js +2 -2
  35. package/release/blocks/renderer.svg.js +2 -2
  36. package/release/blocks/scale.band.js +2 -2
  37. package/release/blocks/scale.color.js +2 -2
  38. package/release/blocks/scale.linear.js +2 -2
  39. package/release/blocks/scale.log.js +2 -2
  40. package/release/blocks/scale.sequential.js +2 -2
  41. package/release/blocks/scale.size.js +2 -2
  42. package/release/blocks/scale.time.js +2 -2
  43. package/release/blocks/transform.aggregate.js +2 -2
  44. package/release/blocks/transform.bin.js +2 -2
  45. package/release/blocks/transform.calculate.js +2 -2
  46. package/release/blocks/transform.calendar.js +2 -2
  47. package/release/blocks/transform.contour.js +2 -2
  48. package/release/blocks/transform.decimate.js +2 -2
  49. package/release/blocks/transform.density.js +2 -2
  50. package/release/blocks/transform.filter.js +2 -2
  51. package/release/blocks/transform.fold.js +2 -2
  52. package/release/blocks/transform.funnel.js +2 -2
  53. package/release/blocks/transform.hexbin.js +2 -2
  54. package/release/blocks/transform.highlight.js +2 -2
  55. package/release/blocks/transform.marimekko.js +2 -2
  56. package/release/blocks/transform.quartiles.js +2 -2
  57. package/release/blocks/transform.sankey.js +2 -2
  58. package/release/blocks/transform.sort.js +2 -2
  59. package/release/blocks/transform.stack.js +2 -2
  60. package/release/blocks/transform.treemap.js +2 -2
  61. package/release/blocks/transform.waterfall.js +2 -2
  62. package/release/blocks/transform.window.js +2 -2
  63. package/release/core.js +3 -3
  64. package/release/frameworks/controller.d.mts +51 -0
  65. package/release/frameworks/controller.mjs +181 -0
  66. package/release/frameworks/element.d.mts +32 -0
  67. package/release/frameworks/element.mjs +95 -0
  68. package/release/frameworks/react.d.mts +10 -0
  69. package/release/frameworks/react.mjs +30 -0
  70. package/release/frameworks/svelte.d.mts +9 -0
  71. package/release/frameworks/svelte.mjs +17 -0
  72. package/release/frameworks/vue.d.mts +40 -0
  73. package/release/frameworks/vue.mjs +44 -0
  74. package/release/kits/basic.js +25 -22
  75. package/release/kits/basic.mjs +25 -22
  76. package/release/kits/composition.js +39 -36
  77. package/release/kits/composition.mjs +39 -36
  78. package/release/kits/dashboard.js +37 -34
  79. package/release/kits/dashboard.mjs +37 -34
  80. package/release/kits/full.js +64 -61
  81. package/release/kits/full.mjs +64 -61
  82. package/release/kits/timeseries.js +35 -32
  83. package/release/kits/timeseries.mjs +35 -32
  84. package/release/loader.js +2 -2
  85. package/release/manifest.json +326 -221
  86. package/release/schema/chart.schema.json +4155 -0
  87. package/release/schema/page.schema.json +4547 -0
@@ -0,0 +1,4155 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://cdn.jsdelivr.net/npm/blockcharts@0.0.3/release/schema/chart.schema.json",
4
+ "title": "blockcharts 0.0.3 chart",
5
+ "description": "One chart: a dataset by name, scales, marks, guides and interactions, each a block named by its \"type\".",
6
+ "type": "object",
7
+ "required": [
8
+ "data",
9
+ "marks"
10
+ ],
11
+ "additionalProperties": false,
12
+ "properties": {
13
+ "$schema": {
14
+ "type": "string",
15
+ "description": "The schema this file follows; blockcharts ignores it."
16
+ },
17
+ "id": {
18
+ "type": "string",
19
+ "description": "The id of an element on the page to draw the chart in, instead of where its spec is."
20
+ },
21
+ "data": {
22
+ "type": "string",
23
+ "description": "The name of the dataset in the data lake (BC.data, the page's \"data\")."
24
+ },
25
+ "transforms": {
26
+ "type": "array",
27
+ "items": {
28
+ "$ref": "#/definitions/transform"
29
+ },
30
+ "description": "Applied in order to the dataset before the scales are built."
31
+ },
32
+ "size": {
33
+ "type": "array",
34
+ "items": [
35
+ {
36
+ "type": "number",
37
+ "exclusiveMinimum": 0,
38
+ "description": "Width, px."
39
+ },
40
+ {
41
+ "type": "number",
42
+ "exclusiveMinimum": 0,
43
+ "description": "Height, px."
44
+ }
45
+ ],
46
+ "minItems": 2,
47
+ "maxItems": 2,
48
+ "additionalItems": false,
49
+ "description": "[width, height] in px. The chart is laid out at its container's width and this height (see \"responsive\"). Default [640, 400]."
50
+ },
51
+ "padding": {
52
+ "anyOf": [
53
+ {
54
+ "type": "number",
55
+ "minimum": 0
56
+ },
57
+ {
58
+ "type": "object",
59
+ "properties": {
60
+ "top": {
61
+ "type": "number",
62
+ "minimum": 0
63
+ },
64
+ "right": {
65
+ "type": "number",
66
+ "minimum": 0
67
+ },
68
+ "bottom": {
69
+ "type": "number",
70
+ "minimum": 0
71
+ },
72
+ "left": {
73
+ "type": "number",
74
+ "minimum": 0
75
+ }
76
+ },
77
+ "additionalProperties": false
78
+ }
79
+ ],
80
+ "description": "px around the plot, one number for every side or one per side. Default 16; guides take what they need on top."
81
+ },
82
+ "title": {
83
+ "type": "string",
84
+ "description": "A title drawn above the plot."
85
+ },
86
+ "alt": {
87
+ "type": "string",
88
+ "description": "What a reader who cannot see the chart hears it called: what it shows. Default: the title."
89
+ },
90
+ "scales": {
91
+ "type": "object",
92
+ "additionalProperties": {
93
+ "$ref": "#/definitions/scale"
94
+ },
95
+ "description": "Scales by name, declared once; marks and guides refer to them. A channel uses the scale named like it."
96
+ },
97
+ "guides": {
98
+ "type": "array",
99
+ "items": {
100
+ "$ref": "#/definitions/guide"
101
+ },
102
+ "description": "Axes, grids, legends, KPI tiles."
103
+ },
104
+ "marks": {
105
+ "type": "array",
106
+ "items": {
107
+ "$ref": "#/definitions/mark"
108
+ },
109
+ "description": "What is drawn, bottom to top. May be empty when a guide is the chart (a KPI tile)."
110
+ },
111
+ "interaction": {
112
+ "type": "array",
113
+ "items": {
114
+ "$ref": "#/definitions/interaction"
115
+ },
116
+ "description": "Tooltips, zoom, brush, legend filters, clicks, ..."
117
+ },
118
+ "view": {
119
+ "type": "object",
120
+ "additionalProperties": {
121
+ "type": "array"
122
+ },
123
+ "description": "The visible domain of scales when the chart opens (zoomed in): scale name to [from, to] or categories."
124
+ },
125
+ "responsive": {
126
+ "type": "boolean",
127
+ "default": true,
128
+ "description": "Laid out again at its container's width, so text keeps its size. false keeps `size` and scales the drawing."
129
+ },
130
+ "renderer": {
131
+ "type": "string",
132
+ "enum": [
133
+ "canvas",
134
+ "svg"
135
+ ],
136
+ "default": "svg",
137
+ "description": "What draws it."
138
+ },
139
+ "locale": {
140
+ "type": "string",
141
+ "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$",
142
+ "description": "The language numbers and dates are written in where a format names none. Default \"en-US\"."
143
+ }
144
+ },
145
+ "definitions": {
146
+ "transform": {
147
+ "description": "A transform: applied in order to the dataset before the scales are built (\"aggregate\", \"stack\", \"bin\", ...).",
148
+ "type": "object",
149
+ "required": [
150
+ "type"
151
+ ],
152
+ "properties": {
153
+ "type": {
154
+ "type": "string",
155
+ "enum": [
156
+ "aggregate",
157
+ "bin",
158
+ "calculate",
159
+ "calendar",
160
+ "contour",
161
+ "decimate",
162
+ "density",
163
+ "filter",
164
+ "fold",
165
+ "funnel",
166
+ "hexbin",
167
+ "highlight",
168
+ "marimekko",
169
+ "quartiles",
170
+ "sankey",
171
+ "sort",
172
+ "stack",
173
+ "treemap",
174
+ "waterfall",
175
+ "window"
176
+ ],
177
+ "description": "Which transform."
178
+ }
179
+ },
180
+ "allOf": [
181
+ {
182
+ "if": {
183
+ "type": "object",
184
+ "properties": {
185
+ "type": {
186
+ "const": "aggregate"
187
+ }
188
+ },
189
+ "required": [
190
+ "type"
191
+ ]
192
+ },
193
+ "then": {
194
+ "$ref": "#/definitions/transform.aggregate"
195
+ }
196
+ },
197
+ {
198
+ "if": {
199
+ "type": "object",
200
+ "properties": {
201
+ "type": {
202
+ "const": "bin"
203
+ }
204
+ },
205
+ "required": [
206
+ "type"
207
+ ]
208
+ },
209
+ "then": {
210
+ "$ref": "#/definitions/transform.bin"
211
+ }
212
+ },
213
+ {
214
+ "if": {
215
+ "type": "object",
216
+ "properties": {
217
+ "type": {
218
+ "const": "calculate"
219
+ }
220
+ },
221
+ "required": [
222
+ "type"
223
+ ]
224
+ },
225
+ "then": {
226
+ "$ref": "#/definitions/transform.calculate"
227
+ }
228
+ },
229
+ {
230
+ "if": {
231
+ "type": "object",
232
+ "properties": {
233
+ "type": {
234
+ "const": "calendar"
235
+ }
236
+ },
237
+ "required": [
238
+ "type"
239
+ ]
240
+ },
241
+ "then": {
242
+ "$ref": "#/definitions/transform.calendar"
243
+ }
244
+ },
245
+ {
246
+ "if": {
247
+ "type": "object",
248
+ "properties": {
249
+ "type": {
250
+ "const": "contour"
251
+ }
252
+ },
253
+ "required": [
254
+ "type"
255
+ ]
256
+ },
257
+ "then": {
258
+ "$ref": "#/definitions/transform.contour"
259
+ }
260
+ },
261
+ {
262
+ "if": {
263
+ "type": "object",
264
+ "properties": {
265
+ "type": {
266
+ "const": "decimate"
267
+ }
268
+ },
269
+ "required": [
270
+ "type"
271
+ ]
272
+ },
273
+ "then": {
274
+ "$ref": "#/definitions/transform.decimate"
275
+ }
276
+ },
277
+ {
278
+ "if": {
279
+ "type": "object",
280
+ "properties": {
281
+ "type": {
282
+ "const": "density"
283
+ }
284
+ },
285
+ "required": [
286
+ "type"
287
+ ]
288
+ },
289
+ "then": {
290
+ "$ref": "#/definitions/transform.density"
291
+ }
292
+ },
293
+ {
294
+ "if": {
295
+ "type": "object",
296
+ "properties": {
297
+ "type": {
298
+ "const": "filter"
299
+ }
300
+ },
301
+ "required": [
302
+ "type"
303
+ ]
304
+ },
305
+ "then": {
306
+ "$ref": "#/definitions/transform.filter"
307
+ }
308
+ },
309
+ {
310
+ "if": {
311
+ "type": "object",
312
+ "properties": {
313
+ "type": {
314
+ "const": "fold"
315
+ }
316
+ },
317
+ "required": [
318
+ "type"
319
+ ]
320
+ },
321
+ "then": {
322
+ "$ref": "#/definitions/transform.fold"
323
+ }
324
+ },
325
+ {
326
+ "if": {
327
+ "type": "object",
328
+ "properties": {
329
+ "type": {
330
+ "const": "funnel"
331
+ }
332
+ },
333
+ "required": [
334
+ "type"
335
+ ]
336
+ },
337
+ "then": {
338
+ "$ref": "#/definitions/transform.funnel"
339
+ }
340
+ },
341
+ {
342
+ "if": {
343
+ "type": "object",
344
+ "properties": {
345
+ "type": {
346
+ "const": "hexbin"
347
+ }
348
+ },
349
+ "required": [
350
+ "type"
351
+ ]
352
+ },
353
+ "then": {
354
+ "$ref": "#/definitions/transform.hexbin"
355
+ }
356
+ },
357
+ {
358
+ "if": {
359
+ "type": "object",
360
+ "properties": {
361
+ "type": {
362
+ "const": "highlight"
363
+ }
364
+ },
365
+ "required": [
366
+ "type"
367
+ ]
368
+ },
369
+ "then": {
370
+ "$ref": "#/definitions/transform.highlight"
371
+ }
372
+ },
373
+ {
374
+ "if": {
375
+ "type": "object",
376
+ "properties": {
377
+ "type": {
378
+ "const": "marimekko"
379
+ }
380
+ },
381
+ "required": [
382
+ "type"
383
+ ]
384
+ },
385
+ "then": {
386
+ "$ref": "#/definitions/transform.marimekko"
387
+ }
388
+ },
389
+ {
390
+ "if": {
391
+ "type": "object",
392
+ "properties": {
393
+ "type": {
394
+ "const": "quartiles"
395
+ }
396
+ },
397
+ "required": [
398
+ "type"
399
+ ]
400
+ },
401
+ "then": {
402
+ "$ref": "#/definitions/transform.quartiles"
403
+ }
404
+ },
405
+ {
406
+ "if": {
407
+ "type": "object",
408
+ "properties": {
409
+ "type": {
410
+ "const": "sankey"
411
+ }
412
+ },
413
+ "required": [
414
+ "type"
415
+ ]
416
+ },
417
+ "then": {
418
+ "$ref": "#/definitions/transform.sankey"
419
+ }
420
+ },
421
+ {
422
+ "if": {
423
+ "type": "object",
424
+ "properties": {
425
+ "type": {
426
+ "const": "sort"
427
+ }
428
+ },
429
+ "required": [
430
+ "type"
431
+ ]
432
+ },
433
+ "then": {
434
+ "$ref": "#/definitions/transform.sort"
435
+ }
436
+ },
437
+ {
438
+ "if": {
439
+ "type": "object",
440
+ "properties": {
441
+ "type": {
442
+ "const": "stack"
443
+ }
444
+ },
445
+ "required": [
446
+ "type"
447
+ ]
448
+ },
449
+ "then": {
450
+ "$ref": "#/definitions/transform.stack"
451
+ }
452
+ },
453
+ {
454
+ "if": {
455
+ "type": "object",
456
+ "properties": {
457
+ "type": {
458
+ "const": "treemap"
459
+ }
460
+ },
461
+ "required": [
462
+ "type"
463
+ ]
464
+ },
465
+ "then": {
466
+ "$ref": "#/definitions/transform.treemap"
467
+ }
468
+ },
469
+ {
470
+ "if": {
471
+ "type": "object",
472
+ "properties": {
473
+ "type": {
474
+ "const": "waterfall"
475
+ }
476
+ },
477
+ "required": [
478
+ "type"
479
+ ]
480
+ },
481
+ "then": {
482
+ "$ref": "#/definitions/transform.waterfall"
483
+ }
484
+ },
485
+ {
486
+ "if": {
487
+ "type": "object",
488
+ "properties": {
489
+ "type": {
490
+ "const": "window"
491
+ }
492
+ },
493
+ "required": [
494
+ "type"
495
+ ]
496
+ },
497
+ "then": {
498
+ "$ref": "#/definitions/transform.window"
499
+ }
500
+ }
501
+ ]
502
+ },
503
+ "transform.aggregate": {
504
+ "type": "object",
505
+ "properties": {
506
+ "type": {
507
+ "type": "string",
508
+ "const": "aggregate"
509
+ },
510
+ "groupby": {
511
+ "type": "array",
512
+ "description": "Fields to group by: names, or { \"field\", \"unit\", \"as\" }. Empty or missing: one group of all rows."
513
+ },
514
+ "measures": {
515
+ "type": "array",
516
+ "description": "What to compute per group: [{ \"op\": \"sum\", \"field\": \"revenue\", \"as\": \"total\" }]. `as` defaults to \"<op>_<field>\" (\"count\" for a plain count).",
517
+ "default": [
518
+ {
519
+ "op": "count"
520
+ }
521
+ ]
522
+ },
523
+ "sort": {
524
+ "type": "string",
525
+ "description": "Output column (a group-by field or a measure `as`) to sort the groups by."
526
+ },
527
+ "order": {
528
+ "type": "string",
529
+ "enum": [
530
+ "asc",
531
+ "desc"
532
+ ],
533
+ "description": "Direction of `sort`.",
534
+ "default": "asc"
535
+ },
536
+ "limit": {
537
+ "type": "number",
538
+ "description": "Keep only the first N groups (after sorting)."
539
+ }
540
+ },
541
+ "required": [
542
+ "type"
543
+ ],
544
+ "additionalProperties": false,
545
+ "description": "Group-by: one row per distinct combination of the `groupby` fields, with measures computed over the rows of each group (`sum`, `mean`, `min`, `max`, `median`, `count`, `distinct`). A group-by field can be cut into calendar units, `{ \"field\": \"date\", \"unit\": \"month\" }` (year, quarter, month, week from Monday, day, hour; UTC; the group value is the ISO start of the unit). Missing values are ignored by the measures (`count` without a field counts rows). Groups come in order of first appearance, or sorted by a column with `sort`; a time unit sorts by time unless told otherwise. `limit` keeps the first N groups after sorting (top N)."
546
+ },
547
+ "transform.bin": {
548
+ "type": "object",
549
+ "properties": {
550
+ "type": {
551
+ "type": "string",
552
+ "const": "bin"
553
+ },
554
+ "field": {
555
+ "type": "string",
556
+ "description": "Numeric field to count. Missing and non-numeric values are ignored. A field of the dataset."
557
+ },
558
+ "bins": {
559
+ "type": "number",
560
+ "description": "Approximate number of bins; the width is rounded to 1, 2, 5 × 10^n.",
561
+ "default": 10
562
+ },
563
+ "width": {
564
+ "type": "number",
565
+ "description": "Exact bin width; overrides `bins`."
566
+ },
567
+ "log": {
568
+ "type": "boolean",
569
+ "description": "Bins of equal ratio, for x on a log scale. `width` is then in powers of ten (1 = one bin per decade); `bins` is rounded the same way.",
570
+ "default": false
571
+ },
572
+ "extent": {
573
+ "type": "array",
574
+ "description": "[min, max] to bin; values outside are ignored. Default: the range of the data."
575
+ },
576
+ "group": {
577
+ "type": "string",
578
+ "description": "Count separately for every value of this field. A field of the dataset."
579
+ },
580
+ "as": {
581
+ "type": "array",
582
+ "description": "Names of the three new columns: [start, end, count]."
583
+ }
584
+ },
585
+ "required": [
586
+ "type",
587
+ "field"
588
+ ],
589
+ "additionalProperties": false,
590
+ "description": "Counts the values of `field` in equal-width bins with round edges and returns one row per bin: its start, its end and the count (`as`, default bin0 / bin1 / count). With `log` the bins are equal on a log scale (each edge a fixed ratio of the one before) and only positive values count. Empty bins are kept, so a histogram has no gaps. Bins are [start, end) except the last, which includes its end. With `group` there is a row per bin and group, for stacking or side-by-side comparison. Draw it as a rect with x = start, x2 = end and y = count."
591
+ },
592
+ "transform.calculate": {
593
+ "type": "object",
594
+ "properties": {
595
+ "type": {
596
+ "type": "string",
597
+ "const": "calculate"
598
+ },
599
+ "a": {
600
+ "type": "string",
601
+ "description": "Numeric field on the left. A field of the dataset."
602
+ },
603
+ "op": {
604
+ "type": "string",
605
+ "enum": [
606
+ "+",
607
+ "-",
608
+ "*",
609
+ "/"
610
+ ],
611
+ "description": "+ | - | * | /."
612
+ },
613
+ "b": {
614
+ "type": "string",
615
+ "description": "Numeric field on the right; or give `value`. A field of the dataset."
616
+ },
617
+ "value": {
618
+ "type": "number",
619
+ "description": "A constant on the right instead of a field."
620
+ },
621
+ "as": {
622
+ "type": "string",
623
+ "description": "Name of the new column."
624
+ }
625
+ },
626
+ "required": [
627
+ "type",
628
+ "a",
629
+ "op",
630
+ "as"
631
+ ],
632
+ "additionalProperties": false,
633
+ "description": "A new column `as` from two numbers of each row: field `a` and field `b` (or a constant `value`), joined by `op` (+, -, *, /). A margin is profit / revenue; a gap is actual - plan; a price with tax is net * 1.2. A row where either side is not a number, or the division is by zero, gets NaN (drawn as missing). Rows and the other columns stay as they are; the new column can be used by any transform after it. `as` may be `a` or `b` itself to replace that column (revenue / 1000 in thousands); any other existing column is an error."
634
+ },
635
+ "transform.calendar": {
636
+ "type": "object",
637
+ "properties": {
638
+ "type": {
639
+ "type": "string",
640
+ "const": "calendar"
641
+ },
642
+ "field": {
643
+ "type": "string",
644
+ "description": "The date of each row. A field of the dataset."
645
+ },
646
+ "weekStart": {
647
+ "type": "string",
648
+ "enum": [
649
+ "monday",
650
+ "sunday"
651
+ ],
652
+ "description": "The first day of a week.",
653
+ "default": "monday"
654
+ },
655
+ "as": {
656
+ "type": "array",
657
+ "description": "Names of the three new columns. Default [week, weekEnd, day]."
658
+ }
659
+ },
660
+ "required": [
661
+ "type",
662
+ "field"
663
+ ],
664
+ "additionalProperties": false,
665
+ "description": "The columns of a calendar heatmap, one cell per row: `week` and `weekEnd` (where its week starts and ends, for `x` and `x2` of a rect on a time scale) and `day` (the name of the weekday, for `y` on a band scale). Rows are put in weekday order, so the band scale lists the days in the order of a week; a weekday with no rows gets one empty row, with no `week` to be drawn at, so that it keeps its place on the axis. Rows without a date are left out. A day that occurs twice gives two cells on one spot: aggregate first."
666
+ },
667
+ "transform.contour": {
668
+ "type": "object",
669
+ "properties": {
670
+ "type": {
671
+ "type": "string",
672
+ "const": "contour"
673
+ },
674
+ "x": {
675
+ "type": "string",
676
+ "description": "Numeric field along x. A field of the dataset."
677
+ },
678
+ "y": {
679
+ "type": "string",
680
+ "description": "Numeric field along y. A field of the dataset."
681
+ },
682
+ "shares": {
683
+ "type": "array",
684
+ "description": "Regions by how many of the points they hold: [0.25, 0.5, 0.75, 0.95] draws the smallest region with a quarter of the points, then with half, and so on (each number above 0 and below 1). Without it, `levels` regions at even steps of the density."
685
+ },
686
+ "levels": {
687
+ "type": "number",
688
+ "description": "How many regions, at even steps of the density up to its peak, when there are no `shares` (1 to 50).",
689
+ "default": 6
690
+ },
691
+ "bandwidth": {
692
+ "type": "array",
693
+ "description": "How smooth the density is: [along x, along y], in the units of each field, the width of the bump each point adds. Default: Scott's rule on each axis; null keeps it on one axis. Smaller shows more detail and more noise."
694
+ },
695
+ "extent": {
696
+ "type": "array",
697
+ "description": "Where the regions are cut, [[x low, x high], [y low, y high]], each end a number or null for none: [[0, null], [0, null]] for distances and times, which cannot be negative, so no region runs below 0. A point outside it is outside every region."
698
+ },
699
+ "grid": {
700
+ "type": "number",
701
+ "description": "Cells of the grid the density is worked out on, along each axis (8 to 400). More draws smoother outlines.",
702
+ "default": 80
703
+ }
704
+ },
705
+ "required": [
706
+ "type",
707
+ "x",
708
+ "y"
709
+ ],
710
+ "additionalProperties": false,
711
+ "description": "Density contours, for a scatter of too many points to read: where the points of two measures gather, as regions nested like the rings of a map. It smooths the points into a density (a kernel density estimate in two dimensions) and draws the outline of where it is at least each of a few levels. A row of the result is a point of an outline, under the names of `x` and `y`, in order; `ring` names its outline and `level` the region it bounds, 1 the outermost; `share` is how many of the points lie inside that region (0 to 1) and `density` the level itself. Draw it with mark.polygon (`group: \"level\"`, `ring: \"ring\"`), colored by `share` or `level` on a sequential scale; outlines of holes run the other way, so a region with a hole in it is drawn with the hole. Rows where x or y is not a number are left out."
712
+ },
713
+ "transform.decimate": {
714
+ "type": "object",
715
+ "properties": {
716
+ "type": {
717
+ "type": "string",
718
+ "const": "decimate"
719
+ },
720
+ "x": {
721
+ "type": "string",
722
+ "description": "The x field of the line. A field of the dataset."
723
+ },
724
+ "y": {
725
+ "type": "string",
726
+ "description": "The y field of the line. A field of the dataset."
727
+ },
728
+ "scale": {
729
+ "type": "string",
730
+ "description": "Name of the x scale. The name of a declared scale.",
731
+ "default": "x"
732
+ },
733
+ "group": {
734
+ "type": "string",
735
+ "description": "Decimate every series (value of this field) on its own. A field of the dataset."
736
+ },
737
+ "buckets": {
738
+ "type": "number",
739
+ "description": "Pixel columns to split the plot width into. Default: one per px of plot width."
740
+ },
741
+ "threshold": {
742
+ "type": "number",
743
+ "description": "Decimate only when the window holds more than `threshold` rows per column.",
744
+ "default": 4
745
+ }
746
+ },
747
+ "required": [
748
+ "type",
749
+ "x",
750
+ "y"
751
+ ],
752
+ "additionalProperties": false,
753
+ "description": "Level of detail for long lines: keeps only the rows that can change how a line looks. Redone at every zoom. Inside the visible window it splits x into pixel columns and keeps the first, last, lowest and highest row of each, so the envelope of the data is exact; outside the window (beyond a small margin) it drops the rows. Windows that hold few rows are left whole. Needs data sorted by x (per `group`); anything else is passed through unchanged. Put it after transforms that create the rows and before the line mark reads them."
754
+ },
755
+ "transform.density": {
756
+ "type": "object",
757
+ "properties": {
758
+ "type": {
759
+ "type": "string",
760
+ "const": "density"
761
+ },
762
+ "field": {
763
+ "type": "string",
764
+ "description": "Numeric field with the raw samples. Missing and non-numeric values are ignored. A field of the dataset."
765
+ },
766
+ "group": {
767
+ "type": "string",
768
+ "description": "A curve per value of this field (the category of a violin or a ridge). A missing value is a group of its own. Default: one curve. A field of the dataset."
769
+ },
770
+ "bandwidth": {
771
+ "type": "number",
772
+ "description": "How smooth the curve is, in the units of the field: the width of the bump each sample adds. Default: Silverman's rule, per group. Smaller shows more detail and more noise."
773
+ },
774
+ "steps": {
775
+ "type": "number",
776
+ "description": "Rows per curve (2 to 1000).",
777
+ "default": 80
778
+ },
779
+ "extent": {
780
+ "type": "array",
781
+ "description": "The range [low, high] the curves are cut to: [0, null] for values that cannot be negative (times, prices), so a curve does not run below 0. null leaves that end to the data."
782
+ },
783
+ "counts": {
784
+ "type": "boolean",
785
+ "description": "Multiply each curve by its number of samples, so a group of 500 is ten times a group of 50.",
786
+ "default": false
787
+ },
788
+ "as": {
789
+ "type": "array",
790
+ "description": "Names of the two new columns: [value, density]."
791
+ }
792
+ },
793
+ "required": [
794
+ "type",
795
+ "field"
796
+ ],
797
+ "additionalProperties": false,
798
+ "description": "How the raw values of `field` are spread, as a smooth curve (a kernel density estimate): for every group, `steps` evenly spaced rows from a little below its smallest value to a little above its largest, each with the `value` and the `density` there. Draw it with mark.violin (violin plots, ridgelines), or with mark.area / mark.line on x = value, y = density. The curve of each group encloses an area of 1 (with `counts`, its number of samples, so bigger groups are bigger). Replaces the rows: the output has the group field, value, density and `count`, the number of samples of the group."
799
+ },
800
+ "transform.filter": {
801
+ "type": "object",
802
+ "properties": {
803
+ "type": {
804
+ "type": "string",
805
+ "const": "filter"
806
+ },
807
+ "field": {
808
+ "type": "string",
809
+ "description": "Field to test. A field of the dataset."
810
+ },
811
+ "op": {
812
+ "type": "string",
813
+ "enum": [
814
+ "==",
815
+ "!=",
816
+ "<",
817
+ "<=",
818
+ ">",
819
+ ">=",
820
+ "in",
821
+ "notIn",
822
+ "valid"
823
+ ],
824
+ "description": "== | != | < | <= | > | >= | in | notIn | valid.",
825
+ "default": "=="
826
+ },
827
+ "value": {
828
+ "description": "What to compare with; a list for in / notIn; none for valid."
829
+ }
830
+ },
831
+ "required": [
832
+ "type",
833
+ "field"
834
+ ],
835
+ "additionalProperties": false,
836
+ "description": "Keeps the rows whose `field` passes a test and drops the others: `==`, `!=`, `<`, `<=`, `>`, `>=` against `value` (a number, a string, or a date as \"2024-03-01\"), `in` / `notIn` a list of values, `valid` (the field has a value). Numbers compare with numbers, dates with dates (a Date or an ISO date string), text with text; a missing value never passes. Several filters in a row all apply. Rows keep their order; columns stay as they are."
837
+ },
838
+ "transform.fold": {
839
+ "type": "object",
840
+ "properties": {
841
+ "type": {
842
+ "type": "string",
843
+ "const": "fold"
844
+ },
845
+ "fields": {
846
+ "type": "array",
847
+ "items": {
848
+ "type": "string"
849
+ },
850
+ "description": "Columns to fold into rows, in the order of the series."
851
+ },
852
+ "key": {
853
+ "type": "string",
854
+ "description": "Name of the new column with the folded field's name.",
855
+ "default": "key"
856
+ },
857
+ "value": {
858
+ "type": "string",
859
+ "description": "Name of the new column with its value.",
860
+ "default": "value"
861
+ }
862
+ },
863
+ "required": [
864
+ "type",
865
+ "fields"
866
+ ],
867
+ "additionalProperties": false,
868
+ "description": "Turns a wide table (one column per series: month, online, retail) into a long one (month, key, value): every row becomes one row per field of `fields`, with the field's name in `key` and its value in `value`, so the series can be colored, stacked or grouped by `key`. The other columns are repeated on each new row; the folded columns stay too. Rows keep their order, and the fields theirs within each row."
869
+ },
870
+ "transform.funnel": {
871
+ "type": "object",
872
+ "properties": {
873
+ "type": {
874
+ "type": "string",
875
+ "const": "funnel"
876
+ },
877
+ "field": {
878
+ "type": "string",
879
+ "description": "How many reached the stage. A field of the dataset."
880
+ },
881
+ "as": {
882
+ "type": "array",
883
+ "description": "Names of the two end columns. Default [<field>0, <field>1]."
884
+ },
885
+ "rateAs": {
886
+ "type": "string",
887
+ "description": "Name of the column with the share of the first stage (0..1).",
888
+ "default": "rate"
889
+ },
890
+ "stepAs": {
891
+ "type": "string",
892
+ "description": "Name of the column with the share of the previous stage (0..1; the first stage has none).",
893
+ "default": "stepRate"
894
+ }
895
+ },
896
+ "required": [
897
+ "type",
898
+ "field"
899
+ ],
900
+ "additionalProperties": false,
901
+ "description": "A conversion funnel: stages in row order (visits, sign-ups, trials, purchases), each drawn as a bar centered on zero so the shape narrows. Writes the bar's two ends (`<field>0` = -value/2, `<field>1` = +value/2), the share of the first stage (`rate`) and of the stage before (`stepRate`). Draw with mark.rect (x = `<field>0`, x2 = `<field>1`, y = the stage on a band scale) and label with mark.text formatted as percent."
902
+ },
903
+ "transform.hexbin": {
904
+ "type": "object",
905
+ "properties": {
906
+ "type": {
907
+ "type": "string",
908
+ "const": "hexbin"
909
+ },
910
+ "x": {
911
+ "type": "string",
912
+ "description": "Numeric field along x. A field of the dataset."
913
+ },
914
+ "y": {
915
+ "type": "string",
916
+ "description": "Numeric field along y. A field of the dataset."
917
+ },
918
+ "bins": {
919
+ "type": "number",
920
+ "description": "How many hexagons fit across the width of the data on a plot 1.6 times as wide as tall. On a narrower plot fewer fit across, as large in the data, so they stay as large on the screen.",
921
+ "default": 20
922
+ },
923
+ "aspect": {
924
+ "type": "number",
925
+ "description": "Width / height of the plot, to bin once for that shape instead of following the plot: the scales then keep exactly to the hexagons, but at another size the hexagons come out stretched. The plot is the chart less its axes and legend: a 640 × 400 chart with axes on the left and bottom has a plot of about 560 × 320 (1.75)."
926
+ },
927
+ "xScale": {
928
+ "type": "string",
929
+ "description": "Name of the x scale the hexagons are drawn on: they are binned for its size. The name of a declared scale.",
930
+ "default": "x"
931
+ },
932
+ "yScale": {
933
+ "type": "string",
934
+ "description": "Name of the y scale the hexagons are drawn on. The name of a declared scale.",
935
+ "default": "y"
936
+ },
937
+ "as": {
938
+ "type": "array",
939
+ "description": "Names of the four columns of the box. Default [x0, x1, y0, y1]."
940
+ },
941
+ "countAs": {
942
+ "type": "string",
943
+ "description": "Name of the column with the number of points.",
944
+ "default": "count"
945
+ }
946
+ },
947
+ "required": [
948
+ "type",
949
+ "x",
950
+ "y"
951
+ ],
952
+ "additionalProperties": false,
953
+ "description": "Hexagonal binning, for a scatter of too many points to read: the plane is tiled with hexagons and each row of the result is one hexagon that has points in it, with how many (`count`). It writes the box of each hexagon (x0, x1, y0, y1), for a mark.rect with `shape: \"hexagon\"` on two linear scales with `nice: false`, x: x0, x2: x1, y: y0, y2: y1, colored by `count` on a sequential scale; and its center under the names of `x` and `y`, for the tooltip. The hexagons are binned anew for the size the chart is drawn at, and at every zoom, so they stay regular on a phone as on a wide screen; each covers the same area of the data whatever its shape, so a count, and the color legend, mean the same at every size. The scales take their domains from the hexagons binned for the plot as it is laid out: they keep inside it, from edge to edge along one axis and in the middle along the other, where whole regular hexagons leave a little room (under a third of one on most plots). Rows where x or y is not a number are left out."
954
+ },
955
+ "transform.highlight": {
956
+ "type": "object",
957
+ "properties": {
958
+ "type": {
959
+ "type": "string",
960
+ "const": "highlight"
961
+ },
962
+ "field": {
963
+ "type": "string",
964
+ "description": "The field the rows are chosen by. A field of the dataset."
965
+ },
966
+ "pick": {
967
+ "type": "string",
968
+ "enum": [
969
+ "max",
970
+ "min",
971
+ "first",
972
+ "last"
973
+ ],
974
+ "description": "Which rows: the largest or smallest number, the first or last row that has one. Or give `value`."
975
+ },
976
+ "value": {
977
+ "description": "The rows of `field` equal to this, text or a number, instead of `pick`."
978
+ },
979
+ "as": {
980
+ "type": "string",
981
+ "description": "Name of the new column.",
982
+ "default": "highlight"
983
+ },
984
+ "yes": {
985
+ "type": "string",
986
+ "description": "What a marked row holds; it is what a legend would show.",
987
+ "default": "yes"
988
+ },
989
+ "no": {
990
+ "type": "string",
991
+ "description": "What the other rows hold.",
992
+ "default": "no"
993
+ }
994
+ },
995
+ "required": [
996
+ "type",
997
+ "field"
998
+ ],
999
+ "additionalProperties": false,
1000
+ "description": "Marks the rows to set apart in a new column `as`: \"yes\" there and \"no\" elsewhere (or your own words, `yes` and `no`). Choose them by `pick` (the max or min of `field`, its first or last usable row; ties are all marked) or by `value` (the rows of `field` equal to it). Give the column to a color channel with a scale of two colors, and the best month stands out from the bars around it."
1001
+ },
1002
+ "transform.marimekko": {
1003
+ "type": "object",
1004
+ "properties": {
1005
+ "type": {
1006
+ "type": "string",
1007
+ "const": "marimekko"
1008
+ },
1009
+ "field": {
1010
+ "type": "string",
1011
+ "description": "The size of each cell (positive numbers; others are left out). A field of the dataset."
1012
+ },
1013
+ "category": {
1014
+ "type": "string",
1015
+ "description": "The field that makes the columns. A field of the dataset."
1016
+ },
1017
+ "gap": {
1018
+ "type": "number",
1019
+ "description": "Space between the columns, as a share of the width.",
1020
+ "default": 0.003
1021
+ },
1022
+ "as": {
1023
+ "type": "array",
1024
+ "description": "Names of the four corner columns. Default [x0, x1, y0, y1]."
1025
+ },
1026
+ "shareAs": {
1027
+ "type": "string",
1028
+ "description": "Name of the share column.",
1029
+ "default": "share"
1030
+ },
1031
+ "labelAs": {
1032
+ "type": "string",
1033
+ "description": "Name of the label column.",
1034
+ "default": "label"
1035
+ }
1036
+ },
1037
+ "required": [
1038
+ "type",
1039
+ "field",
1040
+ "category"
1041
+ ],
1042
+ "additionalProperties": false,
1043
+ "description": "A Marimekko (mosaic) chart: one column per `category`, as wide as its share of the whole; within it each row takes a height in proportion to `field`. It writes the corners (x0, x1, y0, y1) in 0..1 for a rect on two linear scales with the domain [0, 1], `share` (the part of its column a row takes, 0..1), and `label`, the name of the category on one row of its column. An axis with `\"text\": \"label\", \"from\": \"x0\", \"to\": \"x1\"` names the columns over (or under) them, each over its middle; a mark.text that writes it in a cell finds it on the tallest cell of its column, the one with most room for it. Columns and cells keep the order of the data. Rows without a positive value are left out."
1044
+ },
1045
+ "transform.quartiles": {
1046
+ "type": "object",
1047
+ "properties": {
1048
+ "type": {
1049
+ "type": "string",
1050
+ "const": "quartiles"
1051
+ },
1052
+ "field": {
1053
+ "type": "string",
1054
+ "description": "Numeric field to summarize (the raw sample values). Missing and non-numeric values are ignored. A field of the dataset."
1055
+ },
1056
+ "group": {
1057
+ "type": "string",
1058
+ "description": "A separate summary per value of this field (the boxplot's category axis). A missing value is a group of its own, like transform.aggregate. Default: one summary. A field of the dataset."
1059
+ },
1060
+ "outliers": {
1061
+ "type": "boolean",
1062
+ "description": "true: whiskers stop at 1.5x IQR, points further out become their own \"value\" row. false: whiskers stretch to the true min/max, no outlier rows.",
1063
+ "default": true
1064
+ }
1065
+ },
1066
+ "required": [
1067
+ "type",
1068
+ "field"
1069
+ ],
1070
+ "additionalProperties": false,
1071
+ "description": "The five-number summary of `field` (min/max here mean the Tukey whiskers, not the raw extremes): one row of low/q1/median/q3/high/count per distinct value of `group` (default: one row for the whole dataset). With `outliers` (default true), a sample further than 1.5x the IQR from the box is left out of the whiskers and reported as its own row instead, with `value` set and the summary fields and `count` NaN — draw the box from a rect (q1 to q3) or mark.boxplot, and the outliers from a plain mark.point reading `value`, both keyed on the same `group` field; the two kinds of row tell themselves apart by which fields are NaN, the same way a hidden category already tells a mark not to draw a row. A tooltip shows each kind of row only the fields it has, under the names a reader knows (Low, Q1, Median, Q3, High, Samples, Outlier)."
1072
+ },
1073
+ "transform.sankey": {
1074
+ "type": "object",
1075
+ "properties": {
1076
+ "type": {
1077
+ "type": "string",
1078
+ "const": "sankey"
1079
+ },
1080
+ "source": {
1081
+ "type": "string",
1082
+ "description": "Field with the name of the node a flow leaves. A field of the dataset."
1083
+ },
1084
+ "target": {
1085
+ "type": "string",
1086
+ "description": "Field with the name of the node a flow arrives at. A field of the dataset."
1087
+ },
1088
+ "value": {
1089
+ "type": "string",
1090
+ "description": "Numeric field: the size of the flow. A field of the dataset."
1091
+ },
1092
+ "nodeGap": {
1093
+ "type": "number",
1094
+ "description": "Space between the nodes of a column, as a share of the height of the plot; it shrinks when a column is full, so the gaps take at most half of it.",
1095
+ "default": 0.03
1096
+ },
1097
+ "as": {
1098
+ "type": "array",
1099
+ "description": "Names of the new columns: [x0, x1, y0, y1, thickness, waypoints]; five names keep \"waypoints\"."
1100
+ }
1101
+ },
1102
+ "required": [
1103
+ "type",
1104
+ "source",
1105
+ "target",
1106
+ "value"
1107
+ ],
1108
+ "additionalProperties": false,
1109
+ "description": "The layout of a Sankey diagram, for mark.sankey: one row per flow, from `source` to `target`, its thickness in proportion to `value`. Columns come from the flows themselves: a node goes to the right of everything that flows into it, and a node nothing leaves to the last column; a flow that reaches past the next column gets a place of its own in each column between, so its ribbon runs through a gap rather than behind a node; the nodes of a column are ordered so that ribbons cross as little as they can, and every value is the same height in every column. It keeps the rows and writes on each flow where its ribbon runs, in shares of the plot: `x0` and `x1`, the columns it leaves and reaches (0 the first, 1 the last); `y0` and `y1`, the top of the ribbon at either end (0 the top of the plot, 1 its bottom); `thickness`; and `waypoints`, the column and the top of the ribbon in each column it passes ([x, top, x, top, ...], empty for a flow to the next column). A row with no positive value or no name, or a flow from a node to itself, gets none. Flows have to run one way: a loop is an error that names it."
1110
+ },
1111
+ "transform.sort": {
1112
+ "type": "object",
1113
+ "properties": {
1114
+ "type": {
1115
+ "type": "string",
1116
+ "const": "sort"
1117
+ },
1118
+ "field": {
1119
+ "type": "string",
1120
+ "description": "Field to sort by. A field of the dataset."
1121
+ },
1122
+ "order": {
1123
+ "type": "string",
1124
+ "enum": [
1125
+ "asc",
1126
+ "desc"
1127
+ ],
1128
+ "description": "Direction.",
1129
+ "default": "asc"
1130
+ },
1131
+ "limit": {
1132
+ "type": "number",
1133
+ "description": "Keep only the first N rows (of each group with `group`)."
1134
+ },
1135
+ "group": {
1136
+ "type": "string",
1137
+ "description": "Field that splits the rows: each group sorted and limited on its own. A field of the dataset."
1138
+ }
1139
+ },
1140
+ "required": [
1141
+ "type",
1142
+ "field"
1143
+ ],
1144
+ "additionalProperties": false,
1145
+ "description": "Puts the rows in the order of `field` (`order` \"asc\" or \"desc\"), and with `limit` keeps only the first N: the top 10 products is `field` revenue, `order` \"desc\", `limit` 10. With `group` the order and the limit apply within each group (the top 3 per region), and the groups follow each other in order of first appearance. A band scale lists its categories in row order, so this also orders the bars. Missing values go last either way; numbers come before text when a field mixes them; ties keep data order. Columns stay as they are."
1146
+ },
1147
+ "transform.stack": {
1148
+ "type": "object",
1149
+ "properties": {
1150
+ "type": {
1151
+ "type": "string",
1152
+ "const": "stack"
1153
+ },
1154
+ "field": {
1155
+ "type": "string",
1156
+ "description": "Numeric field to stack. A field of the dataset."
1157
+ },
1158
+ "by": {
1159
+ "type": "string",
1160
+ "description": "Field whose values are the stacks (the x of a stacked bar). A field of the dataset."
1161
+ },
1162
+ "group": {
1163
+ "type": "string",
1164
+ "description": "Field that tells the series apart. Without it rows stack in data order. A field of the dataset."
1165
+ },
1166
+ "as": {
1167
+ "type": "array",
1168
+ "description": "Names of the two new columns: [start, end]."
1169
+ },
1170
+ "normalize": {
1171
+ "type": "boolean",
1172
+ "description": "Scale every stack to 0..1 (100% stacked).",
1173
+ "default": false
1174
+ },
1175
+ "center": {
1176
+ "type": "boolean",
1177
+ "description": "Put the middle of every stack on 0 (a streamgraph). With normalize the stacks run from -0.5 to 0.5.",
1178
+ "default": false
1179
+ },
1180
+ "follows": {
1181
+ "type": "string",
1182
+ "description": "The color scale of `group`: series it does not show (a legend filter hid them) are left out of the stack. Without it they leave a gap, and a 100% stack keeps counting them. The name of a declared scale."
1183
+ }
1184
+ },
1185
+ "required": [
1186
+ "type",
1187
+ "field",
1188
+ "by"
1189
+ ],
1190
+ "additionalProperties": false,
1191
+ "description": "Stacks the values of `field` on top of each other within every value of `by` (the category axis). Adds two columns, the start and the end of each row's segment (`as`, default `<field>0` and `<field>1`). Series are stacked in order of first appearance of `group`; negatives stack downward from 0 separately from positives; missing values contribute nothing and get NaN. Use the columns as y2 and y of a rect or area. `center` puts the middle of every stack on 0, so the layers flow around a center line: a streamgraph (draw it with mark.area, y = end, y2 = start, curve smooth, and no y axis, since only the thickness of a layer means anything). With `follows` the stack is rebuilt when a legend filter hides a series, so the rest close up and a 100% stack adds up to 100% again."
1192
+ },
1193
+ "transform.treemap": {
1194
+ "type": "object",
1195
+ "properties": {
1196
+ "type": {
1197
+ "type": "string",
1198
+ "const": "treemap"
1199
+ },
1200
+ "field": {
1201
+ "type": "string",
1202
+ "description": "The size of each cell (positive numbers; others are left out). A field of the dataset."
1203
+ },
1204
+ "group": {
1205
+ "type": "string",
1206
+ "description": "Field that gathers cells into blocks, one per distinct value. A field of the dataset."
1207
+ },
1208
+ "subgroup": {
1209
+ "type": "string",
1210
+ "description": "Field that gathers the cells of a block into smaller blocks: a third level. Needs `group`. A field of the dataset."
1211
+ },
1212
+ "name": {
1213
+ "type": "string",
1214
+ "description": "Field with each cell's name, copied to `label` (see `labelMin`). A field of the dataset."
1215
+ },
1216
+ "aspect": {
1217
+ "type": "number",
1218
+ "description": "Width / height of the plot, to lay the cells out once for that shape instead of following the plot: at another size they come out stretched."
1219
+ },
1220
+ "padding": {
1221
+ "type": "number",
1222
+ "description": "Space between cells, as a share of the plot height.",
1223
+ "default": 0.004
1224
+ },
1225
+ "labelMin": {
1226
+ "type": "number",
1227
+ "description": "Cells smaller than this share of the whole get no label, even where it would fit. With 0 every named cell has one, and mark.text with x2 / y2 leaves out the ones that do not fit.",
1228
+ "default": 0
1229
+ },
1230
+ "as": {
1231
+ "type": "array",
1232
+ "description": "Names of the four corner columns. Default [x0, x1, y0, y1]."
1233
+ },
1234
+ "labelAs": {
1235
+ "type": "string",
1236
+ "description": "Name of the label column.",
1237
+ "default": "label"
1238
+ }
1239
+ },
1240
+ "required": [
1241
+ "type",
1242
+ "field"
1243
+ ],
1244
+ "additionalProperties": false,
1245
+ "description": "A treemap: each row becomes a rectangle whose area is its `field`, laid out as near-square cells (squarified), largest at the top left. With `group`, rows are first gathered into one block per group (an area per region, then per product inside it), and with `subgroup` each block is divided once more (region, country, product). Writes the corners in 0..1 (`x0`, `x1`, `y0`, `y1`, y up) and a `label` with the name of each cell. Draw with mark.rect (x = x0, x2 = x1, y = y1, y2 = y0) on two linear scales with domain [0, 1] and no axes; color by the group; label with mark.text at (x0, y1) with x2 = x1 and y2 = y0, which leaves out a name its cell has no room for. The cells are laid out for the shape of the plot as it is drawn, and anew when the chart changes width, so they stay near square on a phone as on a wide screen."
1246
+ },
1247
+ "transform.waterfall": {
1248
+ "type": "object",
1249
+ "properties": {
1250
+ "type": {
1251
+ "type": "string",
1252
+ "const": "waterfall"
1253
+ },
1254
+ "field": {
1255
+ "type": "string",
1256
+ "description": "The change each row makes (negative for a loss). A field of the dataset."
1257
+ },
1258
+ "total": {
1259
+ "type": "string",
1260
+ "description": "Field that marks subtotal rows (true, 1, \"yes\" or \"total\"): their bar shows the running total so far. A field of the dataset."
1261
+ },
1262
+ "start": {
1263
+ "type": "number",
1264
+ "description": "Where the running total begins.",
1265
+ "default": 0
1266
+ },
1267
+ "as": {
1268
+ "type": "array",
1269
+ "description": "Names of the start and end columns. Default [<field>0, <field>1]."
1270
+ },
1271
+ "kindAs": {
1272
+ "type": "string",
1273
+ "description": "Name of the column that says \"increase\", \"decrease\" or \"total\".",
1274
+ "default": "step"
1275
+ },
1276
+ "amountAs": {
1277
+ "type": "string",
1278
+ "description": "Name of the column with what each bar stands for: the change of a step, the running total of a subtotal. Label bars with it.",
1279
+ "default": "amount"
1280
+ },
1281
+ "topAs": {
1282
+ "type": "string",
1283
+ "description": "Name of the column with the upper end of each bar, where a label above it goes.",
1284
+ "default": "top"
1285
+ }
1286
+ },
1287
+ "required": [
1288
+ "type",
1289
+ "field"
1290
+ ],
1291
+ "additionalProperties": false,
1292
+ "description": "A waterfall (bridge) chart: how a starting value becomes an ending one through gains and losses. In row order, each row adds its `field` to a running total; the transform writes where each bar starts and ends (`<field>0`, `<field>1`), its kind (`step`: \"increase\", \"decrease\" or \"total\"), what it stands for (`amount`: the change, or the total) and its upper end (`top`, for a label above it). Rows marked by the `total` field are subtotals: their bar goes from 0 to the running total, and their own value is ignored. Draw with mark.rect (y = `<field>1`, y2 = `<field>0` on a band x), colored by `step` through a color scale."
1293
+ },
1294
+ "transform.window": {
1295
+ "type": "object",
1296
+ "properties": {
1297
+ "type": {
1298
+ "type": "string",
1299
+ "const": "window"
1300
+ },
1301
+ "field": {
1302
+ "type": "string",
1303
+ "description": "Numeric field to compute from. A field of the dataset."
1304
+ },
1305
+ "op": {
1306
+ "type": "string",
1307
+ "enum": [
1308
+ "cumsum",
1309
+ "sum",
1310
+ "mean",
1311
+ "min",
1312
+ "max",
1313
+ "diff",
1314
+ "pctChange",
1315
+ "total",
1316
+ "share",
1317
+ "rank"
1318
+ ],
1319
+ "description": "cumsum | sum | mean | min | max | diff | pctChange | total | share | rank. total, share and rank look at the whole group, so they need no sort; a row with no value still gets the total, and no rank."
1320
+ },
1321
+ "order": {
1322
+ "type": "string",
1323
+ "enum": [
1324
+ "desc",
1325
+ "asc"
1326
+ ],
1327
+ "description": "For rank: \"desc\" gives place 1 to the largest value (sales), \"asc\" to the smallest (a time, a cost).",
1328
+ "default": "desc"
1329
+ },
1330
+ "size": {
1331
+ "type": "number",
1332
+ "description": "Rows in the window of sum, mean, min, max (required for them)."
1333
+ },
1334
+ "align": {
1335
+ "type": "string",
1336
+ "enum": [
1337
+ "trailing",
1338
+ "center"
1339
+ ],
1340
+ "description": "\"trailing\": the row and the size - 1 rows before it. \"center\": the row in the middle of its window.",
1341
+ "default": "trailing"
1342
+ },
1343
+ "partial": {
1344
+ "type": "boolean",
1345
+ "description": "Compute windows cut short by the start or end of a series from the rows they have.",
1346
+ "default": false
1347
+ },
1348
+ "sort": {
1349
+ "type": "string",
1350
+ "description": "Field that orders the rows (the x of the chart). Rows without it get NaN. A field of the dataset."
1351
+ },
1352
+ "group": {
1353
+ "type": "string",
1354
+ "description": "Field that splits the rows into series, each computed on its own; a missing value is a series of its own. A field of the dataset."
1355
+ },
1356
+ "as": {
1357
+ "type": "string",
1358
+ "description": "Name of the new column."
1359
+ }
1360
+ },
1361
+ "required": [
1362
+ "type",
1363
+ "field",
1364
+ "op"
1365
+ ],
1366
+ "additionalProperties": false,
1367
+ "description": "A value per row computed from the rows before it (and around it) in the same series: `cumsum` a running total; `sum`, `mean`, `min`, `max` over a moving window of `size` rows (a 7-day moving average is `mean` with size 7 on daily rows); `diff` and `pctChange` the change from the previous row (pctChange is a fraction: 0.1 = +10%); `total` the sum of the whole group on every row of it (a line of totals over stacked bars) and `share` each row as a part of that sum (0.25 = 25%), so rows are not collapsed as by aggregate; `rank` the place of each row in its group by `field`, 1 for the largest (`order` \"asc\": for the smallest), ties sharing a place (1, 2, 2, 4): rank by year with group = the year, and a line per item over the years is a bump chart. Rows are taken in the order of `sort` (a date or number field; data order without it), separately for every value of `group`. Adds one column (`as`, default \"<op>_<field>\") and keeps every row in place. Missing values are skipped by the running total and the window and get NaN themselves; a window that does not have `size` rows yet (the start of a series) is NaN unless `partial` is true."
1368
+ },
1369
+ "scale": {
1370
+ "description": "A scale: how values become positions, colors or sizes. Marks and guides name it.",
1371
+ "type": "object",
1372
+ "required": [
1373
+ "type"
1374
+ ],
1375
+ "properties": {
1376
+ "type": {
1377
+ "type": "string",
1378
+ "enum": [
1379
+ "band",
1380
+ "color",
1381
+ "linear",
1382
+ "log",
1383
+ "sequential",
1384
+ "size",
1385
+ "time"
1386
+ ],
1387
+ "description": "Which scale."
1388
+ }
1389
+ },
1390
+ "allOf": [
1391
+ {
1392
+ "if": {
1393
+ "type": "object",
1394
+ "properties": {
1395
+ "type": {
1396
+ "const": "band"
1397
+ }
1398
+ },
1399
+ "required": [
1400
+ "type"
1401
+ ]
1402
+ },
1403
+ "then": {
1404
+ "$ref": "#/definitions/scale.band"
1405
+ }
1406
+ },
1407
+ {
1408
+ "if": {
1409
+ "type": "object",
1410
+ "properties": {
1411
+ "type": {
1412
+ "const": "color"
1413
+ }
1414
+ },
1415
+ "required": [
1416
+ "type"
1417
+ ]
1418
+ },
1419
+ "then": {
1420
+ "$ref": "#/definitions/scale.color"
1421
+ }
1422
+ },
1423
+ {
1424
+ "if": {
1425
+ "type": "object",
1426
+ "properties": {
1427
+ "type": {
1428
+ "const": "linear"
1429
+ }
1430
+ },
1431
+ "required": [
1432
+ "type"
1433
+ ]
1434
+ },
1435
+ "then": {
1436
+ "$ref": "#/definitions/scale.linear"
1437
+ }
1438
+ },
1439
+ {
1440
+ "if": {
1441
+ "type": "object",
1442
+ "properties": {
1443
+ "type": {
1444
+ "const": "log"
1445
+ }
1446
+ },
1447
+ "required": [
1448
+ "type"
1449
+ ]
1450
+ },
1451
+ "then": {
1452
+ "$ref": "#/definitions/scale.log"
1453
+ }
1454
+ },
1455
+ {
1456
+ "if": {
1457
+ "type": "object",
1458
+ "properties": {
1459
+ "type": {
1460
+ "const": "sequential"
1461
+ }
1462
+ },
1463
+ "required": [
1464
+ "type"
1465
+ ]
1466
+ },
1467
+ "then": {
1468
+ "$ref": "#/definitions/scale.sequential"
1469
+ }
1470
+ },
1471
+ {
1472
+ "if": {
1473
+ "type": "object",
1474
+ "properties": {
1475
+ "type": {
1476
+ "const": "size"
1477
+ }
1478
+ },
1479
+ "required": [
1480
+ "type"
1481
+ ]
1482
+ },
1483
+ "then": {
1484
+ "$ref": "#/definitions/scale.size"
1485
+ }
1486
+ },
1487
+ {
1488
+ "if": {
1489
+ "type": "object",
1490
+ "properties": {
1491
+ "type": {
1492
+ "const": "time"
1493
+ }
1494
+ },
1495
+ "required": [
1496
+ "type"
1497
+ ]
1498
+ },
1499
+ "then": {
1500
+ "$ref": "#/definitions/scale.time"
1501
+ }
1502
+ }
1503
+ ]
1504
+ },
1505
+ "scale.band": {
1506
+ "type": "object",
1507
+ "properties": {
1508
+ "type": {
1509
+ "type": "string",
1510
+ "const": "band"
1511
+ },
1512
+ "field": {
1513
+ "type": "string",
1514
+ "description": "An extra column whose values the domain holds; the channels that use the scale count anyway."
1515
+ },
1516
+ "domain": {
1517
+ "type": "array",
1518
+ "description": "The domain, instead of one inferred from the data: [from, to] for numbers and dates, the categories in order."
1519
+ },
1520
+ "range": {
1521
+ "anyOf": [
1522
+ {
1523
+ "type": "string",
1524
+ "enum": [
1525
+ "width",
1526
+ "height"
1527
+ ]
1528
+ },
1529
+ {
1530
+ "type": "array"
1531
+ }
1532
+ ],
1533
+ "description": "\"width\" or \"height\" of the plot (the default of scales named x and y), or a list: the colors of a color scale, px of a size scale."
1534
+ },
1535
+ "paddingInner": {
1536
+ "type": "number",
1537
+ "description": "Gap between bands, as a fraction of the step.",
1538
+ "default": 0.2
1539
+ },
1540
+ "paddingOuter": {
1541
+ "type": "number",
1542
+ "description": "Gap before the first and after the last band, as a fraction of the step.",
1543
+ "default": 0.1
1544
+ }
1545
+ },
1546
+ "required": [
1547
+ "type"
1548
+ ],
1549
+ "additionalProperties": false,
1550
+ "description": "Categorical scale: one band per distinct value, in first-seen order. Maps a value to the band's lower edge; `bandwidth` is the band width. Bands always run in increasing pixel order (left to right, top to bottom), also on a vertical axis, so horizontal bars list their categories from the top. Zoom = a window of categories."
1551
+ },
1552
+ "scale.color": {
1553
+ "type": "object",
1554
+ "properties": {
1555
+ "type": {
1556
+ "type": "string",
1557
+ "const": "color"
1558
+ },
1559
+ "field": {
1560
+ "type": "string",
1561
+ "description": "An extra column whose values the domain holds; the channels that use the scale count anyway."
1562
+ },
1563
+ "domain": {
1564
+ "type": "array",
1565
+ "description": "The domain, instead of one inferred from the data: [from, to] for numbers and dates, the categories in order."
1566
+ },
1567
+ "range": {
1568
+ "anyOf": [
1569
+ {
1570
+ "type": "string",
1571
+ "enum": [
1572
+ "width",
1573
+ "height"
1574
+ ]
1575
+ },
1576
+ {
1577
+ "type": "array"
1578
+ }
1579
+ ],
1580
+ "description": "\"width\" or \"height\" of the plot (the default of scales named x and y), or a list: the colors of a color scale, px of a size scale."
1581
+ }
1582
+ },
1583
+ "required": [
1584
+ "type"
1585
+ ],
1586
+ "additionalProperties": false,
1587
+ "description": "Categorical color scale: one color per distinct value, in first-seen order. Colors come from `range` (a list of CSS colors) or from the theme palette (--bc-c0 …). Colors stay tied to the value when the domain is narrowed (setView, a legend filter); a value outside the visible domain gets no color, so marks do not draw it."
1588
+ },
1589
+ "scale.linear": {
1590
+ "type": "object",
1591
+ "properties": {
1592
+ "type": {
1593
+ "type": "string",
1594
+ "const": "linear"
1595
+ },
1596
+ "field": {
1597
+ "type": "string",
1598
+ "description": "An extra column whose values the domain holds; the channels that use the scale count anyway."
1599
+ },
1600
+ "domain": {
1601
+ "type": "array",
1602
+ "description": "The domain, instead of one inferred from the data: [from, to] for numbers and dates, the categories in order."
1603
+ },
1604
+ "range": {
1605
+ "anyOf": [
1606
+ {
1607
+ "type": "string",
1608
+ "enum": [
1609
+ "width",
1610
+ "height"
1611
+ ]
1612
+ },
1613
+ {
1614
+ "type": "array"
1615
+ }
1616
+ ],
1617
+ "description": "\"width\" or \"height\" of the plot (the default of scales named x and y), or a list: the colors of a color scale, px of a size scale."
1618
+ },
1619
+ "nice": {
1620
+ "type": "boolean",
1621
+ "description": "Extend the inferred domain to round tick values.",
1622
+ "default": true
1623
+ },
1624
+ "zero": {
1625
+ "type": "boolean",
1626
+ "description": "Include 0 in the inferred domain (bars need it).",
1627
+ "default": false
1628
+ },
1629
+ "padding": {
1630
+ "type": "number",
1631
+ "description": "Extra room around the data extent, as a fraction of its span (0.05 keeps edge points off the axes).",
1632
+ "default": 0
1633
+ }
1634
+ },
1635
+ "required": [
1636
+ "type"
1637
+ ],
1638
+ "additionalProperties": false,
1639
+ "description": "Continuous numeric scale. Domain is inferred from bound channels, padded, and extended to nice tick values. An explicit `domain` is two different numbers; [high, low] runs the axis the other way."
1640
+ },
1641
+ "scale.log": {
1642
+ "type": "object",
1643
+ "properties": {
1644
+ "type": {
1645
+ "type": "string",
1646
+ "const": "log"
1647
+ },
1648
+ "field": {
1649
+ "type": "string",
1650
+ "description": "An extra column whose values the domain holds; the channels that use the scale count anyway."
1651
+ },
1652
+ "domain": {
1653
+ "type": "array",
1654
+ "description": "The domain, instead of one inferred from the data: [from, to] for numbers and dates, the categories in order."
1655
+ },
1656
+ "range": {
1657
+ "anyOf": [
1658
+ {
1659
+ "type": "string",
1660
+ "enum": [
1661
+ "width",
1662
+ "height"
1663
+ ]
1664
+ },
1665
+ {
1666
+ "type": "array"
1667
+ }
1668
+ ],
1669
+ "description": "\"width\" or \"height\" of the plot (the default of scales named x and y), or a list: the colors of a color scale, px of a size scale."
1670
+ },
1671
+ "nice": {
1672
+ "type": "boolean",
1673
+ "description": "Extend the inferred domain to round values.",
1674
+ "default": true
1675
+ }
1676
+ },
1677
+ "required": [
1678
+ "type"
1679
+ ],
1680
+ "additionalProperties": false,
1681
+ "description": "Logarithmic numeric scale (base 10): equal steps for equal ratios, so 10 → 100 is as long as 100 → 1,000. For values that span several orders of magnitude (company sizes, populations) or growth compared as rates. Only positive values have a place on it: zero, negatives and missing values are left out (a line breaks there), and the domain is inferred from the positive ones. `nice` extends it to whole powers of ten, or to 1, 2 or 5 of a power when the data spans less than two of them. Ticks are the powers of ten, with 2 and 5 between them when the domain spans few of them; their labels are compact (1K, 10K, 1M) unless the axis has a `format`. Bars on a log scale start at the bottom of the domain."
1682
+ },
1683
+ "scale.sequential": {
1684
+ "type": "object",
1685
+ "properties": {
1686
+ "type": {
1687
+ "type": "string",
1688
+ "const": "sequential"
1689
+ },
1690
+ "field": {
1691
+ "type": "string",
1692
+ "description": "An extra column whose values the domain holds; the channels that use the scale count anyway."
1693
+ },
1694
+ "domain": {
1695
+ "type": "array",
1696
+ "description": "The domain, instead of one inferred from the data: [from, to] for numbers and dates, the categories in order."
1697
+ },
1698
+ "range": {
1699
+ "anyOf": [
1700
+ {
1701
+ "type": "string",
1702
+ "enum": [
1703
+ "width",
1704
+ "height"
1705
+ ]
1706
+ },
1707
+ {
1708
+ "type": "array"
1709
+ }
1710
+ ],
1711
+ "description": "\"width\" or \"height\" of the plot (the default of scales named x and y), or a list: the colors of a color scale, px of a size scale."
1712
+ },
1713
+ "exponent": {
1714
+ "type": "number",
1715
+ "description": "Colors by the value raised to this power (keeping its sign, so a symmetric domain stays symmetric). 0.5, a square root, gives the small values more of the colors: the cells of a hexbin or a 2D histogram, where a few cells hold most of the points. The legend keeps its labels where the values are, so most of its colors gather at the small end.",
1716
+ "default": 1
1717
+ }
1718
+ },
1719
+ "required": [
1720
+ "type"
1721
+ ],
1722
+ "additionalProperties": false,
1723
+ "description": "Continuous color scale: numbers map to colors along `range` (two or more #hex colors, mixed piecewise-linearly; default viridis). Values outside an explicit `domain` take the end colors; a missing or non-numeric value has no color, and marks do not draw such rows. Use it for heatmaps and for coloring points or bars by a number; for a diverging scale give three colors and a symmetric `domain`. `exponent` spreads the colors over the small values, for counts where a few cells hold most of them."
1724
+ },
1725
+ "scale.size": {
1726
+ "type": "object",
1727
+ "properties": {
1728
+ "type": {
1729
+ "type": "string",
1730
+ "const": "size"
1731
+ },
1732
+ "field": {
1733
+ "type": "string",
1734
+ "description": "An extra column whose values the domain holds; the channels that use the scale count anyway."
1735
+ },
1736
+ "domain": {
1737
+ "type": "array",
1738
+ "description": "The domain, instead of one inferred from the data: [from, to] for numbers and dates, the categories in order."
1739
+ },
1740
+ "range": {
1741
+ "anyOf": [
1742
+ {
1743
+ "type": "string",
1744
+ "enum": [
1745
+ "width",
1746
+ "height"
1747
+ ]
1748
+ },
1749
+ {
1750
+ "type": "array"
1751
+ }
1752
+ ],
1753
+ "description": "\"width\" or \"height\" of the plot (the default of scales named x and y), or a list: the colors of a color scale, px of a size scale."
1754
+ },
1755
+ "zero": {
1756
+ "type": "boolean",
1757
+ "description": "Start the domain at 0, so areas are proportional to the values. false: the smallest value gets the smallest radius (shows differences, overstates ratios).",
1758
+ "default": true
1759
+ }
1760
+ },
1761
+ "required": [
1762
+ "type"
1763
+ ],
1764
+ "additionalProperties": false,
1765
+ "description": "Numbers to circle radii, so that the area of a circle (not its radius) grows with the value: a bubble chart reads true. `range` is [smallest, largest] radius in px (default [2, 24]). The domain starts at 0 unless `zero` is false, so a value twice as big is a circle twice the area. Missing, non-numeric and negative values have no size, and marks do not draw such rows. Pair with mark.point `size` and a guide.legend on the same scale."
1766
+ },
1767
+ "scale.time": {
1768
+ "type": "object",
1769
+ "properties": {
1770
+ "type": {
1771
+ "type": "string",
1772
+ "const": "time"
1773
+ },
1774
+ "field": {
1775
+ "type": "string",
1776
+ "description": "An extra column whose values the domain holds; the channels that use the scale count anyway."
1777
+ },
1778
+ "domain": {
1779
+ "type": "array",
1780
+ "description": "The domain, instead of one inferred from the data: [from, to] for numbers and dates, the categories in order."
1781
+ },
1782
+ "range": {
1783
+ "anyOf": [
1784
+ {
1785
+ "type": "string",
1786
+ "enum": [
1787
+ "width",
1788
+ "height"
1789
+ ]
1790
+ },
1791
+ {
1792
+ "type": "array"
1793
+ }
1794
+ ],
1795
+ "description": "\"width\" or \"height\" of the plot (the default of scales named x and y), or a list: the colors of a color scale, px of a size scale."
1796
+ },
1797
+ "padding": {
1798
+ "type": "number",
1799
+ "description": "Extra room around the data extent, as a fraction of its span.",
1800
+ "default": 0
1801
+ },
1802
+ "nice": {
1803
+ "type": "boolean",
1804
+ "description": "Extend the inferred domain to whole calendar units (days, months, quarters, years: those of about ten ticks), so it starts and ends on a tick: a plan from 5 January to 26 June runs from 1 January to 1 July and names January. Off by default, so a line runs from edge to edge.",
1805
+ "default": false
1806
+ }
1807
+ },
1808
+ "required": [
1809
+ "type"
1810
+ ],
1811
+ "additionalProperties": false,
1812
+ "description": "Time scale in UTC. Values: epoch milliseconds, ISO date strings or Dates; a date or time without an offset (\"2024-03-01\", \"2024-03-01T09:00\", \"2024-03-01 09:00\") is UTC, so every reader sees the same hours. Ticks snap to calendar units (milliseconds … years), and months are written in the language of the chart. Numbers beyond the range of dates (nanoseconds, say) are not times: when none of the numbers is one, the chart reports it. So does it for years given as numbers (2019 is 2 seconds into 1970): give them as text (\"2019\") or dates. A domain from later to earlier runs the axis the other way."
1813
+ },
1814
+ "mark": {
1815
+ "description": "A mark: what is drawn for the rows (\"rect\" for bars, \"line\", \"point\", \"arc\", ...). Channels name fields.",
1816
+ "type": "object",
1817
+ "required": [
1818
+ "type"
1819
+ ],
1820
+ "properties": {
1821
+ "type": {
1822
+ "type": "string",
1823
+ "enum": [
1824
+ "arc",
1825
+ "area",
1826
+ "boxplot",
1827
+ "candlestick",
1828
+ "line",
1829
+ "point",
1830
+ "polygon",
1831
+ "rect",
1832
+ "rule",
1833
+ "sankey",
1834
+ "text",
1835
+ "violin"
1836
+ ],
1837
+ "description": "Which mark."
1838
+ }
1839
+ },
1840
+ "allOf": [
1841
+ {
1842
+ "if": {
1843
+ "type": "object",
1844
+ "properties": {
1845
+ "type": {
1846
+ "const": "arc"
1847
+ }
1848
+ },
1849
+ "required": [
1850
+ "type"
1851
+ ]
1852
+ },
1853
+ "then": {
1854
+ "$ref": "#/definitions/mark.arc"
1855
+ }
1856
+ },
1857
+ {
1858
+ "if": {
1859
+ "type": "object",
1860
+ "properties": {
1861
+ "type": {
1862
+ "const": "area"
1863
+ }
1864
+ },
1865
+ "required": [
1866
+ "type"
1867
+ ]
1868
+ },
1869
+ "then": {
1870
+ "$ref": "#/definitions/mark.area"
1871
+ }
1872
+ },
1873
+ {
1874
+ "if": {
1875
+ "type": "object",
1876
+ "properties": {
1877
+ "type": {
1878
+ "const": "boxplot"
1879
+ }
1880
+ },
1881
+ "required": [
1882
+ "type"
1883
+ ]
1884
+ },
1885
+ "then": {
1886
+ "$ref": "#/definitions/mark.boxplot"
1887
+ }
1888
+ },
1889
+ {
1890
+ "if": {
1891
+ "type": "object",
1892
+ "properties": {
1893
+ "type": {
1894
+ "const": "candlestick"
1895
+ }
1896
+ },
1897
+ "required": [
1898
+ "type"
1899
+ ]
1900
+ },
1901
+ "then": {
1902
+ "$ref": "#/definitions/mark.candlestick"
1903
+ }
1904
+ },
1905
+ {
1906
+ "if": {
1907
+ "type": "object",
1908
+ "properties": {
1909
+ "type": {
1910
+ "const": "line"
1911
+ }
1912
+ },
1913
+ "required": [
1914
+ "type"
1915
+ ]
1916
+ },
1917
+ "then": {
1918
+ "$ref": "#/definitions/mark.line"
1919
+ }
1920
+ },
1921
+ {
1922
+ "if": {
1923
+ "type": "object",
1924
+ "properties": {
1925
+ "type": {
1926
+ "const": "point"
1927
+ }
1928
+ },
1929
+ "required": [
1930
+ "type"
1931
+ ]
1932
+ },
1933
+ "then": {
1934
+ "$ref": "#/definitions/mark.point"
1935
+ }
1936
+ },
1937
+ {
1938
+ "if": {
1939
+ "type": "object",
1940
+ "properties": {
1941
+ "type": {
1942
+ "const": "polygon"
1943
+ }
1944
+ },
1945
+ "required": [
1946
+ "type"
1947
+ ]
1948
+ },
1949
+ "then": {
1950
+ "$ref": "#/definitions/mark.polygon"
1951
+ }
1952
+ },
1953
+ {
1954
+ "if": {
1955
+ "type": "object",
1956
+ "properties": {
1957
+ "type": {
1958
+ "const": "rect"
1959
+ }
1960
+ },
1961
+ "required": [
1962
+ "type"
1963
+ ]
1964
+ },
1965
+ "then": {
1966
+ "$ref": "#/definitions/mark.rect"
1967
+ }
1968
+ },
1969
+ {
1970
+ "if": {
1971
+ "type": "object",
1972
+ "properties": {
1973
+ "type": {
1974
+ "const": "rule"
1975
+ }
1976
+ },
1977
+ "required": [
1978
+ "type"
1979
+ ]
1980
+ },
1981
+ "then": {
1982
+ "$ref": "#/definitions/mark.rule"
1983
+ }
1984
+ },
1985
+ {
1986
+ "if": {
1987
+ "type": "object",
1988
+ "properties": {
1989
+ "type": {
1990
+ "const": "sankey"
1991
+ }
1992
+ },
1993
+ "required": [
1994
+ "type"
1995
+ ]
1996
+ },
1997
+ "then": {
1998
+ "$ref": "#/definitions/mark.sankey"
1999
+ }
2000
+ },
2001
+ {
2002
+ "if": {
2003
+ "type": "object",
2004
+ "properties": {
2005
+ "type": {
2006
+ "const": "text"
2007
+ }
2008
+ },
2009
+ "required": [
2010
+ "type"
2011
+ ]
2012
+ },
2013
+ "then": {
2014
+ "$ref": "#/definitions/mark.text"
2015
+ }
2016
+ },
2017
+ {
2018
+ "if": {
2019
+ "type": "object",
2020
+ "properties": {
2021
+ "type": {
2022
+ "const": "violin"
2023
+ }
2024
+ },
2025
+ "required": [
2026
+ "type"
2027
+ ]
2028
+ },
2029
+ "then": {
2030
+ "$ref": "#/definitions/mark.violin"
2031
+ }
2032
+ }
2033
+ ]
2034
+ },
2035
+ "mark.arc": {
2036
+ "type": "object",
2037
+ "properties": {
2038
+ "type": {
2039
+ "type": "string",
2040
+ "const": "arc"
2041
+ },
2042
+ "value": {
2043
+ "allOf": [
2044
+ {
2045
+ "$ref": "#/definitions/unscaledChannel"
2046
+ }
2047
+ ],
2048
+ "description": "Numeric field: the size of each slice. A field name, { \"field\" } or a constant { \"value\" }; read as it is, without a scale."
2049
+ },
2050
+ "color": {
2051
+ "allOf": [
2052
+ {
2053
+ "$ref": "#/definitions/channel"
2054
+ }
2055
+ ],
2056
+ "description": "Slice color per row from a color scale; a hidden category leaves its slice out. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2057
+ },
2058
+ "innerRadius": {
2059
+ "type": "number",
2060
+ "description": "Hole size as a fraction of the radius (0 = pie, 0.5 = donut).",
2061
+ "default": 0
2062
+ },
2063
+ "startAngle": {
2064
+ "type": "number",
2065
+ "description": "Where the first slice starts, in degrees clockwise from 12 o'clock.",
2066
+ "default": 0
2067
+ },
2068
+ "endAngle": {
2069
+ "type": "number",
2070
+ "description": "Where the arc ends, in degrees as startAngle; default a full circle (startAngle + 360). -90 to 90 is the upper half circle of a gauge. The chart is fitted to the arc, so a half circle fills the width."
2071
+ },
2072
+ "total": {
2073
+ "type": "number",
2074
+ "description": "The whole the slices are shares of: 100 for a score out of 100, 1 for a share, the target of a progress ring. The slices take their share of the arc and the rest is an empty track. Without it the slices fill the arc. What goes past it is cut at the end of the arc."
2075
+ },
2076
+ "center": {
2077
+ "type": "string",
2078
+ "enum": [
2079
+ "none",
2080
+ "value",
2081
+ "percent"
2082
+ ],
2083
+ "description": "The figure in the middle, written with `labelFormat`: the sum of the values (\"value\"), or their share of `total` (\"percent\"). Goes with innerRadius (a hole to write in).",
2084
+ "default": "none"
2085
+ },
2086
+ "padAngle": {
2087
+ "type": "number",
2088
+ "description": "Gap between slices, in degrees.",
2089
+ "default": 1
2090
+ },
2091
+ "sort": {
2092
+ "type": "string",
2093
+ "enum": [
2094
+ "none",
2095
+ "desc",
2096
+ "asc"
2097
+ ],
2098
+ "description": "Order of the slices by value; \"none\" keeps the data order.",
2099
+ "default": "none"
2100
+ },
2101
+ "label": {
2102
+ "type": "string",
2103
+ "enum": [
2104
+ "none",
2105
+ "percent",
2106
+ "value"
2107
+ ],
2108
+ "description": "Text outside each slice (slices under 3% get none).",
2109
+ "default": "none"
2110
+ },
2111
+ "labelFormat": {
2112
+ "allOf": [
2113
+ {
2114
+ "$ref": "#/definitions/format"
2115
+ }
2116
+ ],
2117
+ "description": "How to write that text, as `format` on an axis. A share is a fraction: { \"style\": \"percent\", \"maximumFractionDigits\": 1 } writes 45.1%."
2118
+ },
2119
+ "fill": {
2120
+ "type": "string",
2121
+ "not": {
2122
+ "type": "string",
2123
+ "pattern": "[uU][rR][lL]\\s*\\("
2124
+ },
2125
+ "description": "One color for all slices, when there is no color channel."
2126
+ },
2127
+ "opacity": {
2128
+ "type": "number",
2129
+ "default": 1
2130
+ }
2131
+ },
2132
+ "required": [
2133
+ "type",
2134
+ "value"
2135
+ ],
2136
+ "additionalProperties": false,
2137
+ "description": "Pie and donut chart: one slice per row, its angle proportional to `value`. Needs no x/y scales (declare only a color scale for the colors); the pie fills the plot area. Rows whose value is not a positive number are left out. Slices are laid out clockwise from 12 o'clock. A gauge or a progress ring is the same mark: `startAngle` -90 and `endAngle` 90 make a half circle, `total` the maximum (the rest of the arc is an empty track), `center` writes the figure in the middle."
2138
+ },
2139
+ "mark.area": {
2140
+ "type": "object",
2141
+ "properties": {
2142
+ "type": {
2143
+ "type": "string",
2144
+ "const": "area"
2145
+ },
2146
+ "x": {
2147
+ "allOf": [
2148
+ {
2149
+ "$ref": "#/definitions/channel"
2150
+ }
2151
+ ],
2152
+ "description": "A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2153
+ },
2154
+ "y": {
2155
+ "allOf": [
2156
+ {
2157
+ "$ref": "#/definitions/channel"
2158
+ }
2159
+ ],
2160
+ "description": "A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2161
+ },
2162
+ "y2": {
2163
+ "allOf": [
2164
+ {
2165
+ "$ref": "#/definitions/channel"
2166
+ }
2167
+ ],
2168
+ "description": "Lower edge of the band. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2169
+ },
2170
+ "color": {
2171
+ "allOf": [
2172
+ {
2173
+ "$ref": "#/definitions/channel"
2174
+ }
2175
+ ],
2176
+ "description": "One area per distinct value of the field, colored by a color scale. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2177
+ },
2178
+ "baseline": {
2179
+ "type": "number",
2180
+ "description": "Where the area starts when there is no y2. Keep it inside the scale domain.",
2181
+ "default": 0
2182
+ },
2183
+ "group": {
2184
+ "type": "string",
2185
+ "description": "Field whose distinct values become separate areas. A field of the dataset."
2186
+ },
2187
+ "fill": {
2188
+ "type": "string",
2189
+ "not": {
2190
+ "type": "string",
2191
+ "pattern": "[uU][rR][lL]\\s*\\("
2192
+ },
2193
+ "description": "Any CSS color. Default: theme color by series index."
2194
+ },
2195
+ "opacity": {
2196
+ "type": "number",
2197
+ "description": "Fill opacity (0.45 by default with `fade`).",
2198
+ "default": 0.85
2199
+ },
2200
+ "toBottom": {
2201
+ "type": "boolean",
2202
+ "description": "Fill down to the bottom edge of the plot instead of to `baseline`: the area under a line whose axis does not start at 0 (a sparkline, a KPI trend).",
2203
+ "default": false
2204
+ },
2205
+ "fade": {
2206
+ "type": "boolean",
2207
+ "description": "The fill fades from the color at the top of the plot to transparent at the bottom, and the area has no outline: the soft area under a line.",
2208
+ "default": false
2209
+ },
2210
+ "curve": {
2211
+ "type": "string",
2212
+ "enum": [
2213
+ "linear",
2214
+ "smooth",
2215
+ "step"
2216
+ ],
2217
+ "description": "Same as mark.line: \"smooth\" is a monotone curve through the points, \"step\" holds each value until the next one.",
2218
+ "default": "linear"
2219
+ }
2220
+ },
2221
+ "required": [
2222
+ "type",
2223
+ "x",
2224
+ "y"
2225
+ ],
2226
+ "additionalProperties": false,
2227
+ "description": "A filled band per series between y and y2 (or `baseline`, default 0). Stack with transform.stack and use its two columns as y2 and y. `group` or a `color` channel splits the rows into series, like mark.line. Missing values break the area. `fade` makes the fill fade out towards the bottom (put a line mark on top for the edge); `curve` matches a smooth or a step line. x also takes a band scale, as on mark.line."
2228
+ },
2229
+ "mark.boxplot": {
2230
+ "type": "object",
2231
+ "properties": {
2232
+ "type": {
2233
+ "type": "string",
2234
+ "const": "boxplot"
2235
+ },
2236
+ "x": {
2237
+ "allOf": [
2238
+ {
2239
+ "$ref": "#/definitions/channel"
2240
+ }
2241
+ ],
2242
+ "description": "A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2243
+ },
2244
+ "low": {
2245
+ "allOf": [
2246
+ {
2247
+ "$ref": "#/definitions/channel"
2248
+ }
2249
+ ],
2250
+ "description": "Bottom of the lower whisker. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2251
+ },
2252
+ "q1": {
2253
+ "allOf": [
2254
+ {
2255
+ "$ref": "#/definitions/channel"
2256
+ }
2257
+ ],
2258
+ "description": "Bottom of the box (25th percentile). A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2259
+ },
2260
+ "median": {
2261
+ "allOf": [
2262
+ {
2263
+ "$ref": "#/definitions/channel"
2264
+ }
2265
+ ],
2266
+ "description": "Line drawn across the box. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2267
+ },
2268
+ "q3": {
2269
+ "allOf": [
2270
+ {
2271
+ "$ref": "#/definitions/channel"
2272
+ }
2273
+ ],
2274
+ "description": "Top of the box (75th percentile). A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2275
+ },
2276
+ "high": {
2277
+ "allOf": [
2278
+ {
2279
+ "$ref": "#/definitions/channel"
2280
+ }
2281
+ ],
2282
+ "description": "Top of the upper whisker. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2283
+ },
2284
+ "color": {
2285
+ "allOf": [
2286
+ {
2287
+ "$ref": "#/definitions/channel"
2288
+ }
2289
+ ],
2290
+ "description": "Box and whisker color per row, from a color scale; rows the scale gives no color are not drawn. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2291
+ },
2292
+ "width": {
2293
+ "type": "number",
2294
+ "description": "Box width: a fraction (0-1) of the category band, or, off a band scale, a fixed number of px.",
2295
+ "default": 0.6
2296
+ },
2297
+ "fill": {
2298
+ "type": "string",
2299
+ "not": {
2300
+ "type": "string",
2301
+ "pattern": "[uU][rR][lL]\\s*\\("
2302
+ },
2303
+ "description": "Box fill. Default: theme color by mark index (or the `color` channel)."
2304
+ },
2305
+ "fillOpacity": {
2306
+ "type": "number",
2307
+ "default": 0.85
2308
+ },
2309
+ "strokeWidth": {
2310
+ "type": "number",
2311
+ "description": "Width of the box outline and the whiskers.",
2312
+ "default": 1.5
2313
+ },
2314
+ "opacity": {
2315
+ "type": "number",
2316
+ "default": 1
2317
+ }
2318
+ },
2319
+ "required": [
2320
+ "type",
2321
+ "x",
2322
+ "low",
2323
+ "q1",
2324
+ "median",
2325
+ "q3",
2326
+ "high"
2327
+ ],
2328
+ "additionalProperties": false,
2329
+ "description": "A box (q1 to q3), a line across it at the median, and whiskers out to low/high — the usual shape for transform.quartiles' output. `x` is the category (a band scale, one box per category) or a plain position on a continuous one; the five value channels share the scale of `y` by default. Outliers are not drawn by this mark: transform.quartiles reports them as their own rows (only `value` set, the others NaN), meant for a plain mark.point layered on top reading the same `x` and `value`."
2330
+ },
2331
+ "mark.candlestick": {
2332
+ "type": "object",
2333
+ "properties": {
2334
+ "type": {
2335
+ "type": "string",
2336
+ "const": "candlestick"
2337
+ },
2338
+ "x": {
2339
+ "allOf": [
2340
+ {
2341
+ "$ref": "#/definitions/channel"
2342
+ }
2343
+ ],
2344
+ "description": "A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2345
+ },
2346
+ "open": {
2347
+ "allOf": [
2348
+ {
2349
+ "$ref": "#/definitions/channel"
2350
+ }
2351
+ ],
2352
+ "description": "Price at the start of the period. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2353
+ },
2354
+ "high": {
2355
+ "allOf": [
2356
+ {
2357
+ "$ref": "#/definitions/channel"
2358
+ }
2359
+ ],
2360
+ "description": "Highest price of the period. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2361
+ },
2362
+ "low": {
2363
+ "allOf": [
2364
+ {
2365
+ "$ref": "#/definitions/channel"
2366
+ }
2367
+ ],
2368
+ "description": "Lowest price of the period. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2369
+ },
2370
+ "close": {
2371
+ "allOf": [
2372
+ {
2373
+ "$ref": "#/definitions/channel"
2374
+ }
2375
+ ],
2376
+ "description": "Price at the end of the period. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2377
+ },
2378
+ "width": {
2379
+ "type": "number",
2380
+ "description": "Width of a body, as a share (0-1) of the step between candles.",
2381
+ "default": 0.7
2382
+ },
2383
+ "up": {
2384
+ "type": "string",
2385
+ "not": {
2386
+ "type": "string",
2387
+ "pattern": "[uU][rR][lL]\\s*\\("
2388
+ },
2389
+ "description": "Color of a candle whose close is not below its open.",
2390
+ "default": "var(--bc-good, #12a150)"
2391
+ },
2392
+ "down": {
2393
+ "type": "string",
2394
+ "not": {
2395
+ "type": "string",
2396
+ "pattern": "[uU][rR][lL]\\s*\\("
2397
+ },
2398
+ "description": "Color of a candle whose close is below its open.",
2399
+ "default": "var(--bc-bad, #e5484d)"
2400
+ },
2401
+ "strokeWidth": {
2402
+ "type": "number",
2403
+ "description": "Width of the wick.",
2404
+ "default": 1
2405
+ },
2406
+ "opacity": {
2407
+ "type": "number",
2408
+ "default": 1
2409
+ }
2410
+ },
2411
+ "required": [
2412
+ "type",
2413
+ "x",
2414
+ "open",
2415
+ "high",
2416
+ "low",
2417
+ "close"
2418
+ ],
2419
+ "additionalProperties": false,
2420
+ "description": "Open-high-low-close candles, one per row: a body from `open` to `close`, a thin wick from `low` to `high`, in one color when the price rose and in another when it fell. `x` is a date on a time scale (candles as wide as the nearest two allow) or a category on a band scale; the four prices share the scale of `y`. A row with one of its prices missing has no candle."
2421
+ },
2422
+ "mark.line": {
2423
+ "type": "object",
2424
+ "properties": {
2425
+ "type": {
2426
+ "type": "string",
2427
+ "const": "line"
2428
+ },
2429
+ "x": {
2430
+ "allOf": [
2431
+ {
2432
+ "$ref": "#/definitions/channel"
2433
+ }
2434
+ ],
2435
+ "description": "A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2436
+ },
2437
+ "y": {
2438
+ "allOf": [
2439
+ {
2440
+ "$ref": "#/definitions/channel"
2441
+ }
2442
+ ],
2443
+ "description": "A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2444
+ },
2445
+ "color": {
2446
+ "allOf": [
2447
+ {
2448
+ "$ref": "#/definitions/channel"
2449
+ }
2450
+ ],
2451
+ "description": "One line per distinct value of the field, colored by a color scale. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2452
+ },
2453
+ "group": {
2454
+ "type": "string",
2455
+ "description": "Field whose distinct values become separate lines (long-format data). A field of the dataset."
2456
+ },
2457
+ "stroke": {
2458
+ "type": "string",
2459
+ "not": {
2460
+ "type": "string",
2461
+ "pattern": "[uU][rR][lL]\\s*\\("
2462
+ },
2463
+ "description": "Any CSS color. Default: theme color by line index."
2464
+ },
2465
+ "strokeWidth": {
2466
+ "type": "number",
2467
+ "default": 2
2468
+ },
2469
+ "dash": {
2470
+ "type": "array",
2471
+ "description": "Dash pattern, e.g. [4, 3]."
2472
+ },
2473
+ "opacity": {
2474
+ "type": "number",
2475
+ "default": 1
2476
+ },
2477
+ "curve": {
2478
+ "type": "string",
2479
+ "enum": [
2480
+ "linear",
2481
+ "smooth",
2482
+ "step"
2483
+ ],
2484
+ "description": "\"smooth\": a monotone cubic curve through the points — no peaks or dips the data does not have. \"linear\": straight segments. \"step\": each value holds until the next point, then the line jumps: prices, tariffs, stock levels, anything that changes at moments and stays.",
2485
+ "default": "linear"
2486
+ },
2487
+ "label": {
2488
+ "type": "string",
2489
+ "enum": [
2490
+ "none",
2491
+ "name",
2492
+ "value",
2493
+ "both"
2494
+ ],
2495
+ "description": "A label at the end of each line, in its color: the series name, its last value, or both — so a legend is rarely needed. Labels that would overlap are moved apart. Leave room on the right (padding.right, about 70–110 px).",
2496
+ "default": "none"
2497
+ },
2498
+ "format": {
2499
+ "allOf": [
2500
+ {
2501
+ "$ref": "#/definitions/format"
2502
+ }
2503
+ ],
2504
+ "description": "How the end label writes the last value (a preset or Intl options, as guide.axis `format`)."
2505
+ },
2506
+ "name": {
2507
+ "type": "string",
2508
+ "description": "The end label of a line that is not split into series (default: the y field)."
2509
+ }
2510
+ },
2511
+ "required": [
2512
+ "type",
2513
+ "x",
2514
+ "y"
2515
+ ],
2516
+ "additionalProperties": false,
2517
+ "description": "A line per series: one path however many points. Rows are joined in x order (unsorted data is sorted); missing values break the line. `group` splits the rows into one line per distinct value; a `color` channel does the same and colors each line from its color scale. `curve: \"smooth\"` draws a smooth curve that still passes through every point and never overshoots between two of them; `curve: \"step\"` holds each value until the next point (a price, a tariff). x also takes a band scale: the points sit in the middle of their categories, joined in the order of the band scale domain — a slope chart (two categories, before and after) or a line over named periods."
2518
+ },
2519
+ "mark.point": {
2520
+ "type": "object",
2521
+ "properties": {
2522
+ "type": {
2523
+ "type": "string",
2524
+ "const": "point"
2525
+ },
2526
+ "x": {
2527
+ "allOf": [
2528
+ {
2529
+ "$ref": "#/definitions/channel"
2530
+ }
2531
+ ],
2532
+ "description": "A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2533
+ },
2534
+ "y": {
2535
+ "allOf": [
2536
+ {
2537
+ "$ref": "#/definitions/channel"
2538
+ }
2539
+ ],
2540
+ "description": "A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2541
+ },
2542
+ "color": {
2543
+ "allOf": [
2544
+ {
2545
+ "$ref": "#/definitions/channel"
2546
+ }
2547
+ ],
2548
+ "description": "Fill color per row, from a color scale; rows the scale gives no color (a hidden category, a missing number) are not drawn. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2549
+ },
2550
+ "size": {
2551
+ "allOf": [
2552
+ {
2553
+ "$ref": "#/definitions/channel"
2554
+ }
2555
+ ],
2556
+ "description": "Radius per row from a scale.size (a bubble chart); rows without a size (missing or negative) are not drawn. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2557
+ },
2558
+ "r": {
2559
+ "type": "number",
2560
+ "description": "Radius in px (when there is no `size` channel).",
2561
+ "default": 3
2562
+ },
2563
+ "fill": {
2564
+ "type": "string",
2565
+ "not": {
2566
+ "type": "string",
2567
+ "pattern": "[uU][rR][lL]\\s*\\("
2568
+ },
2569
+ "description": "Any CSS color. Default: theme color by mark index."
2570
+ },
2571
+ "opacity": {
2572
+ "type": "number",
2573
+ "description": "Bubbles overlap: 0.7 lets the ones behind show through.",
2574
+ "default": 1
2575
+ },
2576
+ "stroke": {
2577
+ "type": "string",
2578
+ "description": "Outline color; bubbles read better with the card color as one (\"var(--bc-tooltip-bg, #fff)\", which follows the dark theme)."
2579
+ },
2580
+ "swarm": {
2581
+ "type": "boolean",
2582
+ "description": "Spread the points of each category across its band so that none overlap, keeping each at its value: a beeswarm. Needs a band scale on one axis and a value on the other. When a category does not fit its band (on a phone, say), all points of the mark shrink as little as makes them fit (see `swarmShrink`); a point that still finds no room is laid over the others: use a taller chart, or for thousands of points a violin (transform.density).",
2583
+ "default": false
2584
+ },
2585
+ "swarmGap": {
2586
+ "type": "number",
2587
+ "description": "Space between the points of a swarm, px; it shrinks with the points.",
2588
+ "default": 1
2589
+ },
2590
+ "swarmShrink": {
2591
+ "type": "number",
2592
+ "description": "How much smaller the points of a swarm may get when a category does not fit its band, as a share of their radius: 0.5 lets them get half as big, 0 keeps them as given (at most 0.9).",
2593
+ "default": 0.5
2594
+ }
2595
+ },
2596
+ "required": [
2597
+ "type",
2598
+ "x",
2599
+ "y"
2600
+ ],
2601
+ "additionalProperties": false,
2602
+ "description": "One circle per row. Channels x and y, optional color (a field on a color scale); constant params r, fill, opacity. Either channel also takes a band scale, centered in its band — a category axis plus a value axis draws a dot plot (Cleveland dot plot). A `size` channel on a scale.size makes it a bubble chart: the area of each circle follows the value, big bubbles are drawn first so small ones stay on top. `swarm` on a category axis spreads the points of each category across its band so none overlap: a beeswarm, every sample visible; on a narrow screen its points shrink so they still fit. An opaque dot that rows repeat on one spot is drawn once; with `opacity` below 1 every one is drawn, so piles show."
2603
+ },
2604
+ "mark.polygon": {
2605
+ "type": "object",
2606
+ "properties": {
2607
+ "type": {
2608
+ "type": "string",
2609
+ "const": "polygon"
2610
+ },
2611
+ "x": {
2612
+ "allOf": [
2613
+ {
2614
+ "$ref": "#/definitions/channel"
2615
+ }
2616
+ ],
2617
+ "description": "Position of each point of an outline. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2618
+ },
2619
+ "y": {
2620
+ "allOf": [
2621
+ {
2622
+ "$ref": "#/definitions/channel"
2623
+ }
2624
+ ],
2625
+ "description": "Position of each point of an outline. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2626
+ },
2627
+ "color": {
2628
+ "allOf": [
2629
+ {
2630
+ "$ref": "#/definitions/channel"
2631
+ }
2632
+ ],
2633
+ "description": "Color of a shape, from its first row; a value the scale hides is not drawn. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2634
+ },
2635
+ "group": {
2636
+ "type": "string",
2637
+ "description": "Rows with the same value make one shape. Default: all rows are one. A field of the dataset."
2638
+ },
2639
+ "ring": {
2640
+ "type": "string",
2641
+ "description": "In a shape, a run of rows with the same value is one closed outline. Default: one outline per shape. A field of the dataset."
2642
+ },
2643
+ "filled": {
2644
+ "type": "boolean",
2645
+ "description": "false draws only the outlines, in the color of the shape.",
2646
+ "default": true
2647
+ },
2648
+ "fill": {
2649
+ "type": "string",
2650
+ "not": {
2651
+ "type": "string",
2652
+ "pattern": "[uU][rR][lL]\\s*\\("
2653
+ },
2654
+ "description": "Any CSS color, when there is no color channel. Default: theme color by mark index."
2655
+ },
2656
+ "opacity": {
2657
+ "type": "number",
2658
+ "description": "Fill opacity.",
2659
+ "default": 1
2660
+ },
2661
+ "stroke": {
2662
+ "type": "string",
2663
+ "not": {
2664
+ "type": "string",
2665
+ "pattern": "[uU][rR][lL]\\s*\\("
2666
+ },
2667
+ "description": "Outline color of a filled shape. Default: none."
2668
+ },
2669
+ "strokeWidth": {
2670
+ "type": "number",
2671
+ "default": 1
2672
+ }
2673
+ },
2674
+ "required": [
2675
+ "type",
2676
+ "x",
2677
+ "y"
2678
+ ],
2679
+ "additionalProperties": false,
2680
+ "description": "Closed shapes through the rows in their order: the regions of transform.contour, or any outline given point by point. `group` makes a shape of the rows with one value, drawn as one path, in the order the values first come (the last on top); `ring` splits a shape into several outlines, a run of rows each. An outline inside another that runs the other way round is a hole, as the rings of transform.contour do. With `filled: false` only the outlines are drawn (contour lines). The tooltip finds the shape the pointer is in, the top one first."
2681
+ },
2682
+ "mark.rect": {
2683
+ "type": "object",
2684
+ "properties": {
2685
+ "type": {
2686
+ "type": "string",
2687
+ "const": "rect"
2688
+ },
2689
+ "x": {
2690
+ "allOf": [
2691
+ {
2692
+ "$ref": "#/definitions/channel"
2693
+ }
2694
+ ],
2695
+ "description": "A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2696
+ },
2697
+ "y": {
2698
+ "allOf": [
2699
+ {
2700
+ "$ref": "#/definitions/channel"
2701
+ }
2702
+ ],
2703
+ "description": "A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2704
+ },
2705
+ "x2": {
2706
+ "allOf": [
2707
+ {
2708
+ "$ref": "#/definitions/channel"
2709
+ }
2710
+ ],
2711
+ "description": "Other end of the rectangle along x. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2712
+ },
2713
+ "y2": {
2714
+ "allOf": [
2715
+ {
2716
+ "$ref": "#/definitions/channel"
2717
+ }
2718
+ ],
2719
+ "description": "Other end of the rectangle along y. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2720
+ },
2721
+ "color": {
2722
+ "allOf": [
2723
+ {
2724
+ "$ref": "#/definitions/channel"
2725
+ }
2726
+ ],
2727
+ "description": "Fill color per row, from a color scale; rows the scale gives no color (a hidden category, a missing number) are not drawn. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2728
+ },
2729
+ "dodge": {
2730
+ "allOf": [
2731
+ {
2732
+ "$ref": "#/definitions/unscaledChannel"
2733
+ }
2734
+ ],
2735
+ "description": "Field that splits the band-scale axis into side-by-side bars, one per distinct value (grouped bar). Usually the same field as `color`. One distinct value (or none) draws a plain bar, unchanged. A field name, { \"field\" } or a constant { \"value\" }; read as it is, without a scale."
2736
+ },
2737
+ "baseline": {
2738
+ "type": "number",
2739
+ "description": "Where bars start on a continuous axis without a second channel. Keep it inside the scale domain (scale `zero: true` for 0).",
2740
+ "default": 0
2741
+ },
2742
+ "fill": {
2743
+ "type": "string",
2744
+ "not": {
2745
+ "type": "string",
2746
+ "pattern": "[uU][rR][lL]\\s*\\("
2747
+ },
2748
+ "description": "Any CSS color. Default: theme color by mark index."
2749
+ },
2750
+ "opacity": {
2751
+ "type": "number",
2752
+ "default": 1
2753
+ },
2754
+ "radius": {
2755
+ "type": "number",
2756
+ "description": "Corner radius in px.",
2757
+ "default": 0
2758
+ },
2759
+ "shape": {
2760
+ "type": "string",
2761
+ "enum": [
2762
+ "rect",
2763
+ "hexagon"
2764
+ ],
2765
+ "description": "\"hexagon\": a hexagon pointy at the top in the box the rectangle would fill, its corners on the middle of the top and bottom edges and a quarter of the way down the sides. The boxes transform.hexbin writes tile with it.",
2766
+ "default": "rect"
2767
+ },
2768
+ "thickness": {
2769
+ "type": "number",
2770
+ "description": "Share of the band a bar fills, centered (0.4 = a slim bar; a bullet chart draws the value slimmer than the ranges behind it).",
2771
+ "default": 1
2772
+ },
2773
+ "dodgePadding": {
2774
+ "type": "number",
2775
+ "description": "Gap between the bars of one dodged category, as a fraction of each bar's share of the band.",
2776
+ "default": 0.1
2777
+ }
2778
+ },
2779
+ "required": [
2780
+ "type",
2781
+ "x",
2782
+ "y"
2783
+ ],
2784
+ "additionalProperties": false,
2785
+ "description": "Rectangles. On a band scale a channel spans the band; on a continuous scale it spans from `<channel>2` (or from `baseline`) to the value. bar = band + linear; range bar = x/x2. With no band at all (months on a time x, the amount on y) a bar stands at its position, as wide as most of the smallest step in the data. `dodge` turns a bar chart into a grouped one: it splits each band into one bar per distinct value of the field, side by side (for a stacked bar, use `color` with transform.stack instead — dodge and stack are different arrangements of the same `color`/grouping field). `shape: \"hexagon\"` draws a hexagon in the box instead, for the cells of transform.hexbin."
2786
+ },
2787
+ "mark.rule": {
2788
+ "type": "object",
2789
+ "properties": {
2790
+ "type": {
2791
+ "type": "string",
2792
+ "const": "rule"
2793
+ },
2794
+ "x": {
2795
+ "allOf": [
2796
+ {
2797
+ "$ref": "#/definitions/channel"
2798
+ }
2799
+ ],
2800
+ "description": "A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2801
+ },
2802
+ "y": {
2803
+ "allOf": [
2804
+ {
2805
+ "$ref": "#/definitions/channel"
2806
+ }
2807
+ ],
2808
+ "description": "A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2809
+ },
2810
+ "x2": {
2811
+ "allOf": [
2812
+ {
2813
+ "$ref": "#/definitions/channel"
2814
+ }
2815
+ ],
2816
+ "description": "Other end along x. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2817
+ },
2818
+ "y2": {
2819
+ "allOf": [
2820
+ {
2821
+ "$ref": "#/definitions/channel"
2822
+ }
2823
+ ],
2824
+ "description": "Other end along y. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2825
+ },
2826
+ "color": {
2827
+ "allOf": [
2828
+ {
2829
+ "$ref": "#/definitions/channel"
2830
+ }
2831
+ ],
2832
+ "description": "Line color per row, from a color scale. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2833
+ },
2834
+ "stroke": {
2835
+ "type": "string",
2836
+ "not": {
2837
+ "type": "string",
2838
+ "pattern": "[uU][rR][lL]\\s*\\("
2839
+ },
2840
+ "description": "Any CSS color. Default: the theme text color."
2841
+ },
2842
+ "strokeWidth": {
2843
+ "type": "number",
2844
+ "default": 2
2845
+ },
2846
+ "dash": {
2847
+ "type": "array",
2848
+ "description": "Dash pattern, e.g. [4, 3]."
2849
+ },
2850
+ "opacity": {
2851
+ "type": "number",
2852
+ "default": 1
2853
+ },
2854
+ "thickness": {
2855
+ "type": "number",
2856
+ "description": "On a band scale, the share of the band the line spans (1 = the whole band).",
2857
+ "default": 0.7
2858
+ },
2859
+ "label": {
2860
+ "type": "string",
2861
+ "description": "Text at the end of the line (\"Target 50K\")."
2862
+ }
2863
+ },
2864
+ "required": [
2865
+ "type"
2866
+ ],
2867
+ "additionalProperties": false,
2868
+ "description": "Lines at values: a target, a threshold, an average, the target tick of a bullet chart. `y` alone draws a horizontal line across the plot at that value (`{ \"value\": 50000 }` for a constant, in the units of the y scale); `x` alone a vertical one, through the middle of its band on a band scale. With both, on a band scale the line spans the band (`thickness` of it), so y = category and x = target gives a short tick across each bar. With x2 / y2 it runs between two values, along the middle of the band on a band scale (a range, a dumbbell). The same line is drawn once however many rows repeat it. A tooltip finds a line that reads a column (an error bar, a dumbbell, a lollipop) within a few px of it; a line of constants alone stands for no row and leaves the pointer to the marks under it."
2869
+ },
2870
+ "mark.sankey": {
2871
+ "type": "object",
2872
+ "properties": {
2873
+ "type": {
2874
+ "type": "string",
2875
+ "const": "sankey"
2876
+ },
2877
+ "source": {
2878
+ "allOf": [
2879
+ {
2880
+ "$ref": "#/definitions/unscaledChannel"
2881
+ }
2882
+ ],
2883
+ "description": "Field with the name of the node a flow leaves. A field name, { \"field\" } or a constant { \"value\" }; read as it is, without a scale."
2884
+ },
2885
+ "target": {
2886
+ "allOf": [
2887
+ {
2888
+ "$ref": "#/definitions/unscaledChannel"
2889
+ }
2890
+ ],
2891
+ "description": "Field with the name of the node a flow arrives at. A field name, { \"field\" } or a constant { \"value\" }; read as it is, without a scale."
2892
+ },
2893
+ "value": {
2894
+ "allOf": [
2895
+ {
2896
+ "$ref": "#/definitions/unscaledChannel"
2897
+ }
2898
+ ],
2899
+ "description": "Numeric field: the size of the flow. A field name, { \"field\" } or a constant { \"value\" }; read as it is, without a scale."
2900
+ },
2901
+ "nodeWidth": {
2902
+ "type": "number",
2903
+ "description": "Width of a node, in px.",
2904
+ "default": 12
2905
+ },
2906
+ "format": {
2907
+ "allOf": [
2908
+ {
2909
+ "$ref": "#/definitions/format"
2910
+ }
2911
+ ],
2912
+ "description": "How the total of a node is written after its name. Without it, only the name."
2913
+ },
2914
+ "linkOpacity": {
2915
+ "type": "number",
2916
+ "description": "Opacity of the ribbons.",
2917
+ "default": 0.35
2918
+ },
2919
+ "nodeLabels": {
2920
+ "type": "array",
2921
+ "description": "What a tooltip calls what flows into and out of a node: [\"In\", \"Out\"] by default. Translate it on a page in another language."
2922
+ },
2923
+ "layout": {
2924
+ "type": "array",
2925
+ "description": "Names of the columns transform.sankey writes, when its `as` renames them: [x0, x1, y0, y1, thickness, waypoints]; five names keep \"waypoints\"."
2926
+ },
2927
+ "labelMin": {
2928
+ "type": "number",
2929
+ "description": "Nodes shorter than this many px get no label, so that labels do not overlap.",
2930
+ "default": 11
2931
+ }
2932
+ },
2933
+ "required": [
2934
+ "type",
2935
+ "source",
2936
+ "target",
2937
+ "value"
2938
+ ],
2939
+ "additionalProperties": false,
2940
+ "description": "A Sankey diagram: one row per flow, from `source` to `target`, its thickness in proportion to `value`, drawn where transform.sankey lays it out (put it in `transforms` with the same three fields). Needs no scales and no axes; every node is named on the chart, and has a color of the palette. A label too long for the space between columns loses the total, then the end of the name; two labels that face each other across the last gap share it. Hovering a node lights up its flows. Give the same name to the same node in `source` and `target`, and different names to different stages (a \"Direct\" channel and a \"Direct\" segment would be one node)."
2941
+ },
2942
+ "mark.text": {
2943
+ "type": "object",
2944
+ "properties": {
2945
+ "type": {
2946
+ "type": "string",
2947
+ "const": "text"
2948
+ },
2949
+ "x": {
2950
+ "allOf": [
2951
+ {
2952
+ "$ref": "#/definitions/channel"
2953
+ }
2954
+ ],
2955
+ "description": "A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2956
+ },
2957
+ "y": {
2958
+ "allOf": [
2959
+ {
2960
+ "$ref": "#/definitions/channel"
2961
+ }
2962
+ ],
2963
+ "description": "A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2964
+ },
2965
+ "x2": {
2966
+ "allOf": [
2967
+ {
2968
+ "$ref": "#/definitions/channel"
2969
+ }
2970
+ ],
2971
+ "description": "The other side of the box the label has to fit in (with y2: the cell it labels). A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2972
+ },
2973
+ "y2": {
2974
+ "allOf": [
2975
+ {
2976
+ "$ref": "#/definitions/channel"
2977
+ }
2978
+ ],
2979
+ "description": "The other side of the box the label has to fit in, vertically. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
2980
+ },
2981
+ "text": {
2982
+ "allOf": [
2983
+ {
2984
+ "$ref": "#/definitions/unscaledChannel"
2985
+ }
2986
+ ],
2987
+ "description": "Field with the text to show. A field name, { \"field\" } or a constant { \"value\" }; read as it is, without a scale."
2988
+ },
2989
+ "sign": {
2990
+ "allOf": [
2991
+ {
2992
+ "$ref": "#/definitions/unscaledChannel"
2993
+ }
2994
+ ],
2995
+ "description": "With `negative: \"flip\"`: the field whose sign says which way a row's bar runs, when the label stands at the end of the bar and that end is not below zero. A waterfall step: `y` at `<field>1`, where the bar ends, and `sign: \"amount\"` puts the figure of a loss under its bar. A field name, { \"field\" } or a constant { \"value\" }; read as it is, without a scale."
2996
+ },
2997
+ "color": {
2998
+ "allOf": [
2999
+ {
3000
+ "$ref": "#/definitions/channel"
3001
+ }
3002
+ ],
3003
+ "description": "Text color per row, from a color scale. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
3004
+ },
3005
+ "on": {
3006
+ "allOf": [
3007
+ {
3008
+ "$ref": "#/definitions/channel"
3009
+ }
3010
+ ],
3011
+ "description": "The color the text sits on (the field a heatmap cell is colored by): the text turns dark or light to stay readable. On a palette color a theme can set the text with `--bc-on-c<N>`. Rows with no such color get no text. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
3012
+ },
3013
+ "size": {
3014
+ "type": "number",
3015
+ "description": "Font size in px.",
3016
+ "default": 11
3017
+ },
3018
+ "weight": {
3019
+ "description": "Font weight: a number (600) or a word (\"bold\")."
3020
+ },
3021
+ "anchor": {
3022
+ "type": "string",
3023
+ "enum": [
3024
+ "start",
3025
+ "middle",
3026
+ "end"
3027
+ ],
3028
+ "description": "Horizontal alignment to the anchor point.",
3029
+ "default": "middle"
3030
+ },
3031
+ "baseline": {
3032
+ "type": "string",
3033
+ "enum": [
3034
+ "auto",
3035
+ "middle",
3036
+ "hanging"
3037
+ ],
3038
+ "description": "\"auto\" puts the text above the point, \"hanging\" below it, \"middle\" centers it.",
3039
+ "default": "middle"
3040
+ },
3041
+ "dx": {
3042
+ "type": "number",
3043
+ "description": "Move right by this many px.",
3044
+ "default": 0
3045
+ },
3046
+ "dy": {
3047
+ "type": "number",
3048
+ "description": "Move down by this many px (negative moves up, e.g. -4 with baseline \"auto\" for a label above a bar).",
3049
+ "default": 0
3050
+ },
3051
+ "rotate": {
3052
+ "type": "number",
3053
+ "description": "Degrees around the anchor point.",
3054
+ "default": 0
3055
+ },
3056
+ "decimals": {
3057
+ "type": "number",
3058
+ "description": "Fixed number of decimals for numeric text."
3059
+ },
3060
+ "format": {
3061
+ "allOf": [
3062
+ {
3063
+ "$ref": "#/definitions/format"
3064
+ }
3065
+ ],
3066
+ "description": "How to write numbers (and dates): a preset (\"percent\", \"compact\", \"integer\", \"date\", ...) or an object of Intl options, e.g. { \"style\": \"currency\", \"currency\": \"USD\", \"maximumFractionDigits\": 0 }; also \"locale\", \"prefix\", \"suffix\". Overrides `decimals`."
3067
+ },
3068
+ "fill": {
3069
+ "type": "string",
3070
+ "not": {
3071
+ "type": "string",
3072
+ "pattern": "[uU][rR][lL]\\s*\\("
3073
+ },
3074
+ "description": "Any CSS color. Default: the theme text color."
3075
+ },
3076
+ "negative": {
3077
+ "type": "string",
3078
+ "enum": [
3079
+ "same",
3080
+ "flip"
3081
+ ],
3082
+ "description": "\"flip\" mirrors the placement of a row whose value is below zero, so that the label of a negative bar sits past its end, not inside it: `baseline` and `dy` on a value y, `anchor` and `dx` on a value x (with a band y, as in horizontal bars). The value is the one the label stands at, or the `sign` field when there is one. A row the flip would put out of the plot keeps its own side.",
3083
+ "default": "same"
3084
+ },
3085
+ "collide": {
3086
+ "type": "string",
3087
+ "enum": [
3088
+ "show",
3089
+ "hide"
3090
+ ],
3091
+ "description": "\"hide\" keeps labels off each other, for names on points: in row order, a label that would touch one already placed tries the other side of its point (mirrored `baseline` and `dy`) and is left out if that is taken too. Sort the rows to choose which labels win.",
3092
+ "default": "show"
3093
+ },
3094
+ "minSize": {
3095
+ "type": "number",
3096
+ "description": "The smallest font size a label that does not fit may shrink to; a label that would need less is not drawn. Set it to `size` to never shrink.",
3097
+ "default": 8
3098
+ }
3099
+ },
3100
+ "required": [
3101
+ "type",
3102
+ "x",
3103
+ "y",
3104
+ "text"
3105
+ ],
3106
+ "additionalProperties": false,
3107
+ "description": "A text label per row at (x, y): value labels on bars, annotations on points. The text comes from the `text` field: numbers are written with `format` (a preset such as \"percent\" or an object of Intl options), or rounded to `decimals`, or to 6 significant digits. On a band scale the label is centered in its band. Rows without text are skipped, and the same label on the same spot is written once (a total a transform repeated on each row of its quarter). To keep a label readable on a colored cell, give it `on`: the same field as the cell's color. A label never runs into its neighbours or out of its cell: on a band x scale (anchor middle) it may reach past its band into the gap before the next bar, but not into a label of the next band at the same height (a label in a cell, with `y2`, keeps to the step from one category to the next), and with `x2` / `y2` it must fit the box from (x, y) to (x2, y2), keeping `dx` / `dy` as the margin on the far side too (the cells of a treemap); with anchor or baseline \"middle\" it sits in the middle of the box. A label that does not fit is drawn smaller, down to `minSize`, and is left out below that."
3108
+ },
3109
+ "mark.violin": {
3110
+ "type": "object",
3111
+ "properties": {
3112
+ "type": {
3113
+ "type": "string",
3114
+ "const": "violin"
3115
+ },
3116
+ "x": {
3117
+ "allOf": [
3118
+ {
3119
+ "$ref": "#/definitions/channel"
3120
+ }
3121
+ ],
3122
+ "description": "The category (band) for violins, or the value for ridges. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
3123
+ },
3124
+ "y": {
3125
+ "allOf": [
3126
+ {
3127
+ "$ref": "#/definitions/channel"
3128
+ }
3129
+ ],
3130
+ "description": "The value for violins, or the category (band) for ridges. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
3131
+ },
3132
+ "density": {
3133
+ "allOf": [
3134
+ {
3135
+ "$ref": "#/definitions/unscaledChannel"
3136
+ }
3137
+ ],
3138
+ "description": "Numeric field with the density at each point (`density` of transform.density). A field name, { \"field\" } or a constant { \"value\" }; read as it is, without a scale."
3139
+ },
3140
+ "color": {
3141
+ "allOf": [
3142
+ {
3143
+ "$ref": "#/definitions/channel"
3144
+ }
3145
+ ],
3146
+ "description": "Fill per category, from a color scale; a category the scale hides is not drawn. A field name (on the scale named like the channel), { \"field\", \"scale\" } or a constant { \"value\" }."
3147
+ },
3148
+ "side": {
3149
+ "type": "string",
3150
+ "enum": [
3151
+ "both",
3152
+ "one"
3153
+ ],
3154
+ "description": "\"both\": a violin, the curve mirrored around the middle of the band. \"one\": a ridge on one side, rising from the bottom of the band (on a band y) or from its left (on a band x).",
3155
+ "default": "both"
3156
+ },
3157
+ "extent": {
3158
+ "type": "number",
3159
+ "description": "How much of the band the widest point fills: default 0.9 for a violin, 1.6 for a ridge (above 1 a ridge rises into the band above it, as ridgelines do)."
3160
+ },
3161
+ "normalize": {
3162
+ "type": "string",
3163
+ "enum": [
3164
+ "all",
3165
+ "each"
3166
+ ],
3167
+ "description": "\"all\": one width scale for every shape, so they compare. \"each\": every shape as tall as its band, to read shapes rather than sizes.",
3168
+ "default": "all"
3169
+ },
3170
+ "fill": {
3171
+ "type": "string",
3172
+ "not": {
3173
+ "type": "string",
3174
+ "pattern": "[uU][rR][lL]\\s*\\("
3175
+ },
3176
+ "description": "Any CSS color, when there is no color channel. Default: the first theme color."
3177
+ },
3178
+ "opacity": {
3179
+ "type": "number",
3180
+ "description": "Fill opacity.",
3181
+ "default": 0.85
3182
+ },
3183
+ "stroke": {
3184
+ "type": "string",
3185
+ "description": "Outline color. Default: none for a violin; the card color for a ridge, so a ridge in front stands apart from the one behind it."
3186
+ },
3187
+ "strokeWidth": {
3188
+ "type": "number",
3189
+ "default": 1.5
3190
+ }
3191
+ },
3192
+ "required": [
3193
+ "type",
3194
+ "x",
3195
+ "y",
3196
+ "density"
3197
+ ],
3198
+ "additionalProperties": false,
3199
+ "description": "The shape of a distribution per category, from the rows of transform.density (one row per point of a curve): a violin, mirrored on both sides of its band, or with `side: \"one\"` a ridge standing on the bottom of its band and rising into the one above (a ridgeline, joy plot). Put the categories on a band scale: on x the violins stand up and the value runs along y; on y the shapes lie down and the value runs along x (the usual ridgeline). All shapes share one width scale, so a wider shape is a denser spot; `normalize: \"each\"` fits every shape to its band instead. Shapes further down are drawn over the ones above them."
3200
+ },
3201
+ "guide": {
3202
+ "description": "A guide: an axis, a grid, a legend or a KPI tile, bound to a scale by name.",
3203
+ "type": "object",
3204
+ "required": [
3205
+ "type"
3206
+ ],
3207
+ "properties": {
3208
+ "type": {
3209
+ "type": "string",
3210
+ "enum": [
3211
+ "axis",
3212
+ "grid",
3213
+ "kpi",
3214
+ "legend"
3215
+ ],
3216
+ "description": "Which guide."
3217
+ }
3218
+ },
3219
+ "allOf": [
3220
+ {
3221
+ "if": {
3222
+ "type": "object",
3223
+ "properties": {
3224
+ "type": {
3225
+ "const": "axis"
3226
+ }
3227
+ },
3228
+ "required": [
3229
+ "type"
3230
+ ]
3231
+ },
3232
+ "then": {
3233
+ "$ref": "#/definitions/guide.axis"
3234
+ }
3235
+ },
3236
+ {
3237
+ "if": {
3238
+ "type": "object",
3239
+ "properties": {
3240
+ "type": {
3241
+ "const": "grid"
3242
+ }
3243
+ },
3244
+ "required": [
3245
+ "type"
3246
+ ]
3247
+ },
3248
+ "then": {
3249
+ "$ref": "#/definitions/guide.grid"
3250
+ }
3251
+ },
3252
+ {
3253
+ "if": {
3254
+ "type": "object",
3255
+ "properties": {
3256
+ "type": {
3257
+ "const": "kpi"
3258
+ }
3259
+ },
3260
+ "required": [
3261
+ "type"
3262
+ ]
3263
+ },
3264
+ "then": {
3265
+ "$ref": "#/definitions/guide.kpi"
3266
+ }
3267
+ },
3268
+ {
3269
+ "if": {
3270
+ "type": "object",
3271
+ "properties": {
3272
+ "type": {
3273
+ "const": "legend"
3274
+ }
3275
+ },
3276
+ "required": [
3277
+ "type"
3278
+ ]
3279
+ },
3280
+ "then": {
3281
+ "$ref": "#/definitions/guide.legend"
3282
+ }
3283
+ }
3284
+ ]
3285
+ },
3286
+ "guide.axis": {
3287
+ "type": "object",
3288
+ "properties": {
3289
+ "type": {
3290
+ "type": "string",
3291
+ "const": "axis"
3292
+ },
3293
+ "scale": {
3294
+ "type": "string",
3295
+ "description": "The name of a declared scale."
3296
+ },
3297
+ "position": {
3298
+ "type": "string",
3299
+ "enum": [
3300
+ "top",
3301
+ "right",
3302
+ "bottom",
3303
+ "left"
3304
+ ],
3305
+ "description": "The side of the plot it takes. Default: from its scale (\"height\" left, \"width\" bottom)."
3306
+ },
3307
+ "title": {
3308
+ "type": "string",
3309
+ "description": "Text that names the axis (with its unit, for example \"Revenue, USD\"). Rotated on a vertical axis."
3310
+ },
3311
+ "format": {
3312
+ "allOf": [
3313
+ {
3314
+ "$ref": "#/definitions/format"
3315
+ }
3316
+ ],
3317
+ "description": "How to write the tick labels: numbers and dates on a linear, log or time scale, and on a band scale categories that are dates (\"2024-04-01\" from an aggregate by quarter) or numbers; text categories stay as they are. A preset (\"percent\", \"compact\", \"integer\", \"year\", \"quarter\" (Q2 2024), \"month\", \"day\", \"date\", \"datetime\") or an object of Intl options, e.g. { \"style\": \"currency\", \"currency\": \"USD\", \"maximumFractionDigits\": 0 } or { \"month\": \"short\", \"year\": \"2-digit\" }. Also \"locale\" (default \"en-US\"), \"prefix\" and \"suffix\"."
3318
+ },
3319
+ "line": {
3320
+ "type": "string",
3321
+ "enum": [
3322
+ "auto",
3323
+ "on",
3324
+ "off"
3325
+ ],
3326
+ "description": "The axis line. \"auto\": drawn along a horizontal axis (the baseline bars stand on), left out on a vertical one, where grid lines do the job.",
3327
+ "default": "auto"
3328
+ },
3329
+ "ticks": {
3330
+ "type": "boolean",
3331
+ "description": "Small tick marks at the labels.",
3332
+ "default": false
3333
+ },
3334
+ "count": {
3335
+ "type": "number",
3336
+ "description": "About how many labels to show: 12 for the months of a year. Labels that would not fit are still thinned."
3337
+ },
3338
+ "anchor": {
3339
+ "type": "string",
3340
+ "enum": [
3341
+ "start",
3342
+ "end"
3343
+ ],
3344
+ "description": "Which end thinned labels count from: \"end\" keeps the last one, for a report about the latest period.",
3345
+ "default": "start"
3346
+ },
3347
+ "text": {
3348
+ "type": "string",
3349
+ "description": "Name spans of the data instead of writing the ticks: each row with a value in this field has it written over the middle of its span, from `from` to `to` (values on the scale of this axis), once however many rows share the name and the span. A Marimekko names its columns with `\"text\": \"label\", \"from\": \"x0\", \"to\": \"x1\"`. A name wider than its span breaks onto a second line at a space, and moves a little off the middle (it still stands over the middle of its span) to keep clear of the names beside it; when that is not enough, they all go at an angle. `format` writes the names. A horizontal axis only. A field of the dataset."
3350
+ },
3351
+ "from": {
3352
+ "type": "string",
3353
+ "description": "With `text`: where each span starts. A field of the dataset."
3354
+ },
3355
+ "to": {
3356
+ "type": "string",
3357
+ "description": "With `text`: where each span ends. A field of the dataset."
3358
+ }
3359
+ },
3360
+ "required": [
3361
+ "type",
3362
+ "scale"
3363
+ ],
3364
+ "additionalProperties": false,
3365
+ "description": "Labels for a positional scale, with an axis line and optional tick marks. Side defaults from the scale orientation; set `position` for a second axis. `format` writes the tick labels (currency, percent, dates), `title` names the axis. The quiet default: no tick marks, a line only along a horizontal axis; pair a value axis with guide.grid. Category labels too wide for their band wrap onto two lines; text categories that still do not fit (a narrow screen) all go at an angle, rather than some of them being left out, while dates and numbers show every few. On a vertical axis the labels take at most 30% of the width of the chart: a longer one breaks onto two lines when its band has room, and the rest is cut with an ellipsis and shown whole on hover. With `text`, `from` and `to` a horizontal axis names stretches of the data instead of writing its ticks: the columns of a Marimekko, which are as wide as their shares."
3366
+ },
3367
+ "guide.grid": {
3368
+ "type": "object",
3369
+ "properties": {
3370
+ "type": {
3371
+ "type": "string",
3372
+ "const": "grid"
3373
+ },
3374
+ "scale": {
3375
+ "type": "string",
3376
+ "description": "The name of a declared scale."
3377
+ },
3378
+ "position": {
3379
+ "type": "string",
3380
+ "enum": [
3381
+ "top",
3382
+ "right",
3383
+ "bottom",
3384
+ "left"
3385
+ ],
3386
+ "description": "The side of the plot it takes. Default: from its scale (\"height\" left, \"width\" bottom)."
3387
+ },
3388
+ "count": {
3389
+ "type": "number",
3390
+ "description": "About how many lines: the `count` of the axis on the same scale."
3391
+ }
3392
+ },
3393
+ "required": [
3394
+ "type",
3395
+ "scale"
3396
+ ],
3397
+ "additionalProperties": false,
3398
+ "description": "Grid lines at the ticks of a positional scale (the same ticks its axis shows). Draws behind the marks. An axis given `count` needs the same `count` here, or the lines and the labels part."
3399
+ },
3400
+ "guide.kpi": {
3401
+ "type": "object",
3402
+ "properties": {
3403
+ "type": {
3404
+ "type": "string",
3405
+ "const": "kpi"
3406
+ },
3407
+ "scale": {
3408
+ "type": "string",
3409
+ "description": "The name of the scale the guide shows."
3410
+ },
3411
+ "position": {
3412
+ "type": "string",
3413
+ "enum": [
3414
+ "top",
3415
+ "right",
3416
+ "bottom",
3417
+ "left"
3418
+ ],
3419
+ "description": "The side of the plot it takes. Default: from its scale (\"height\" left, \"width\" bottom)."
3420
+ },
3421
+ "field": {
3422
+ "type": "string",
3423
+ "description": "The numeric field the figure comes from. A field of the dataset."
3424
+ },
3425
+ "label": {
3426
+ "type": "string",
3427
+ "description": "What the figure is (\"Revenue\", \"Active users\"), above it."
3428
+ },
3429
+ "aggregate": {
3430
+ "type": "string",
3431
+ "enum": [
3432
+ "last",
3433
+ "first",
3434
+ "sum",
3435
+ "mean",
3436
+ "min",
3437
+ "max",
3438
+ "count"
3439
+ ],
3440
+ "description": "How the rows make one number: the last row (the latest period, in data order), the first, or the sum, mean, min, max or count of the field.",
3441
+ "default": "last"
3442
+ },
3443
+ "compare": {
3444
+ "type": "string",
3445
+ "enum": [
3446
+ "previous",
3447
+ "first",
3448
+ "none"
3449
+ ],
3450
+ "description": "What the change is measured against: the row before the last (\"previous\", the default with aggregate \"last\"), the first row (\"first\": change over the period), or nothing. \"previous\" and \"first\" compare single rows, so they go with aggregate \"last\" only; a sum or a mean is compared through `against`."
3451
+ },
3452
+ "against": {
3453
+ "type": "string",
3454
+ "description": "Compare with another field instead, aggregated the same way (a target, the same period last year). A field of the dataset."
3455
+ },
3456
+ "delta": {
3457
+ "type": "string",
3458
+ "enum": [
3459
+ "percent",
3460
+ "absolute"
3461
+ ],
3462
+ "description": "The change as a percentage of the comparison, or as a difference written with `format` (or `deltaFormat`).",
3463
+ "default": "percent"
3464
+ },
3465
+ "deltaFormat": {
3466
+ "allOf": [
3467
+ {
3468
+ "$ref": "#/definitions/format"
3469
+ }
3470
+ ],
3471
+ "description": "How to write the change when it is not in the same unit as the value: a share of 66.4% that moved by 1.8 points is { \"maximumFractionDigits\": 1, \"suffix\": \" pp\" }. A preset or an object of Intl options, as in `format`. With delta \"percent\" it gets the change as a fraction (0.12 for 12%). It writes the difference in the units of the field, so a share kept as 0..1 needs `deltaScale`."
3472
+ },
3473
+ "deltaScale": {
3474
+ "type": "number",
3475
+ "description": "What an absolute change is multiplied by before it is written: 100 for a share kept as 0..1 that moved by 0.093 and is to read \"+9.3 pp\".",
3476
+ "default": 1
3477
+ },
3478
+ "better": {
3479
+ "type": "string",
3480
+ "enum": [
3481
+ "up",
3482
+ "down"
3483
+ ],
3484
+ "description": "Which way is good: \"down\" for costs, churn, response times.",
3485
+ "default": "up"
3486
+ },
3487
+ "format": {
3488
+ "allOf": [
3489
+ {
3490
+ "$ref": "#/definitions/format"
3491
+ }
3492
+ ],
3493
+ "description": "How to write the value (a preset such as \"compact\" or \"percent\", or an object of Intl options, e.g. { \"style\": \"currency\", \"currency\": \"USD\", \"maximumFractionDigits\": 0 })."
3494
+ },
3495
+ "note": {
3496
+ "type": "string",
3497
+ "description": "A few words after the change (\"vs last month\", \"vs target\"), or in its place when there is no change."
3498
+ },
3499
+ "rowField": {
3500
+ "type": "string",
3501
+ "description": "Names the row the figure comes from, after the label: with aggregate \"max\" and field \"month\", \"Best month: 2025-09\". For aggregate last, first, min and max: a sum has no row of its own. A field of the dataset."
3502
+ },
3503
+ "rowFormat": {
3504
+ "allOf": [
3505
+ {
3506
+ "$ref": "#/definitions/format"
3507
+ }
3508
+ ],
3509
+ "description": "How to write `rowField`, as in `format`: \"month\" for a date."
3510
+ },
3511
+ "size": {
3512
+ "type": "number",
3513
+ "description": "Font size of the value, px.",
3514
+ "default": 30
3515
+ }
3516
+ },
3517
+ "required": [
3518
+ "type",
3519
+ "field"
3520
+ ],
3521
+ "additionalProperties": false,
3522
+ "description": "A key figure as the heading of a chart: a label, the value in large type, and its change against a comparison, green when it goes the good way and red when not. It takes the room it needs at the top, so a line or an area drawn in the same chart becomes the sparkline under the number. The value is one number from a field: the last row by default (`aggregate`), compared with the row before it; or compare with another field (`against`: a target, last year). A chart may consist of this guide alone (no marks) for a tile with just the number. A tile is laid out at the width of its card, also two to a row on a phone: a value too wide for it is written smaller, and so are the label and the change, down to 10 px, then cut with an ellipsis. A screen reader hears the label, the value and the change after the name of the chart."
3523
+ },
3524
+ "guide.legend": {
3525
+ "type": "object",
3526
+ "properties": {
3527
+ "type": {
3528
+ "type": "string",
3529
+ "const": "legend"
3530
+ },
3531
+ "scale": {
3532
+ "type": "string",
3533
+ "description": "A color, sequential or size scale. The name of a declared scale."
3534
+ },
3535
+ "position": {
3536
+ "type": "string",
3537
+ "enum": [
3538
+ "top",
3539
+ "right",
3540
+ "bottom",
3541
+ "left",
3542
+ "auto"
3543
+ ],
3544
+ "description": "\"auto\" is a row on top while the items fit on two lines, and a column on the right when long labels would need more; it is decided again when the chart changes width.",
3545
+ "default": "right"
3546
+ },
3547
+ "title": {
3548
+ "type": "string",
3549
+ "description": "What the legend shows, on a line above it: \"Region\", \"Revenue, $M\"."
3550
+ },
3551
+ "format": {
3552
+ "allOf": [
3553
+ {
3554
+ "$ref": "#/definitions/format"
3555
+ }
3556
+ ],
3557
+ "description": "How to write the labels of a color bar or a size key (a `sequential` or `size` scale): a preset (\"percent\", \"compact\", ...) or an object of Intl options; see guide.axis `format`."
3558
+ }
3559
+ },
3560
+ "required": [
3561
+ "type",
3562
+ "scale"
3563
+ ],
3564
+ "additionalProperties": false,
3565
+ "description": "Legend of a color scale. A categorical scale (`color`) lists every value with a swatch, and values a filter hides stay listed, dimmed. A continuous scale (`sequential`) draws a color bar with a few labels; a `size` scale draws a few round values as circles of their size (the key of a bubble chart). On the right or left it is a column, on top or bottom a row that wraps onto more lines when it is wider than the plot. A column that would take more than a fifth of the width of the chart (a phone, long labels) or more than its height (many categories) is drawn as a row on top instead; a label too long for a row is cut with an ellipsis and shown whole on hover. Takes space on its side like an axis, so list it after an axis on the same side to sit outside it."
3566
+ },
3567
+ "interaction": {
3568
+ "description": "An interaction: a tooltip, zoom, a brush, a legend filter, clicks, ...",
3569
+ "type": "object",
3570
+ "required": [
3571
+ "type"
3572
+ ],
3573
+ "properties": {
3574
+ "type": {
3575
+ "type": "string",
3576
+ "enum": [
3577
+ "animate",
3578
+ "brush",
3579
+ "click",
3580
+ "crosshair",
3581
+ "legend-filter",
3582
+ "tooltip",
3583
+ "zoom",
3584
+ "zoom-controls"
3585
+ ],
3586
+ "description": "Which interaction."
3587
+ }
3588
+ },
3589
+ "allOf": [
3590
+ {
3591
+ "if": {
3592
+ "type": "object",
3593
+ "properties": {
3594
+ "type": {
3595
+ "const": "animate"
3596
+ }
3597
+ },
3598
+ "required": [
3599
+ "type"
3600
+ ]
3601
+ },
3602
+ "then": {
3603
+ "$ref": "#/definitions/interaction.animate"
3604
+ }
3605
+ },
3606
+ {
3607
+ "if": {
3608
+ "type": "object",
3609
+ "properties": {
3610
+ "type": {
3611
+ "const": "brush"
3612
+ }
3613
+ },
3614
+ "required": [
3615
+ "type"
3616
+ ]
3617
+ },
3618
+ "then": {
3619
+ "$ref": "#/definitions/interaction.brush"
3620
+ }
3621
+ },
3622
+ {
3623
+ "if": {
3624
+ "type": "object",
3625
+ "properties": {
3626
+ "type": {
3627
+ "const": "click"
3628
+ }
3629
+ },
3630
+ "required": [
3631
+ "type"
3632
+ ]
3633
+ },
3634
+ "then": {
3635
+ "$ref": "#/definitions/interaction.click"
3636
+ }
3637
+ },
3638
+ {
3639
+ "if": {
3640
+ "type": "object",
3641
+ "properties": {
3642
+ "type": {
3643
+ "const": "crosshair"
3644
+ }
3645
+ },
3646
+ "required": [
3647
+ "type"
3648
+ ]
3649
+ },
3650
+ "then": {
3651
+ "$ref": "#/definitions/interaction.crosshair"
3652
+ }
3653
+ },
3654
+ {
3655
+ "if": {
3656
+ "type": "object",
3657
+ "properties": {
3658
+ "type": {
3659
+ "const": "legend-filter"
3660
+ }
3661
+ },
3662
+ "required": [
3663
+ "type"
3664
+ ]
3665
+ },
3666
+ "then": {
3667
+ "$ref": "#/definitions/interaction.legend-filter"
3668
+ }
3669
+ },
3670
+ {
3671
+ "if": {
3672
+ "type": "object",
3673
+ "properties": {
3674
+ "type": {
3675
+ "const": "tooltip"
3676
+ }
3677
+ },
3678
+ "required": [
3679
+ "type"
3680
+ ]
3681
+ },
3682
+ "then": {
3683
+ "$ref": "#/definitions/interaction.tooltip"
3684
+ }
3685
+ },
3686
+ {
3687
+ "if": {
3688
+ "type": "object",
3689
+ "properties": {
3690
+ "type": {
3691
+ "const": "zoom"
3692
+ }
3693
+ },
3694
+ "required": [
3695
+ "type"
3696
+ ]
3697
+ },
3698
+ "then": {
3699
+ "$ref": "#/definitions/interaction.zoom"
3700
+ }
3701
+ },
3702
+ {
3703
+ "if": {
3704
+ "type": "object",
3705
+ "properties": {
3706
+ "type": {
3707
+ "const": "zoom-controls"
3708
+ }
3709
+ },
3710
+ "required": [
3711
+ "type"
3712
+ ]
3713
+ },
3714
+ "then": {
3715
+ "$ref": "#/definitions/interaction.zoom-controls"
3716
+ }
3717
+ }
3718
+ ]
3719
+ },
3720
+ "interaction.animate": {
3721
+ "type": "object",
3722
+ "properties": {
3723
+ "type": {
3724
+ "type": "string",
3725
+ "const": "animate"
3726
+ },
3727
+ "effect": {
3728
+ "type": "string",
3729
+ "enum": [
3730
+ "auto",
3731
+ "grow",
3732
+ "wipe",
3733
+ "pop",
3734
+ "fade"
3735
+ ],
3736
+ "description": "\"auto\" picks by the marks: grow for bars, wipe for lines and areas, pop for a pie, fade otherwise.",
3737
+ "default": "auto"
3738
+ },
3739
+ "duration": {
3740
+ "type": "number",
3741
+ "description": "Milliseconds.",
3742
+ "default": 700
3743
+ },
3744
+ "delay": {
3745
+ "type": "number",
3746
+ "description": "Milliseconds before it starts (stagger the cards of a dashboard).",
3747
+ "default": 0
3748
+ }
3749
+ },
3750
+ "required": [
3751
+ "type"
3752
+ ],
3753
+ "additionalProperties": false,
3754
+ "description": "Plays the chart in once, when it is first drawn: bars grow from their baseline, lines and areas are drawn from left to right, a pie opens from its center, anything else fades in. Never again on zoom, filter or update of the view, and not at all for readers who ask their system for reduced motion; a chart laid out again while it plays in (its web font has come) goes on from where it was. Uses the browser's own animation of the SVG layer (no timer loop); on a canvas chart it fades the canvas in."
3755
+ },
3756
+ "interaction.brush": {
3757
+ "type": "object",
3758
+ "properties": {
3759
+ "type": {
3760
+ "type": "string",
3761
+ "const": "brush"
3762
+ },
3763
+ "scales": {
3764
+ "type": "array",
3765
+ "description": "Names of the scales to zoom. One horizontal scale selects a vertical band, one vertical scale a horizontal band, both a box.",
3766
+ "default": [
3767
+ "x"
3768
+ ]
3769
+ },
3770
+ "modifier": {
3771
+ "type": "string",
3772
+ "enum": [
3773
+ "shift",
3774
+ "alt",
3775
+ "ctrl",
3776
+ "none"
3777
+ ],
3778
+ "description": "Key that must be held to start a selection. With \"none\" every drag is a selection, so the pan of interaction.zoom never starts.",
3779
+ "default": "shift"
3780
+ },
3781
+ "fit": {
3782
+ "type": "array",
3783
+ "description": "Scales to refit to the selected window (usually [\"y\"])."
3784
+ },
3785
+ "minSize": {
3786
+ "type": "number",
3787
+ "description": "Smallest selection, in px, along each selected axis.",
3788
+ "default": 6
3789
+ }
3790
+ },
3791
+ "required": [
3792
+ "type"
3793
+ ],
3794
+ "additionalProperties": false,
3795
+ "description": "Drag a rectangle over the plot to zoom to it: on the scales in `scales` (default x) the view becomes the selected range, on a category (band) scale the categories under the selection. Shift + drag by default, so it does not fight with the pan of interaction.zoom; Escape cancels while dragging, double-click resets. A drag shorter than `minSize` px is not a selection."
3796
+ },
3797
+ "interaction.click": {
3798
+ "type": "object",
3799
+ "properties": {
3800
+ "type": {
3801
+ "type": "string",
3802
+ "const": "click"
3803
+ },
3804
+ "cursor": {
3805
+ "type": "boolean",
3806
+ "description": "A hand cursor over what can be clicked.",
3807
+ "default": true
3808
+ }
3809
+ },
3810
+ "required": [
3811
+ "type"
3812
+ ],
3813
+ "additionalProperties": false,
3814
+ "description": "Clicks on the data, for a script of the page: a click or a tap on a bar, a dot, a slice, a line sends a `bc-click` event from the chart's element. It bubbles, and `event.detail` has the row: `row`, `rows`, `values` (every column of the row), `mark`, `markIndex`, `x`, `y`, `table`, and the browser's own `event` (modifier keys). What it hits is what the tooltip shows there. A drag (a pan, a brush) is not a click, a double click sends one, and a legend item stays the legend filter's. A report made from JSON alone has no script to listen: this is for pages and apps with code of their own."
3815
+ },
3816
+ "interaction.crosshair": {
3817
+ "type": "object",
3818
+ "properties": {
3819
+ "type": {
3820
+ "type": "string",
3821
+ "const": "crosshair"
3822
+ },
3823
+ "snap": {
3824
+ "type": "string",
3825
+ "enum": [
3826
+ "lines",
3827
+ "all",
3828
+ "off"
3829
+ ],
3830
+ "description": "What the line jumps to: the nearest point of a line or area (\"lines\"), of any mark (\"all\"), or nothing (it follows the pointer).",
3831
+ "default": "lines"
3832
+ },
3833
+ "horizontal": {
3834
+ "type": "boolean",
3835
+ "description": "Also a horizontal line through the datum.",
3836
+ "default": false
3837
+ }
3838
+ },
3839
+ "required": [
3840
+ "type"
3841
+ ],
3842
+ "additionalProperties": false,
3843
+ "description": "A vertical line across the plot that follows the pointer, so the reader can read a date off several series at once. It snaps to the nearest datum of a line or area (or of every mark, with `snap: \"all\"`); `snap: \"off\"` follows the pointer freely. On a touch screen it follows a tap and the sliding finger, and stays until the reader touches somewhere else. Works with or without the tooltip."
3844
+ },
3845
+ "interaction.legend-filter": {
3846
+ "type": "object",
3847
+ "properties": {
3848
+ "type": {
3849
+ "type": "string",
3850
+ "const": "legend-filter"
3851
+ },
3852
+ "scale": {
3853
+ "type": "string",
3854
+ "description": "The color scale to filter. Default: the scale of the first legend. The name of a declared scale."
3855
+ },
3856
+ "legend": {
3857
+ "type": "string",
3858
+ "description": "The id of a legend outside the chart, in the page, shared by several charts. Its items are elements with `data-bc-legend-index`. The composer writes this for facets; there is no need to set it by hand."
3859
+ },
3860
+ "fit": {
3861
+ "type": "array",
3862
+ "description": "Scales to refit to the visible rows after a change (usually [\"y\"]); by default they keep their domain."
3863
+ }
3864
+ },
3865
+ "required": [
3866
+ "type"
3867
+ ],
3868
+ "additionalProperties": false,
3869
+ "description": "Click an item of a categorical legend to hide or show that category; double-click isolates it (double-click again shows everything). From the keyboard each item is a switch: Tab reaches it, Enter or Space hides or shows its category, Shift+Enter isolates it (on a canvas there are no items to reach). Hidden categories are drawn by no mark and stay in the legend, dimmed. The visible set is the view of the color scale, so it can also be set with setView. Hiding everything shows everything."
3870
+ },
3871
+ "interaction.tooltip": {
3872
+ "type": "object",
3873
+ "properties": {
3874
+ "type": {
3875
+ "type": "string",
3876
+ "const": "tooltip"
3877
+ },
3878
+ "fields": {
3879
+ "type": "array",
3880
+ "items": {
3881
+ "type": "string"
3882
+ },
3883
+ "description": "Fields to show. Default: the fields the mark reads (its channels and group)."
3884
+ },
3885
+ "formats": {
3886
+ "type": "object",
3887
+ "additionalProperties": {
3888
+ "$ref": "#/definitions/format"
3889
+ },
3890
+ "description": "How to write values, per field: { \"revenue\": { \"style\": \"currency\", \"currency\": \"USD\" }, \"share\": \"percent\", \"date\": \"date\" }. Each is a preset or an object of Intl options (see guide.axis `format`). Fields without one are written as they are (numbers to 6 significant digits)."
3891
+ },
3892
+ "labels": {
3893
+ "description": "What to call the fields, per field: { \"median\": \"Median, ms\", \"rev\": \"Revenue\" }. Fields without one are shown under the name their transform gives them (Q1, Count…) or their own."
3894
+ },
3895
+ "content": {
3896
+ "description": "Name of a function registered with BC.defineFn (or, in a spec built in JS, the function itself). It gets a TooltipDatum and returns what to show: a string (text), { html }, a DOM Node, an array of those, null/false to hide the tooltip, or undefined for the default content. { html } is set with innerHTML and is not escaped — build it from trusted strings, never straight from a row value the data may contain."
3897
+ },
3898
+ "heading": {
3899
+ "type": "string",
3900
+ "description": "The field at the head of the card. Default: the category or date the datum stands on. Give it when that is not what names the datum, as in a calendar, where x is the week and the row is a day. A field of the dataset."
3901
+ },
3902
+ "marker": {
3903
+ "type": "string",
3904
+ "enum": [
3905
+ "auto",
3906
+ "dot",
3907
+ "box",
3908
+ "none"
3909
+ ],
3910
+ "description": "\"dot\" draws a small circle at the point; \"box\" highlights the whole shape (used automatically for rect marks like bar/heatmap, where a dot would land on an edge); \"auto\" picks box when the mark reports its bounds and dot otherwise; \"none\" shows the tooltip text without a marker.",
3911
+ "default": "auto"
3912
+ }
3913
+ },
3914
+ "required": [
3915
+ "type"
3916
+ ],
3917
+ "additionalProperties": false,
3918
+ "description": "Shows the datum under the pointer: a marker plus a card with the fields behind it — the category or date as its heading, then one line per value. Every mark finds its own datum (MarkDef.pick); the closest one wins. The default content is written with textContent only; `content` replaces it with what a function returns. On a touch screen a tap shows the card and sliding the finger moves it along the data; it stays after the finger lifts, until the reader touches somewhere else. For a vertical line that follows the pointer, add interaction.crosshair. A value the row does not have (null, NaN) has no line. A field is shown under its name in `labels`, else under the name the transform that made it gives it (quartiles: Q1, Median…), else under its own; the composer warns about a name written like code (avg7, quarterTotal). A bar from x to x2 (or y to y2) on one number or time scale with no category to name it, a histogram's bin, is headed by its range (140–145). A shape that stands for several rows (a line through a total repeated on each row of its quarter) shows only the fields they share. The dot by the heading has the color of the first value on the card: the color of the shape under the pointer, or, when `fields` puts first a value only another mark draws, of that mark (the card of a bullet chart has its bar's color over the bands behind it)."
3919
+ },
3920
+ "interaction.zoom": {
3921
+ "type": "object",
3922
+ "properties": {
3923
+ "type": {
3924
+ "type": "string",
3925
+ "const": "zoom"
3926
+ },
3927
+ "scales": {
3928
+ "type": "array",
3929
+ "description": "Names of the scales to control.",
3930
+ "default": [
3931
+ "x"
3932
+ ]
3933
+ },
3934
+ "wheel": {
3935
+ "type": "string",
3936
+ "enum": [
3937
+ "ctrl",
3938
+ "always",
3939
+ "off"
3940
+ ],
3941
+ "description": "\"ctrl\": Ctrl/Cmd + wheel (and trackpad pinch) zooms, so the page still scrolls; \"always\": plain wheel zooms.",
3942
+ "default": "ctrl"
3943
+ },
3944
+ "fit": {
3945
+ "type": "array",
3946
+ "description": "Scales to auto-fit to the zoomed window (usually [\"y\"]): their domain is recomputed from the rows that are visible."
3947
+ },
3948
+ "pan": {
3949
+ "type": "boolean",
3950
+ "default": true
3951
+ },
3952
+ "maxZoom": {
3953
+ "type": "number",
3954
+ "description": "How far in you can go, as a multiple of the full domain.",
3955
+ "default": 50
3956
+ }
3957
+ },
3958
+ "required": [
3959
+ "type"
3960
+ ],
3961
+ "additionalProperties": false,
3962
+ "description": "Wheel zoom around the cursor, drag to pan, double-click to reset. A drag another interaction claims (interaction.brush, with its modifier held) is left to it. Works on continuous scales (linear, log, time; a log scale zooms by ratios) by changing their view through setView; the layout stays frozen."
3963
+ },
3964
+ "interaction.zoom-controls": {
3965
+ "type": "object",
3966
+ "properties": {
3967
+ "type": {
3968
+ "type": "string",
3969
+ "const": "zoom-controls"
3970
+ },
3971
+ "scales": {
3972
+ "type": "array",
3973
+ "description": "Names of the scales to control, the same as interaction.zoom and interaction.brush. Default [\"x\"] — set it to match whichever scales those use, so \"100%\" undoes everything they did.",
3974
+ "default": [
3975
+ "x"
3976
+ ]
3977
+ },
3978
+ "fit": {
3979
+ "type": "array",
3980
+ "description": "Scales to refit after a \"−\"/\"+\" click (usually [\"y\"]), the same as interaction.zoom's `fit`."
3981
+ },
3982
+ "step": {
3983
+ "type": "number",
3984
+ "description": "How much \"−\"/\"+\" grow or shrink a continuous scale's span, as a factor of the current span (0.5 = double/halve).",
3985
+ "default": 0.5
3986
+ },
3987
+ "maxZoom": {
3988
+ "type": "number",
3989
+ "description": "How far \"+\" can go, as a multiple of the full domain.",
3990
+ "default": 50
3991
+ },
3992
+ "titles": {
3993
+ "description": "What the buttons say to a mouse and to a screen reader, in the language of the page: { \"reset\": \"...\", \"out\": \"...\", \"in\": \"...\" }. Default English."
3994
+ },
3995
+ "corner": {
3996
+ "type": "string",
3997
+ "enum": [
3998
+ "top-right",
3999
+ "top-left",
4000
+ "bottom-right",
4001
+ "bottom-left"
4002
+ ],
4003
+ "description": "Which corner of the chart the buttons sit in.",
4004
+ "default": "top-right"
4005
+ }
4006
+ },
4007
+ "required": [
4008
+ "type"
4009
+ ],
4010
+ "additionalProperties": false,
4011
+ "description": "A small button bar over one corner of the chart: \"100%\" clears the controlled scales back to their full domain; \"−\"/\"+\" step a continuous one in and out around the center of its current view. A band scale only gets \"100%\" (there is nothing continuous to step)."
4012
+ },
4013
+ "channel": {
4014
+ "$comment": "A field name (on the scale named like the channel), { \"field\", \"scale\" }, or a constant { \"value\" }.",
4015
+ "anyOf": [
4016
+ {
4017
+ "type": "string"
4018
+ },
4019
+ {
4020
+ "type": "object",
4021
+ "required": [
4022
+ "field"
4023
+ ],
4024
+ "properties": {
4025
+ "field": {
4026
+ "type": "string",
4027
+ "description": "A field of the dataset."
4028
+ },
4029
+ "scale": {
4030
+ "type": "string",
4031
+ "description": "The name of a declared scale."
4032
+ }
4033
+ },
4034
+ "additionalProperties": false
4035
+ },
4036
+ {
4037
+ "type": "object",
4038
+ "required": [
4039
+ "value"
4040
+ ],
4041
+ "properties": {
4042
+ "value": {
4043
+ "anyOf": [
4044
+ {
4045
+ "type": "number"
4046
+ },
4047
+ {
4048
+ "type": "string"
4049
+ },
4050
+ {
4051
+ "type": "boolean"
4052
+ }
4053
+ ],
4054
+ "description": "The same value for every row."
4055
+ },
4056
+ "scale": {
4057
+ "type": "string",
4058
+ "description": "The name of a declared scale."
4059
+ }
4060
+ },
4061
+ "$comment": "A constant.",
4062
+ "additionalProperties": false
4063
+ }
4064
+ ]
4065
+ },
4066
+ "unscaledChannel": {
4067
+ "$comment": "A field name, { \"field\" }, or a constant { \"value\" }.",
4068
+ "anyOf": [
4069
+ {
4070
+ "type": "string"
4071
+ },
4072
+ {
4073
+ "type": "object",
4074
+ "required": [
4075
+ "field"
4076
+ ],
4077
+ "properties": {
4078
+ "field": {
4079
+ "type": "string",
4080
+ "description": "A field of the dataset."
4081
+ }
4082
+ },
4083
+ "additionalProperties": false
4084
+ },
4085
+ {
4086
+ "type": "object",
4087
+ "required": [
4088
+ "value"
4089
+ ],
4090
+ "properties": {
4091
+ "value": {
4092
+ "anyOf": [
4093
+ {
4094
+ "type": "number"
4095
+ },
4096
+ {
4097
+ "type": "string"
4098
+ },
4099
+ {
4100
+ "type": "boolean"
4101
+ }
4102
+ ],
4103
+ "description": "The same value for every row."
4104
+ }
4105
+ },
4106
+ "$comment": "A constant.",
4107
+ "additionalProperties": false
4108
+ }
4109
+ ]
4110
+ },
4111
+ "format": {
4112
+ "$comment": "How to write a number or a date: a preset, or Intl.NumberFormat / Intl.DateTimeFormat options.",
4113
+ "anyOf": [
4114
+ {
4115
+ "type": "string",
4116
+ "enum": [
4117
+ "percent",
4118
+ "compact",
4119
+ "integer",
4120
+ "year",
4121
+ "quarter",
4122
+ "month",
4123
+ "day",
4124
+ "date",
4125
+ "datetime"
4126
+ ]
4127
+ },
4128
+ {
4129
+ "type": "object",
4130
+ "properties": {
4131
+ "locale": {
4132
+ "type": "string",
4133
+ "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$",
4134
+ "description": "Default \"en-US\"."
4135
+ },
4136
+ "kind": {
4137
+ "type": "string",
4138
+ "enum": [
4139
+ "number",
4140
+ "date"
4141
+ ],
4142
+ "description": "Guessed from the options when left out."
4143
+ },
4144
+ "prefix": {
4145
+ "type": "string"
4146
+ },
4147
+ "suffix": {
4148
+ "type": "string"
4149
+ }
4150
+ }
4151
+ }
4152
+ ]
4153
+ }
4154
+ }
4155
+ }