У меня возникли проблемы с загрузкой маркеров 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 –