-
Notifications
You must be signed in to change notification settings - Fork 0
/
Map.json
152 lines (152 loc) · 5.19 KB
/
Map.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
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
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"autosize": {"resize": true},
"data": {
"url": "https://raw.githubusercontent.com/FIT3179/Vega-Lite/main/3_choropleth_map/js/ne_110m_admin_0_countries.topojson",
"format": {"type": "topojson", "feature": "ne_110m_admin_0_countries"}
},
"vconcat": [
{
"title": "Life Expectancy World Bank",
"width": 800,
"height": 400,
"projection": {"type": "equalEarth"},
"layer": [
{
"transform": [
{
"calculate": "'Data is not available in ' + datum.properties.NAME",
"as": "note"
}
],
"mark": {"type": "geoshape", "fill": "lightgray", "stroke": "white"},
"encoding": {"tooltip": {"field": "note"}}
},
{
"data": {
"url": "https://raw.githubusercontent.com/FIT3179/Vega-Lite/main/7_others/oceans.topojson",
"format": {"type": "topojson", "feature": "oceans"}
},
"mark": {"type": "geoshape", "fill": "white"}
},
{
"data": {
"url": "https://raw.githubusercontent.com/FIT3179/Vega-Lite/main/2_symbol_map/js/WorldMapWithGraticules.topojson",
"format": {"type": "topojson", "feature": "ne_110m_graticules_30"}
},
"mark": {"type": "geoshape", "fill": null, "stroke": "lightgray"}
},
{
"transform": [
{
"lookup": "properties.NAME",
"from": {
"data": {
"url": "https://raw.githubusercontent.com/sz0314/life_expansion/main/averaged_features_by_country.csv"
},
"key": "Country Name",
"fields": ["Life_Expectancy"]
}
}
],
"mark": {"type": "geoshape", "stroke": "white"},
"params": [{"name": "countrySelection", "select": {"type": "point"}}],
"encoding": {
"color": {
"field": "Life_Expectancy",
"type": "quantitative",
"scale": {
"type": "threshold",
"domain": [50, 60, 70, 80, 90],
"range": ["#f0f9e8", "#ccebc5", "#a8ddb5", "#7bccc4", "#4eb3d3"]
}
},
"tooltip": [
{
"field": "properties.NAME",
"type": "nominal",
"title": "Country"
},
{
"field": "Life_Expectancy",
"type": "quantitative",
"format": ".0f"
}
]
}
},
{
"transform": [
{
"lookup": "properties.NAME",
"from": {
"data": {
"url": "https://raw.githubusercontent.com/FIT3179/Vega-Lite/main/3_choropleth_map/data/countryInfo.csv"
},
"key": "name",
"fields": ["latitude", "longitude"]
}
}
],
"mark": {"type": "text"},
"encoding": {
"longitude": {"field": "longitude", "type": "quantitative"},
"latitude": {"field": "latitude", "type": "quantitative"},
"text": {"field": "properties.NAME", "type": "nominal"},
"opacity": {
"condition": {
"test": "datum['properties.NAME'] == 'Sweden' || datum['properties.NAME'] == 'Japan' || datum['properties.NAME'] == 'Australia' || datum['properties.NAME'] == 'Switzerland' || datum['properties.NAME'] == 'Iceland' || datum['properties.NAME'] == 'Israel'|| datum['properties.NAME'] == 'Spain'|| datum['properties.NAME'] == 'Italy'|| datum['properties.NAME'] == 'Singapore' || (datum.latitude == 46.227638 && datum.longitude == 1.8213749)",
"value": 1
},
"value": 0
}
}
},
{
"data": {
"values": [
{
"latitude": 46.227638,
"longitude": -15.8213749,
"text": "France"
}
]
},
"mark": {"type": "text", "fontSize": 10},
"encoding": {
"longitude": {"field": "longitude", "type": "quantitative"},
"latitude": {"field": "latitude", "type": "quantitative"},
"text": {"field": "text", "type": "nominal"},
"opacity": {"value": 1}
}
}
]
},
{
"width": 700,
"transform": [
{
"lookup": "properties.NAME",
"from": {
"data": {
"url": "https://raw.githubusercontent.com/sz0314/life_expansion/main/averaged_features_by_country.csv"
},
"key": "Country",
"fields": ["Life_Expectancy"]
}
},
{"filter": {"param": "countrySelection", "empty": false}}
],
"mark": {"type": "bar"},
"encoding": {
"x": {
"field": "Life_Expectancy",
"type": "quantitative",
"title": "Life Expectancy Top 10 Countries"
},
"y": {"field": "properties.NAME", "type": "nominal", "title": null}
}
}
],
"config": {}
}