Highcharts Demo

author(s): Øystein Moseng Torstein Hønsi

by Daniel

HTML

<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.2.2/proj4.js"></script>
<script src="http://code.highcharts.com/maps/highmaps.js"></script>
<script src="http://code.highcharts.com/maps/modules/exporting.js"></script>
<script src="http://code.highcharts.com/mapdata/countries/gb/gb-all.js"></script>
<div id="container"></div>

CSS

#container {
    height: 680px;
    min-width: 310px;
    max-width: 800px;
    margin: 0 auto;
}
.loading {
    margin-top: 10em;
    text-align: center;
    color: gray;
}

JavaScript

$(function () {


    (function (H) {
        H.seriesTypes.mappoint.prototype.axisTypes = ['xAxis', 'yAxis', 'colorAxis'];
       
        H.wrap(H.seriesTypes.mappoint.prototype, "translate", function (p) {
            p.call(this);
            H.seriesTypes.mappoint.prototype.translateColors.call(this);
        });
        H.seriesTypes.mappoint.prototype.translateColors = H.seriesTypes.heatmap.prototype.translateColors;
        H.seriesTypes.mappoint.prototype.colorKey = 'value';
    })(Highcharts);

    // Initiate the chart
    $('#container').highcharts('Map', {

        title: {
            text: 'Highmaps basic lat/lon demo'
        },

        mapNavigation: {
            enabled: true
        },

        tooltip: {
            headerFormat: '',
            pointFormat: '<b>{point.name}</b><br>Lat: {point.lat}, Lon: {point.lon}, Value: {point.value}'
        },
        colorAxis: {
            dataClasses: [{
                                from: 1,
                                to: 21,
                                color: "#66FFFF"
                            }, {
                                from: 22,
                                to: 50,
                                color: "#0099FF"
                            }, {
                                from: 51,
                                color: "#0000FF"
                            }
                            ]
        },
        series: [{
            // Use the gb-all map with no data as a basemap
            mapData: Highcharts.maps['countries/gb/gb-all'],
            name: 'Basemap',
            borderColor: '#A0A0A0',
            nullColor: 'rgba(200, 200, 200, 0.3)',
            showInLegend: false
        }, {
            name: 'Separators',
            type: 'mapline',
            data: Highcharts.geojson(Highcharts.maps['countries/gb/gb-all'], 'mapline'),
            color: '#707070',
            showInLegend: false,
            enableMouseTracking: false
        }, {
         ...