Highcharts Demo

author(s): Torstein Hønsi

by Geo George

HTML

<script src="https://code.highcharts.com/maps/highmaps.js"></script>
<script src="https://code.highcharts.com/maps/modules/exporting.js"></script>
<script src="https://code.highcharts.com/mapdata/custom/north-america-no-central.js"></script>


<div id="container"></div>

CSS

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

JavaScript

// Prepare demo data
var data = [ {
    'hc-key': 'ca',
    value: 5
}];


// Initiate the chart
Highcharts.mapChart('container', {

    title: {
        text: 'Showing only non-null areas'
    },

    subtitle: {
        text: 'The <em>allAreas</em> option is false'
    },

    mapNavigation: {
        enabled: true,
        buttonOptions: {
            verticalAlign: 'bottom'
        }
    },

    colorAxis: {
        min: 0
    },

    series: [{
        data: data,
        mapData: Highcharts.maps['custom/north-america-no-central'],
        joinBy: 'hc-key',
        allAreas: false,
        name: 'Random data',
        states: {
            hover: {
                color: '#a4edba'
            }
        },
        dataLabels: {
            enabled: true,
            format: '{point.name}'
        }
    }]
});