Lat/lon demo
Highmaps demo
by Chris Vecchio
HTML
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.2.2/proj4.js"></script>
<script src="http://github.highcharts.com/latlon/highmaps.js"></script>
<script src="http://code.highcharts.com/maps/modules/exporting.js"></script>
<script src="http://code.highcharts.com/mapdata/countries/de/de-all-all.js"></script>
<div id="container"></div>
CSS
#container {
height: 680px;
min-width: 310px;
max-width: 1500px;
margin: 0 auto;
}
.loading {
margin-top: 10em;
text-align: center;
color: gray;
}
JavaScript
$(function () {
var H = Highcharts,
map = H.maps['countries/de/de-all-all'],
chart;
$('#container').highcharts('Map', {
title: {
text: 'Highmaps lat/lon demo'
},
tooltip: {
formatter: function () {
return this.point.capital + ', ' + this.point.parentState + '<br>Lat: ' + this.point.lat + ' Lon: ' + this.point.lon + '<br>Population: ' + this.point.population;
},
crosshairs: [{
zIndex: 5,
dashStyle: 'dot',
snap: false,
color: 'white'
}, {
zIndex: 5,
dashStyle: 'dot',
snap: false,
color: 'white'
}],
},
mapNavigation: {
enabled: true
},
series: [{
name: 'Basemap',
mapData: map,
borderColor: '#606060',
nullColor: H.getOptions().colors[3],
showInLegend: false
}, {
name: 'Separators',
type: 'mapline',
data: H.geojson(map, 'mapline'),
color: '#101010',
enableMouseTracking: false
}]
});
// Add series with state capital bubbles
/*$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=us-capitals.json&callback=?', function (json) {
var data = [];
$.each(json, function (ix, entry) {
entry.z = entry.population;
data.push(entry);
});*/
var data = [{
lat: 41.43,
lon: 8.74,
z: 1e4
},{
lat: 50,
lon: 10,
z: 1e4
}];
chart = $('#container').highcharts();
chart.addSeries({
type: 'mapbubble',
dataLabels: {
enabled: true,
formatter: function () {
return this.point.capital;
}
},
...