我無法將Geochart標記加載到地圖上。 Google提供的腳本在我的網站上呈現空白地圖,但標記和地圖顯示爲應該在jsfiddle上顯示。任何幫助將非常感激。GeoChart上不會顯示標記,但地圖顯示正常
下面的代碼:
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.charts.load('current', {'packages': ['geochart']});
google.charts.setOnLoadCallback(drawMarkersMap);
function drawMarkersMap() {
var data = google.visualization.arrayToDataTable([
['City', 'Collaborator'],
['Detroit', "text here"],
['Cleveland', "text here"],
['Joondalup', "text here"],
['Wanaka', "text here"]
['Liverpool', "text here"],
['Styria', "text here"],
['Edwardsville', "text here"],
['Austin', "text here"],
['Houston', "text here"],
['Stockholm', "text here"],
]);
var options = {
region: 'world',
displayMode: 'markers',
backgroundColor: '#252426',
colorAxis: {colors: ['blue']},
magnifyingGlass: {enable: false},
defaultColor: '#f1910e',
enableRegionInteractivity: 'true',
};
var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
chart.draw(data, options);
};
</script>
任何建議使它能夠使用環境變量或api密鑰,以便api密鑰不是硬編碼(這是一種安全風險)? – Jack
http://stackoverflow.com/questions/39625587/how-do-i-securely-use-google-api-keys –