Highcharts Demo
author(s):
Torstein Hønsi
by Torstein Hønsi
HTML
<script src="http://github.highcharts.com/bfe59184bb8bf59bb5490e728cc47e6950439476/highcharts.js"></script>
<script src="http://github.highcharts.com/bfe59184bb8bf59bb5490e728cc47e6950439476/modules/data.src.js"></script>
<script src="http://github.highcharts.com/bfe59184bb8bf59bb5490e728cc47e6950439476/modules/map.src.js"></script>
<script src="http://github.highcharts.com/bfe59184bb8bf59bb5490e728cc47e6950439476/modules/exporting.js"></script>
<div id="container" style="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 random data
var data = [
{
"code": "DE.SH",
"value": 728
},
{
"code": "DE.BE",
"value": 710
},
{
"code": "DE.MV",
"value": 963
},
{
"code": "DE.HB",
"value": 541
},
{
"code": "DE.HH",
"value": 622
},
{
"code": "DE.RP",
"value": 866
},
{
"code": "DE.SL",
"value": 398
},
{
"code": "DE.BY",
"value": 785
},
{
"code": "DE.SN",
"value": 223
},
{
"code": "DE.ST",
"value": 605
},
{
"code": "DE.",
"value": 361
},
{
"code": "DE.NW",
"value": 237
},
{
"code": "DE.BW",
"value": 157
},
{
"code": "DE.HE",
"value": 134
},
{
"code": "DE.NI",
"value": 136
},
{
"code": "DE.TH",
"value": 704
}
];
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=germany.geo.json&callback=?', function (geojson) {
// Initiate the chart
$('#container').highcharts('Map', {
title : {
text : 'Geojson in Highmaps'
},
mapNavigation: {
enabled: true,
buttonOptions: {
verticalAlign: 'bottom'
}
},
colorAxis: {
},
series : [{
data : data,
mapData: Highcharts.geojson(geojson, 'map'),
joinBy: ['code_hasc', 'code'],
name: 'Random data',
...