-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex-countries.html
53 lines (51 loc) · 1.49 KB
/
index-countries.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
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Air crash stat</title>
<link rel="stylesheet" media="all" href="external/jvectormap/jquery-jvectormap.css"/>
<style>
html, body, .map {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
</style>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/jquery-jvectormap.min.js"></script>
<script src="js/jquery-jvectormap-world-mill-en.js"></script>
<script>
$(function(){
$.getJSON('data/output.json', function(data){
var i,
countriesData = {},
countryCode;
for (i = 0; i < data.accidents.length; i++) {
if (data.accidents[i]['country_code']) {
countryCode = data.accidents[i]['country_code'];
countriesData[ countryCode ] = countriesData[ countryCode ] || 0;
countriesData[ countryCode ] += data.accidents[i]['fatalities'];
}
}
map = new jvm.WorldMap({
map: 'world_mill_en',
container: $('.map'),
series: {
regions: [{
attribute: 'fill',
scale: ['#FFFFB2', '#E31A1C'],
values: countriesData
}]
},
onMarkerClick: function(e, code){
window.open('http://aviation-safety.net/database/record.php?id='+code);
}
});
});
})
</script>
</head>
<body>
<div class="map"></div>
</body>
</html>