Highcharts Demo

author(s): Torstein Hønsi

by Torstein Hønsi

HTML

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<script src="http://code.highcharts.local/maps/highmaps.src.js"></script>
<script src="http://code.highcharts.com/maps/modules/data.js"></script>
<script src="http://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

$(function () {
    $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=world-population-density.json&callback=?', function (data) {


        // Initiate the chart
        $('#container').highcharts('Map', {
            chart: {
                backgroundColor: '#ebebeb'
            },

            title: {
                text: 'Legend padding and item margin'
            },

            mapNavigation: {
                enabled: true,
                buttonOptions: {
                    x: -8,
                    verticalAlign: 'bottom'
                },
                buttons: {
                    zoomIn: {
                        y: 14
                    },
                    zoomOut: {
                        y: 14 + 28
                    }
                }
            },

            legend: {
                title: {
                    text: 'Individuals per km²'
                },
                layout: "vertical",
                align: "right",
                verticalAlign: "bottom",
                padding: 20,
                itemMarginTop: 0,
                itemMarginBottom: 0,
                symbolWidth: 30,
                symbolHeight: 15,
                floating: false,
                valueDecimals: 0,
                backgroundColor: 'rgba(255,255,255,0.9)',
                borderColor: "#999",
                borderWidth: 1,
                margin: 40,
                y: -20
            },

            colorAxis: {
                dataClasses: [{
                    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)'
               ...