chartlet 0.3.0

Compile structured data into deterministic, accessible static charts
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://casoon.github.io/chartlet/schema/v1.json",
  "title": "chartlet v1 specification",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "type", "title"],
  "properties": {
    "schemaVersion": { "const": 1 },
    "type": {
      "enum": ["bar", "line", "time", "topicmap", "atlas", "stripes", "calendar", "rangebar", "multiples"]
    },
    "orientation": { "enum": ["vertical", "horizontal"], "default": "vertical" },
    "title": { "type": "string", "minLength": 1, "maxLength": 200 },
    "description": { "type": "string", "minLength": 1, "maxLength": 1000 },
    "source": { "type": "string", "minLength": 1, "maxLength": 300 },
    "theme": { "enum": ["light", "dark"], "default": "light" },
    "locale": {
      "description": "Language of the texts chartlet generates (description, legend additions, tooltips, HTML figure and table) and of the number format.",
      "enum": ["en", "de"],
      "default": "en"
    },
    "categoryAxis": { "$ref": "#/$defs/categoryAxis" },
    "valueAxis": { "$ref": "#/$defs/valueAxis" },
    "timeAxis": { "$ref": "#/$defs/timeAxis" },
    "panes": {
      "description": "Time charts are drawn from 1 to 4 panes stacked on one time axis, small multiples from 2 to 12 titled panes.",
      "type": "array",
      "minItems": 1,
      "maxItems": 12,
      "items": { "$ref": "#/$defs/pane" }
    },
    "columns": {
      "description": "Grid columns of a type: \"multiples\" chart; defaults to up to three.",
      "type": "integer",
      "minimum": 1,
      "maximum": 6
    },
    "stripes": {
      "description": "The yearly values of a type: \"stripes\" chart.",
      "$ref": "#/$defs/stripes"
    },
    "calendar": {
      "description": "The daily values of a type: \"calendar\" chart.",
      "$ref": "#/$defs/calendar"
    },
    "sparkline": {
      "description": "type: \"time\" only: draw only the lines and areas of one pane, without axes, title or legend, at 60–600 × 16–200 pixels.",
      "type": "boolean",
      "default": false
    },
    "tooltips": {
      "description": "type: \"time\" only: \"observations\" (default) gives every observation a tooltip while observations stand at least 4 pixels apart, on an invisible target where no marker is drawn; \"markers\" gives tooltips only to drawn markers, which keeps dense lines small.",
      "enum": ["observations", "markers"],
      "default": "observations"
    },
    "legend": {
      "description": "type: \"time\" only: top (default) names the series in a legend above the plot; end names each line at its last observation, right of the plot.",
      "enum": ["top", "end"],
      "default": "top"
    },
    "independentAxes": {
      "description": "type: \"multiples\" only: every panel gets its own value axis instead of one shared one.",
      "type": "boolean",
      "default": false
    },
    "patterns": {
      "description": "type: \"bar\" with series: draw every other series as an outline, so that series differ in form as well as in color.",
      "type": "boolean",
      "default": false
    },
    "stack": {
      "description": "Stacks the series of a type: \"bar\" chart: \"normal\" by value, \"percent\" as shares of each category's total.",
      "enum": ["normal", "percent"]
    },
    "references": {
      "description": "Reference lines across a type: \"bar\" chart, such as an average or a target.",
      "type": "array",
      "maxItems": 4,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["value", "label"],
        "properties": {
          "value": { "type": "number" },
          "label": { "type": "string", "minLength": 1, "maxLength": 60 }
        }
      }
    },
    "ranges": {
      "description": "The spans of a type: \"rangebar\" chart, one per category.",
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "items": { "$ref": "#/$defs/range" }
    },
    "topicmap": {
      "description": "Topic areas of a type: \"topicmap\" chart.",
      "$ref": "#/$defs/topicMap"
    },
    "atlas": {
      "description": "The knowledge landscape of a type: \"atlas\" chart.",
      "$ref": "#/$defs/atlas"
    },
    "width": { "type": "integer", "minimum": 320, "maximum": 2400, "default": 800 },
    "height": { "type": "integer", "minimum": 240, "maximum": 1600, "default": 450 },
    "mobile": {
      "description": "A second layout for narrow containers. The HTML profile shows it below the breakpoint by a container query; the SVG profile renders it with the variant option.",
      "type": "object",
      "additionalProperties": false,
      "required": ["width"],
      "properties": {
        "width": { "type": "integer", "minimum": 280, "maximum": 600 },
        "height": { "type": "integer", "minimum": 240, "maximum": 1600, "default": 360 },
        "breakpoint": {
          "description": "Container width in CSS pixels below which the mobile variant is shown.",
          "type": "integer",
          "minimum": 320,
          "maximum": 1600,
          "default": 640
        },
        "columns": {
          "description": "type: \"multiples\" only: grid columns of the mobile variant.",
          "type": "integer",
          "minimum": 1,
          "maximum": 6
        }
      }
    },
    "showValues": { "type": "boolean", "default": true },
    "showTitle": {
      "description": "false leaves the drawn title out of the SVG profile and gives its space to the chart; the title stays the accessible name. The HTML profile never draws the title: its figcaption is the visible title.",
      "type": "boolean",
      "default": true
    },
    "data": {
      "description": "Single-series data. Use either data or categories with series.",
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["label", "value"],
        "properties": {
          "label": { "type": "string", "minLength": 1, "maxLength": 200 },
          "value": { "$ref": "#/$defs/value" }
        }
      }
    },
    "categories": {
      "description": "Unique category labels shared by all series.",
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "uniqueItems": true,
      "items": { "type": "string", "minLength": 1, "maxLength": 200 }
    },
    "series": {
      "description": "Named series with one value per category; null marks a missing value.",
      "type": "array",
      "minItems": 1,
      "maxItems": 4,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["name", "values"],
        "properties": {
          "name": { "type": "string", "minLength": 1, "maxLength": 100 },
          "values": { "type": "array", "items": { "$ref": "#/$defs/value" } }
        }
      }
    },
    "zoomSteps": {
      "description": "Optional pre-computed zoom variants, selectable in the HTML profile. A bar or line chart names categories by index, a time chart names a window by timestamps.",
      "type": "array",
      "minItems": 2,
      "maxItems": 4,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["label", "from", "to"],
        "properties": {
          "label": { "type": "string", "minLength": 1, "maxLength": 40 },
          "from": {
            "description": "First category index, or on a time chart the first timestamp of the window.",
            "anyOf": [{ "type": "integer", "minimum": 0 }, { "$ref": "#/$defs/timeValue" }]
          },
          "to": {
            "description": "Last category index, or on a time chart the last timestamp of the window.",
            "anyOf": [{ "type": "integer", "minimum": 0 }, { "$ref": "#/$defs/timeValue" }]
          }
        }
      }
    }
  },
  "allOf": [
    {
      "oneOf": [
        {
          "required": ["data"],
          "not": { "anyOf": [{ "required": ["categories"] }, { "required": ["series"] }] }
        },
        {
          "required": ["categories", "series"],
          "not": { "required": ["data"] }
        },
        {
          "required": ["panes"],
          "not": {
            "anyOf": [
              { "required": ["data"] },
              { "required": ["categories"] },
              { "required": ["series"] }
            ]
          }
        },
        {
          "required": ["topicmap"],
          "not": {
            "anyOf": [
              { "required": ["data"] },
              { "required": ["categories"] },
              { "required": ["series"] },
              { "required": ["panes"] }
            ]
          }
        },
        {
          "required": ["atlas"],
          "not": {
            "anyOf": [
              { "required": ["data"] },
              { "required": ["categories"] },
              { "required": ["series"] },
              { "required": ["panes"] }
            ]
          }
        },
        {
          "required": ["stripes"],
          "not": {
            "anyOf": [
              { "required": ["data"] },
              { "required": ["categories"] },
              { "required": ["series"] },
              { "required": ["panes"] }
            ]
          }
        },
        {
          "required": ["calendar"],
          "not": {
            "anyOf": [
              { "required": ["data"] },
              { "required": ["categories"] },
              { "required": ["series"] },
              { "required": ["panes"] }
            ]
          }
        },
        {
          "required": ["ranges"],
          "not": {
            "anyOf": [
              { "required": ["data"] },
              { "required": ["categories"] },
              { "required": ["series"] },
              { "required": ["panes"] }
            ]
          }
        }
      ]
    },
    {
      "if": { "properties": { "type": { "const": "stripes" } } },
      "then": { "required": ["stripes"] },
      "else": { "not": { "required": ["stripes"] } }
    },
    {
      "if": { "properties": { "type": { "const": "calendar" } } },
      "then": { "required": ["calendar"] },
      "else": { "not": { "required": ["calendar"] } }
    },
    {
      "if": { "properties": { "type": { "const": "rangebar" } } },
      "then": { "required": ["ranges"] },
      "else": { "not": { "required": ["ranges"] } }
    },
    {
      "if": { "properties": { "type": { "const": "multiples" } } },
      "then": {
        "required": ["panes"],
        "properties": { "panes": { "minItems": 2 } },
        "not": {
          "anyOf": [
            { "required": ["orientation"] },
            { "required": ["categoryAxis"] },
            { "required": ["zoomSteps"] },
            { "required": ["topicmap"] },
            { "required": ["atlas"] }
          ]
        }
      },
      "else": { "not": { "required": ["columns"] } }
    },
    {
      "if": { "properties": { "type": { "const": "line" } } },
      "then": { "not": { "anyOf": [{ "required": ["orientation"] }, { "required": ["series"] }] } }
    },
    {
      "if": { "properties": { "type": { "const": "time" } } },
      "then": {
        "required": ["panes"],
        "properties": { "panes": { "maxItems": 4 } },
        "not": {
          "anyOf": [
            { "required": ["orientation"] },
            { "required": ["categoryAxis"] },
            { "required": ["valueAxis"] },
            { "required": ["topicmap"] }
          ]
        }
      }
    },
    {
      "if": { "properties": { "type": { "enum": ["bar", "line"] } } },
      "then": {
        "properties": {
          "zoomSteps": {
            "items": {
              "properties": {
                "from": { "type": "integer", "minimum": 0 },
                "to": { "type": "integer", "minimum": 0 }
              }
            }
          }
        },
        "not": {
          "anyOf": [
            { "required": ["panes"] },
            { "required": ["timeAxis"] },
            { "required": ["topicmap"] }
          ]
        }
      }
    },
    {
      "if": { "properties": { "type": { "const": "topicmap" } } },
      "then": {
        "required": ["topicmap"],
        "not": {
          "anyOf": [
            { "required": ["data"] },
            { "required": ["categories"] },
            { "required": ["series"] },
            { "required": ["zoomSteps"] },
            { "required": ["panes"] },
            { "required": ["orientation"] },
            { "required": ["categoryAxis"] },
            { "required": ["valueAxis"] },
            { "required": ["timeAxis"] }
          ]
        }
      }
    }
  ],
  "$defs": {
    "value": {
      "anyOf": [
        { "type": "null" },
        { "const": 0 },
        { "type": "number", "minimum": 1e-100, "maximum": 1e100 },
        { "type": "number", "minimum": -1e100, "maximum": -1e-100 }
      ]
    },
    "categoryAxis": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "title": { "type": "string", "minLength": 1, "maxLength": 100 }
      }
    },
    "valueAxis": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "title": { "type": "string", "minLength": 1, "maxLength": 100 },
        "format": { "enum": ["number", "percent"], "default": "number" },
        "decimals": {
          "description": "Fixed decimal places for values in labels, tooltips, description and data table; axis ticks follow the tick step.",
          "type": "integer",
          "minimum": 0,
          "maximum": 6
        },
        "min": {
          "description": "The axis reaches at least down to this value. Ends are rounded outward to a tick; bars always start at zero.",
          "type": "number"
        },
        "max": {
          "description": "The axis reaches at least up to this value.",
          "type": "number"
        },
        "scale": {
          "description": "linear (default) or log: powers of ten evenly spaced; every value must be above zero.",
          "enum": ["linear", "log"],
          "default": "linear"
        },
        "step": {
          "description": "Distance between two ticks, instead of a round step chosen from the values.",
          "type": "number",
          "exclusiveMinimum": 0
        },
        "exact": {
          "description": "min and max are the ends of the axis; every value has to lie between them.",
          "type": "boolean",
          "default": false
        },
        "reverse": {
          "description": "Run the axis the other way: larger values down or left.",
          "type": "boolean",
          "default": false
        },
        "thousandsSeparator": {
          "description": "Separate thousands in every written value: 12,500 (en) or 12.500 (de).",
          "type": "boolean",
          "default": false
        }
      }
    },
    "timeAxis": {
      "description": "The time axis of a type: \"time\" chart: Unix seconds or ISO 8601 timestamps.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "timezone": {
          "description": "UTC or a fixed offset such as +02:00. Timestamps without their own offset are read as wall-clock time in this zone.",
          "type": "string",
          "pattern": "^(UTC|utc|Z|[+-](0[0-9]|1[0-4]):[0-5][0-9])$",
          "default": "UTC"
        },
        "gaps": {
          "description": "show keeps the distances in time; collapse places every observed timestamp at the same distance from the next, so days without observations (weekends, holidays) take no space.",
          "enum": ["show", "collapse"],
          "default": "show"
        },
        "title": { "type": "string", "minLength": 1, "maxLength": 100 },
        "precision": {
          "description": "How finely tooltips, the data table and the description name an observation; absent, the coarsest form that tells the observations apart.",
          "enum": ["year", "month", "day", "minute"]
        },
        "kind": {
          "description": "calendar (default): timestamps. number: every time is a plain number, such as a distance or an age in millions of years.",
          "enum": ["calendar", "number"],
          "default": "calendar"
        },
        "reverse": {
          "description": "Run the axis from right to left, the largest position at the left.",
          "type": "boolean",
          "default": false
        }
      }
    },
    "timeValue": {
      "description": "Unix seconds between 1700-01-01 and 2200-01-01, an ISO 8601 date such as 2026-03-01 or 2026-03-01T12:00:00Z, or a year such as 1850 (January 1st).",
      "anyOf": [
        { "type": "integer", "minimum": -8520336000, "maximum": 7258118399 },
        { "type": "string", "pattern": "^[0-9]{4}$" },
        { "type": "string", "minLength": 10, "maxLength": 25 }
      ]
    },
    "stripes": {
      "description": "Warming stripes: one value per consecutive year from firstYear on; null leaves a year empty. The diverging scale has eight equal steps on either side of reference; min and max default to the largest distance from reference, and values beyond them take the outermost step.",
      "type": "object",
      "additionalProperties": false,
      "required": ["firstYear", "values"],
      "properties": {
        "firstYear": { "type": "integer", "minimum": 1, "maximum": 9999 },
        "values": {
          "type": "array",
          "minItems": 1,
          "maxItems": 500,
          "items": { "$ref": "#/$defs/value" }
        },
        "reference": { "type": "number", "default": 0 },
        "min": { "type": "number" },
        "max": { "type": "number" },
        "yearLabels": {
          "description": "Label the first and the last year under the stripes.",
          "type": "boolean",
          "default": true
        },
        "stretch": {
          "description": "The stripes alone, filling the canvas without margins, title or year labels, in an SVG that stretches to the box the page gives it.",
          "type": "boolean",
          "default": false
        }
      }
    },
    "calendar": {
      "description": "A calendar heatmap of one year. A day that is absent or null stays an empty cell. reference, min and max work as for stripes.",
      "type": "object",
      "additionalProperties": false,
      "required": ["year", "days"],
      "properties": {
        "year": { "type": "integer", "minimum": 1700, "maximum": 2199 },
        "layout": {
          "description": "months: twelve rows of up to 31 days; weeks: seven weekday rows, one column per week.",
          "enum": ["months", "weeks"],
          "default": "months"
        },
        "days": {
          "type": "array",
          "minItems": 1,
          "maxItems": 366,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["date", "value"],
            "properties": {
              "date": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" },
              "value": { "$ref": "#/$defs/value" }
            }
          }
        },
        "reference": { "type": "number", "default": 0 },
        "min": { "type": "number" },
        "max": { "type": "number" }
      }
    },
    "range": {
      "description": "One span of a rangebar chart; mid must lie between low and high.",
      "type": "object",
      "additionalProperties": false,
      "required": ["label", "low", "high"],
      "properties": {
        "label": { "type": "string", "minLength": 1, "maxLength": 200 },
        "low": { "type": "number" },
        "high": { "type": "number" },
        "mid": { "type": "number" },
        "modeled": { "type": "boolean", "default": false },
        "group": {
          "description": "The group of the span, drawn in its own palette color with a legend entry. Either every range names a group or none does; at most 4 groups.",
          "type": "string",
          "minLength": 1,
          "maxLength": 60
        }
      }
    },
    "pane": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "title": {
          "description": "Heading of a small-multiples panel; required there, not allowed in a time chart, whose panes are named by their valueAxis title.",
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "heightRatio": {
          "description": "Time charts: the pane's share of the plot height against the other panes. Small multiples keep the default.",
          "type": "integer",
          "minimum": 1,
          "maximum": 10,
          "default": 1
        },
        "valueAxis": { "$ref": "#/$defs/valueAxis" },
        "stack": {
          "description": "Time charts: \"normal\" stacks the pane's area layers in layer order, each on top of the ones before it. At least two area layers with the same times and curve, a value of zero or more at every time, no lower/upper band.",
          "const": "normal"
        },
        "layers": {
          "description": "Up to 6 data layers (8 in a stacked pane) — on a time chart at most 4 line and area layers of the whole chart without their own color — and up to 6 annotation layers (zones, reference lines and point markers together).",
          "type": "array",
          "minItems": 1,
          "maxItems": 14,
          "items": { "$ref": "#/$defs/layer" }
        }
      }
    },
    "layer": {
      "description": "One layer of a pane. Which fields apply depends on mark.",
      "type": "object",
      "additionalProperties": false,
      "required": ["mark"],
      "properties": {
        "mark": {
          "description": "line and area draw data; ohlc draws candlesticks (time charts only); band is a zone; annotation is a reference line or, with both time and value, a point marker.",
          "enum": ["line", "area", "point", "ohlc", "band", "annotation"]
        },
        "name": { "type": "string", "minLength": 1, "maxLength": 100 },
        "color": {
          "description": "#rgb, #rrggbb, #rrggbbaa, var(--name) or var(--name, #hex); the print variant draws the hex fallback. Anything else is reported and replaced by the neutral tone.",
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "points": {
          "description": "Observations of a line or area layer.",
          "type": "array",
          "minItems": 1,
          "maxItems": 2000,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["time", "value"],
            "properties": {
              "time": { "$ref": "#/$defs/timeValue" },
              "value": {
                "description": "null marks a missing observation: the line, its area and its band break there.",
                "$ref": "#/$defs/value"
              },
              "lower": {
                "description": "Lower edge of the uncertainty band; give lower and upper on every point of a layer that has a value, or on none. A point whose value is null has no band.",
                "type": "number"
              },
              "upper": { "description": "Upper edge of the uncertainty band.", "type": "number" }
            }
          }
        },
        "data": {
          "description": "Candlesticks of an ohlc layer, with increasing time; low at or below open and close, high at or above them.",
          "type": "array",
          "minItems": 2,
          "maxItems": 2000,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["time", "open", "high", "low", "close"],
            "properties": {
              "time": { "$ref": "#/$defs/timeValue" },
              "open": { "type": "number" },
              "high": { "type": "number" },
              "low": { "type": "number" },
              "close": { "type": "number" }
            }
          }
        },
        "from": {
          "description": "Start of a zone; missing, the zone begins at the plot's left edge.",
          "$ref": "#/$defs/timeValue"
        },
        "to": {
          "description": "End of a zone, after from; missing, the zone ends at the plot's right edge.",
          "$ref": "#/$defs/timeValue"
        },
        "top": {
          "description": "Upper edge of a zone, above bottom; missing, the zone reaches the top of the plot.",
          "type": "number"
        },
        "bottom": {
          "description": "Lower edge of a zone; missing, the zone reaches the bottom of the plot.",
          "type": "number"
        },
        "time": {
          "description": "Time of a vertical reference line or of a point marker.",
          "$ref": "#/$defs/timeValue"
        },
        "value": {
          "description": "Value of a horizontal reference line or of a point marker.",
          "type": "number"
        },
        "label": {
          "description": "Text of a reference line, point marker or zone; required there.",
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "shape": {
          "description": "Symbol of a point marker; circle by default. Only a point marker takes one.",
          "enum": ["triangle-up", "triangle-down", "square", "circle", "diamond"]
        },
        "modeled": {
          "description": "A line from a model: drawn dashed unless dash says otherwise, its band hatched, and named modeled in legend and description.",
          "type": "boolean",
          "default": false
        },
        "stroke": {
          "description": "Line weight; thin sets a line back, for example single years under their mean, bold brings one forward.",
          "enum": ["regular", "thin", "bold"],
          "default": "regular"
        },
        "dash": {
          "description": "Line pattern. Defaults to dashed for a modeled line and solid for any other.",
          "enum": ["solid", "dashed", "dotted"]
        },
        "curve": {
          "description": "Line and area only: linear (default) joins observations directly; step holds each value until the next observation.",
          "enum": ["linear", "step"],
          "default": "linear"
        },
        "precision": {
          "description": "Data layers on a calendar axis: how this layer's times are written in tooltips, the table and the description; overrides timeAxis.precision.",
          "enum": ["year", "month", "day", "minute"]
        },
        "markers": {
          "description": "Line and area only: false draws no markers, such as for a fitted line; tooltips stay on invisible targets.",
          "type": "boolean"
        }
      },
      "allOf": [
        {
          "if": { "properties": { "mark": { "enum": ["line", "area", "point"] } }, "required": ["mark"] },
          "then": {
            "required": ["points"],
            "not": {
              "anyOf": [
                { "required": ["data"] },
                { "required": ["from"] },
                { "required": ["to"] },
                { "required": ["top"] },
                { "required": ["bottom"] },
                { "required": ["time"] },
                { "required": ["value"] },
                { "required": ["label"] },
                { "required": ["shape"] }
              ]
            }
          }
        },
        {
          "if": { "properties": { "mark": { "const": "ohlc" } }, "required": ["mark"] },
          "then": {
            "description": "Candlesticks: rising candles are hollow, falling ones filled, in --chartlet-rise and --chartlet-fall.",
            "required": ["data"],
            "not": {
              "anyOf": [
                { "required": ["points"] },
                { "required": ["color"] },
                { "required": ["from"] },
                { "required": ["to"] },
                { "required": ["top"] },
                { "required": ["bottom"] },
                { "required": ["time"] },
                { "required": ["value"] },
                { "required": ["label"] },
                { "required": ["shape"] },
                { "required": ["modeled"] },
                { "required": ["stroke"] },
                { "required": ["dash"] }
              ]
            }
          }
        },
        {
          "if": { "properties": { "mark": { "const": "annotation" } }, "required": ["mark"] },
          "then": {
            "description": "A reference line: value draws a horizontal one, time a vertical one; both draw a point marker, which alone takes a shape. label is required.",
            "required": ["label"],
            "anyOf": [{ "required": ["value"] }, { "required": ["time"] }],
            "if": { "not": { "required": ["time", "value"] } },
            "then": { "not": { "required": ["shape"] } },
            "not": {
              "anyOf": [
                { "required": ["name"] },
                { "required": ["points"] },
                { "required": ["data"] },
                { "required": ["from"] },
                { "required": ["to"] },
                { "required": ["top"] },
                { "required": ["bottom"] },
                { "required": ["modeled"] },
                { "required": ["stroke"] },
                { "required": ["dash"] }
              ]
            }
          }
        },
        {
          "if": { "properties": { "mark": { "const": "band" } }, "required": ["mark"] },
          "then": {
            "description": "A zone between bottom and top, from and to, or both; a missing edge is the plot's edge. label is required.",
            "required": ["label"],
            "anyOf": [{ "required": ["bottom", "top"] }, { "required": ["from", "to"] }],
            "not": {
              "anyOf": [
                { "required": ["name"] },
                { "required": ["points"] },
                { "required": ["data"] },
                { "required": ["time"] },
                { "required": ["value"] },
                { "required": ["shape"] },
                { "required": ["modeled"] },
                { "required": ["stroke"] },
                { "required": ["dash"] }
              ]
            }
          }
        }
      ]
    },
    "topic": {
      "description": "One topic or island of a type: \"topicmap\" chart.",
      "type": "object",
      "additionalProperties": false,
      "required": ["label", "value"],
      "properties": {
        "label": { "type": "string", "minLength": 1, "maxLength": 200 },
        "value": { "type": "number", "minimum": 1, "maximum": 1e100 },
        "points": {
          "description": "Number of paths through this topic; drawn as points inside its area.",
          "type": "integer",
          "minimum": 0,
          "default": 0
        },
        "tooltip": { "type": "string", "minLength": 1, "maxLength": 300 }
      }
    },
    "topicLink": {
      "description": "A neighborhood between two topics or islands, drawn as a route.",
      "type": "object",
      "additionalProperties": false,
      "required": ["from", "to"],
      "properties": {
        "from": { "type": "string", "minLength": 1 },
        "to": { "type": "string", "minLength": 1 },
        "weight": { "type": "number", "minimum": 0, "maximum": 1, "default": 1 }
      }
    },
    "cartouche": {
      "description": "The legend box printed on the map.",
      "type": "object",
      "additionalProperties": false,
      "required": ["heading", "meta"],
      "properties": {
        "heading": { "type": "string", "minLength": 1, "maxLength": 100 },
        "meta": { "type": "string", "minLength": 1, "maxLength": 200 },
        "corner": {
          "enum": ["bottomRight", "bottomLeft", "topRight", "topLeft"],
          "default": "bottomRight"
        }
      }
    },
    "atlas": {
      "description": "Realms of neighbouring regions, holding places. Where a region lies says as much as how large it is.",
      "type": "object",
      "additionalProperties": false,
      "required": ["realms"],
      "properties": {
        "realms": {
          "type": "array",
          "minItems": 1,
          "maxItems": 8,
          "items": { "$ref": "#/$defs/realm" }
        },
        "links": {
          "description": "Kinship between two regions, named by label and valid across realm borders.",
          "type": "array",
          "items": { "$ref": "#/$defs/topicLink" }
        },
        "seed": { "type": "integer", "minimum": 0, "default": 0 },
        "areaDamping": {
          "description": "The exponent a region's area follows: 1 is proportional to its value, 0.5 its square root.",
          "type": "number",
          "minimum": 0.2,
          "maximum": 1,
          "default": 0.5
        },
        "contours": {
          "description": "Contour lines from the density of places.",
          "type": "boolean",
          "default": true
        }
      }
    },
    "realm": {
      "type": "object",
      "additionalProperties": false,
      "required": ["label", "regions"],
      "properties": {
        "label": { "type": "string", "minLength": 1, "maxLength": 200 },
        "regions": {
          "type": "array",
          "minItems": 1,
          "items": { "$ref": "#/$defs/region" }
        },
        "tooltip": { "type": "string", "minLength": 1, "maxLength": 300 }
      }
    },
    "region": {
      "type": "object",
      "additionalProperties": false,
      "required": ["label", "value"],
      "properties": {
        "label": { "type": "string", "minLength": 1, "maxLength": 200 },
        "value": { "type": "number", "minimum": 1 },
        "places": {
          "type": "array",
          "items": { "$ref": "#/$defs/place" }
        },
        "tooltip": { "type": "string", "minLength": 1, "maxLength": 300 }
      }
    },
    "place": {
      "type": "object",
      "additionalProperties": false,
      "required": ["label"],
      "properties": {
        "label": { "type": "string", "minLength": 1, "maxLength": 200 },
        "weight": {
          "description": "How prominent the point is. 1 is an ordinary place.",
          "type": "number",
          "minimum": 0.25,
          "maximum": 4,
          "default": 1
        },
        "tooltip": { "type": "string", "minLength": 1, "maxLength": 300 }
      }
    },
    "topicMap": {
      "type": "object",
      "additionalProperties": false,
      "required": ["topics"],
      "properties": {
        "topics": {
          "type": "array",
          "minItems": 1,
          "maxItems": 40,
          "items": { "$ref": "#/$defs/topic" }
        },
        "links": {
          "type": "array",
          "items": { "$ref": "#/$defs/topicLink" }
        },
        "islands": {
          "description": "Fringe topics, drawn as small fixed-size islands rather than area-proportional landmasses.",
          "type": "array",
          "maxItems": 6,
          "items": { "$ref": "#/$defs/topic" }
        },
        "seed": { "type": "integer", "minimum": 0, "default": 0 },
        "cartouche": { "$ref": "#/$defs/cartouche" },
        "graticule": { "type": "boolean", "default": true },
        "compass": { "type": "boolean", "default": true },
        "depthBands": {
          "description": "Number of depth-line rings drawn around each coastline.",
          "type": "integer",
          "minimum": 0,
          "maximum": 3,
          "default": 2
        }
      }
    }
  }
}