document.getElementById('chart').innerHTML = "<div id='map' style='height:300px;width:100%'></div>"; //* Define your chart size
$.getScript("https://maps.googleapis.com/maps/api/js?key=ENTER-YOUR-API-KEY-HERE&signed_in=true", function(){ //* Enter your Google API Key here
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 5,
center: {lat: 50.357538, lng: 7.595110} //* Choose your position
});
chartData["columns"].forEach(function(entry) {
if (entry[1] != 1)
{
$.get("https://maps.googleapis.com/maps/api/geocode/json?address="+entry[1]+"&key=ENTER-YOUR-API-KEY-HERE", function(data, status){ //* Enter your Google API Key here
var marker = new google.maps.Marker({
position: data.results[0].geometry.location,
map: map,
title: entry[0].replace('-x', '')
});
});
}
});
}
initMap();
updateFrameHeight();
}); |