-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
133 lines (111 loc) · 3.55 KB
/
index.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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Highcharts Example</title>
<!-- 1. Add these JavaScript inclusions in the head of your page -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://raw.github.com/highslide-software/highcharts.com/master/js/highcharts.src.js"></script>
<script type="text/javascript" src="https://raw.github.com/highslide-software/highcharts.com/master/js/modules/map.src.js"></script>
<script type="text/javascript" src="https://raw.github.com/highslide-software/highcharts.com/master/js/modules/googlespreadsheet.src.js"></script>
<!-- 2. Insert the shapes -->
<script type="text/javascript" src="http://futuregrid.github.com/virtual-cluster/test/world-map-shapes.js"></script>
<!-- 3. Add the JavaScript to initialize the chart on document ready -->
<script type="text/javascript">
var chart;
$(document).ready(function() {
// Load the data from a Google Spreadsheet
// https://docs.google.com/a/highsoft.com/spreadsheet/pub?hl=en_GB&hl=en_GB&key=0AoIaUO7wH1HwdFJHaFI4eUJDYlVna3k5TlpuXzZubHc&output=html
Highcharts.getGoogleSpreadsheet({
key: '0AoIaUO7wH1HwdFJHaFI4eUJDYlVna3k5TlpuXzZubHc',
// custom handler for columns
columns: function(columns) {
// Make the columns easier to read
var countryCodes = columns[0],
countryNames = columns[1],
populationDensities = columns[2];
var options = {
chart : {
renderTo : 'container',
borderWidth : 1
},
title : {
text : 'Population density by country (/km²)'
},
subtitle: {
text: 'Please excuse the creative projection - this is a work in progress'
},
legend: {
align: 'left',
verticalAlign: 'bottom',
floating: true,
layout: 'vertical',
valueDecimals: 0
},
tooltip: {
ySuffix: '/km²'
},
series : [{
data : [],
name: 'Population density',
valueRanges: [{
to: 3,
color: 'rgba(19,64,117,0.05)'
}, {
from: 3,
to: 10,
color: 'rgba(19,64,117,0.2)'
}, {
from: 10,
to: 30,
color: 'rgba(19,64,117,0.4)'
}, {
from: 30,
to: 100,
color: 'rgba(19,64,117,0.5)'
}, {
from: 100,
to: 300,
color: 'rgba(19,64,117,0.6)'
}, {
from: 300,
to: 1000,
color: 'rgba(19,64,117,0.8)'
}, {
from: 1000,
color: 'rgba(19,64,117,1)'
}],
states: {
hover: {
color: '#DD6E28'
}
}
}]
};
// Populate the data points
for (var i = 1; i < countryCodes.length; i++) {
if (shapes[countryCodes[i]]) {
options.series[0].data.push({
y : populationDensities[i],
name : countryNames[i],
path : Highcharts.pathToArray(shapes[countryCodes[i]]),
states: {
hover: {
color: 'orange'
}
}
});
}
}
// Initiate the chart
chart = new Highcharts.Map(options);
}
});
});
</script>
</head>
<body>
<!-- 3. Add the container -->
<div id="container" style="width: 600px; height: 550px; margin: 0 auto"></div>
</body>
</html>