-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcontributions.html
189 lines (174 loc) · 6.19 KB
/
contributions.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Contributions</title>
<link href="https://fonts.googleapis.com/css?family=Hind+Siliguri&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed&display=swap" rel="stylesheet">
<link rel="shortcut icon" href="assets/img/nglogo.png" type="image/x-icon">
<link href="css/globe_master.css" rel="stylesheet">
<link href="css/perfect-scrollbar.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Buenard|Lustria|Vollkorn&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
/* SVG styling */
html {
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-weight: 400;
}
@-moz-document url-prefix() {
body {
font-weight: lighter !important;
}
}
div#world{
width: calc(100% - 300px);
left:200px;
position: absolute;
}
.cartogram-tooltip {
max-width: 500px !important;
font-family: 'Roboto Condensed', sans-serif !important;
font-size:14px !important;
}
a.back{
margin-left:10px;
margin-top:5px;
font-size:20px;
font-weight:normal;
position:absolute;
color:white;
letter-spacing: 1px;
}
a.back:hover{
cursor:pointer;
color:lightgray;
text-decoration:none;
}
a.home{
text-align:center;
margin-top:5px;
font-size:20px;
font-weight:bold;
position:absolute;
color:white;
font-variant: small-caps;
left:3%;
text-decoration:none;
}
a.home:hover{
cursor:pointer;
color:lightgray;
text-decoration:none;
}
a.github{
text-align:center;
margin-top:5px;
font-size:20px;
font-weight:bold;
position:absolute;
color:white;
font-variant: small-caps;
right:1%;
text-decoration:none;
}
a.github:hover{
cursor:pointer;
color:lightgray;
text-decoration:none;
}
a.fb{
text-align:center;
margin-top:5px;
font-size:20px;
font-weight:bold;
position:absolute;
color:white;
font-variant: small-caps;
right:2.5%;
text-decoration:none;
}
a.fb:hover{
cursor:pointer;
color:lightgray;
text-decoration:none;
}
a.tw{
text-align:center;
margin-top:5px;
font-size:20px;
font-weight:bold;
position:absolute;
color:white;
font-variant: small-caps;
right:3.5%;
text-decoration:none;
}
a.tw:hover{
cursor:pointer;
color:lightgray;
text-decoration:none;
}
</style>
</head>
<body>
<div class="navBar">
<a href="aid_menu.html" class="back"><i class="fa fa-chevron-left"></i></a>
<a href="index.html" class="home">Global Refugee Atlas</a>
<a href="https://facebook.com" target="_blank" class="fb"><i class="fa fa-facebook"></i></a>
<a href="https://twitter.com" target="_blank" class="tw"><i class="fa fa-twitter"></i></a>
<a href="https://github.com/jakobzhao/refugee" target="_blank" class="github"><i class="fa fa-github"></i></a>
</div>
<div id="infoPanel">
<img id="ng" src="assets/img/contributions_icons.png">
<h1 style="font-size:43px; margin-top:10px;">CONTRIBUTIONS</h1>
<div id="text">
<div class="legend_container" id="HDI_legend">
<h2>Ratio of Contributions to GDP</h2>
<div class="legend" style="background:linear-gradient(to right, #ffffff, #ffffff 16%, #ffffcc 16%, #ffffcc 33%, #c2e699 33%, #c2e699 50%, #78c679 50%, #78c679 66%, #31a354 66%, #31a354 83%, #006837 83%);"></div>
<p class="legend_label" style="margin-left:0px;">Lower</p>
<p class="legend_label" style="margin-left:185px;">Higher</p>
<p style="margin-top:25px;">This map uses a cartogram to give an immediate picture of the contributions to UNHCR, by distorting the shape of country borders according to the sum given in 2018. The colors highlight the ratio between the absolute contribution of a country compared to its GDP. </p>
</div>
</div>
</div>
<!--<div id="projectionButtons">
<button style="display:inline-block; height:64px;" onclick="toEquirectangular()"><img style="width:60px; height:60px;" src="assets/img/rect.png"></img></button>
<button style="display:inline-block; height:64px;" onclick="toOrthographic()"><img style="width:60px; height:60px;" src="assets/img/ortho.png"></img></button>
</div>-->
<div id="world"></div>
<script src="https://d3js.org/d3.v5.min.js"></script>
<!-- Use d3-fetch instead of d3-request in ES6 -->
<script src="https://d3js.org/d3-request.v1.min.js"></script>
<script src="https://d3js.org/d3-queue.v3.min.js"></script>
<script src="https://d3js.org/topojson.v3.min.js"></script>
<script src="https://d3js.org/d3-geo-projection.v2.min.js"></script>
<script src="js/perfect-scrollbar.js"></script>
<script src="js/chart.js"></script>
<script src="js/Chart.PieceLabel.min.js"></script>
<script src="https://d3js.org/d3-scale-chromatic.v0.3.min.js"></script>
<script src="https://unpkg.com/cartogram-chart"></script>
<script>
d3.json("assets/map_data/global/contributions2.json", (error, world) => {
if (error) throw error;
const colorScale = d3.scaleSequential(d3.interpolateGreens)
.domain([0, Math.max(...world.objects.countries.geometries.map(ratio))]);
Cartogram()
.topoJson(world)
.topoObjectName('countries')
.iterations(100)
.value(({ properties }) => properties.Contributions)
.color(f => colorScale(ratio(f)))
.label(({ properties: p }) => `Contributions of ${p.NAME} (${p.ADM0_A3})`)
.units('')
.valFormatter(d3.format('$,.0f'))
(document.getElementById('world'));
//
function ratio({ properties: p }) {
return p.Contributions / p.GDP_MD_EST;
}
});
</script>
</body>
</html>