Highcharts Demo
author(s):
Torstein Hønsi
by Danielle Parkinson
HTML
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css">
<script src="https://code.highcharts.com/maps/highmaps.js"></script>
<script src="https://code.highcharts.com/maps/modules/data.js"></script>
<script src="https://code.highcharts.com/maps/modules/exporting.js"></script>
<script src="https://code.highcharts.com/maps/modules/offline-exporting.js"></script>
<script src="https://code.highcharts.com/mapdata/custom/world.js"></script>
<div id="container">
<div class="loading">
<i class="icon-spinner icon-spin icon-large"></i>
Loading data from Google Spreadsheets...
</div>
</div>
CSS
#container {
height: 500px;
min-width: 980px;
max-width: 980px;
margin: 0 auto;
}
.loading {
margin-top: 10em;
text-align: center;
color: gray;
}
JavaScript
// Load the data from a Google Spreadsheet
// https://docs.google.com/spreadsheets/d/1WBx3mRqiomXk_ks1a5sEAtJGvYukguhAkcCuRDrY1L0/pubhtml
Highcharts.data({
googleSpreadsheetKey: '1WBx3mRqiomXk_ks1a5sEAtJGvYukguhAkcCuRDrY1L0',
// Custom handler when the spreadsheet is parsed
parsed: function (columns) {
// Read the columns into the data array
var data = [];
Highcharts.each(columns[0], function (code, i) {
data.push({
code: code.toUpperCase(),
value: parseFloat(columns[2][i]),
name: columns[1][i]
});
});
// Initiate the chart
Highcharts.mapChart('container', {
chart: {
map: 'custom/world',
borderWidth: 1
},
colors: [
'#fff',
'#00a3a1'
],
title: {
text: ''
},
mapNavigation: {
enabled: true
},
legend: {
title: {
text: 'Satisfaction Score',
style: {
color: ( // theme
Highcharts.defaultOptions &&
Highcharts.defaultOptions.legend &&
Highcharts.defaultOptions.legend.title &&
Highcharts.defaultOptions.legend.title.style &&
Highcharts.defaultOptions.legend.title.style.color
) || 'black'
}
},
align: 'left',
verticalAlign: 'bottom',
floating: true,
layout: 'vertical',
valueDecimals: 0,
backgroundColor: '#fff',
symbolRadius: 0,
symbolHeight: 14
},
colorAxis: {
dataClasses: [{
to: 20
...