Highcharts Demo

author(s): Torstein Hønsi

by Torstein Hønsi

HTML

<script src="http://code.highcharts.com/maps/highmaps.js"></script>
<script src="http://code.highcharts.com/maps/modules/data.js"></script>
<script src="http://code.highcharts.com/maps/modules/exporting.js"></script>
<script src="http://code.highcharts.com/mapdata/1.0.0/countries/ind/ind-all.js"></script>


<div id="container" style="min-width: 310px; max-width: 400px"></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 () {

    // Prepare some data
    var data = [{
        "hasc": "IN.MP",
        "value": 1
    }];

    // Initiate the chart
    $('#container').highcharts('Map', {
        
        title : {
            text : 'GeoJSON in Highmaps'
        },
        
        mapNavigation: {
            enabled: true,
            buttonOptions: {
                verticalAlign: 'bottom'
            }
        },
        
        colorAxis: {
        },
        
        series : [{
            data : data,
            mapData: Highcharts.geojson(Highcharts.maps['countries/ind/ind-all'], 'map'),
            joinBy: 'hasc',
            name: 'Random data',
            states: {
                hover: {
                    color: '#BADA55'
                }
            }
        }]
    });
});