Highcharts Demo

author(s): Torstein Hønsi

by Geo George

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: 310px; 
    max-width: 800px; 
    margin: 0 auto; 
}
.loading {
    margin-top: 10em;
    text-align: center;
    color: gray;
}

JavaScript

Highcharts.maps['custom/world'].features.push({"type":"Feature","id":"HK","properties":{"hc-group":"admin0","hc-middle-x":0.41,"hc-middle-y":0.56,"hc-key":"hk","hc-a2":"HK","name":"Hong Kong","labelrank":"2","country-abbrev":"China","subregion":"Eastern Asia","region-wb":"East Asia & Pacific","iso-a3":"HK","iso-a2":"HK","woe-id":"	24865698","continent":"Asia"},"geometry":{"type":"Polygon","coordinates":[[[7579,7118],[7585,7122],[7590,7120],[7596,7119],[7605,7120],[7608,7113],[7599,7100],[7579,7118]]]}})


// 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]
            });
        }); */
        
        data.push({
        	code: "HK",
          value: 99,
          name: "Hong Kong"
        })

        // Initiate the chart
        Highcharts.mapChart('container', {
            chart: {
                map: 'custom/world',
                borderWidth: 1
            },

            colors: ['rgba(19,64,117,0.05)', 'rgba(19,64,117,0.2)', 'rgba(19,64,117,0.4)',
                'rgba(19,64,117,0.5)', 'rgba(19,64,117,0.6)', 'rgba(19,64,117,0.8)', 'rgba(19,64,117,1)'],

            title: {
                text: 'Population density by country (/km²)'
            },

            mapNavigation: {
                enabled: true
            },

            legend: {
                title: {
                    text: 'Individuals per km²',
                    style: {
                        color: (Highcharts.theme &&...