United States of America with Territories - Highmaps

Highmaps demo

by Kathryn Atwood

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/countries/us/custom/us-all-territories.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
// Data is joined to map using value of 'hc-key' property by default.
// See API docs for 'joinBy' for more info on linking data and map.
var data = [
    ['us-ma', 2],
    ['us-wa', 10],
    ['us-ca', 8598],
    ['us-or', 6],
    ['us-nv', 3],
    ['us-co', 5],
    ['us-wy', 1],
    ['us-il', 2],
    ['us-tx', 2],
    ['us-ia', 1],
    ['us-md', 1],
    ['us-pa', 1],
    ['us-oh', 2],
    ['us-fl', 1],
    ['us-mn', 2],
    ['us-az', 1],
    ['us-ut', 1],
    ['us-hi', 8],
    ['undefined', 1]
];

// Create the chart
Highcharts.mapChart('container', {
    chart: {
        map: 'countries/us/custom/us-all-territories'
    },

    title: {
        text: 'Fall 2017 Undergraduate Geographic Breakdown - USA'
    },

    subtitle: {
        text: 'Source map: <a href="http://code.highcharts.com/mapdata/countries/us/custom/us-all-territories.js">United States of America with Territories</a>'
    },

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

  

    series: [{
        data: data,
        name: 'Number of student(s)',
        states: {
            hover: {
                color: '#BADA55'
            }
        },
        dataLabels: {
            enabled: true,
            format: '{point.name}'
        }
    }, {
            name: 'Separators',
            type: 'mapline',
            data: Highcharts.geojson(Highcharts.maps['countries/us/custom/us-all-territories'], 'mapline'),
            color: 'silver',
            showInLegend: false,
            enableMouseTracking: false
        }]
});