-
Notifications
You must be signed in to change notification settings - Fork 0
/
scatter.vg.json
96 lines (95 loc) · 2.03 KB
/
scatter.vg.json
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
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Airplane fatalities",
"data": {
"url": "data/Airplane_Crashes_and_Fatalities.csv"
},
"transform": [
{"timeUnit": "year", "field": "Date", "as": "sum_fatalities"},
{"filter": {"field": "Fatalities", "valid": true}}
],
"width": 800,
"height": 600,
"layer": [
{
"mark": {
"type": "line",
"point": {
"fill": "crimson"
},
"strokeWidth": 1.5,
"color": "crimson",
"tooltip": true
},
"encoding": {
"x": {
"field": "sum_fatalities",
"type": "temporal",
"title": "Year",
"timeUnit": "year"
},
"y": {
"field": "Fatalities",
"type": "quantitative",
"title": "Fatalities",
"scale": {
"zero": false
},
"aggregate": "sum"
}
}
},
{
"mark": {
"type":"rect",
"opacity": 0.3
},
"data": {
"values": [
{
"start": "1939-09",
"end": "1945-09",
"Event": "WWII"
}
]
},
"encoding": {
"x": {
"field": "start",
"timeUnit": "yearmonth"
},
"x2": {
"field": "end",
"timeUnit": "yearmonth"
},
"color": {"field": "Event", "type": "nominal", "scale": {"range": ["purple", "lightblue"]}}
}
},
{
"mark": {
"type":"rect",
"opacity": 0.2
},
"data": {
"values": [
{
"start": "2001-06",
"end": "2001-12",
"Event": "9/11/2001"
}
]
},
"encoding": {
"x": {
"field": "start",
"timeUnit": "yearmonth"
},
"x2": {
"field": "end",
"timeUnit": "yearmonth"
},
"color": {"field": "Event", "type": "nominal", "scale": {"range": ["purple", "lightblue"]}}
}
}
]
}