Google API:标记未显示在地图上的arraytable上(javascript)

时间:2019-05-16 22:39:56

标签: javascript google-api

我使用了arraytodatatable并试图在地图上显示我的数据,但是我在地图上没有看到任何标记。

这是我使用的代码

<html>
<head>
<title>Google Charts Tutorial</title>
<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: ['map'],'mapsApiKey': 'my 
API'});     
</script>
</head>

<body>
<div id = "container" style = "width: 550px; height: 400px; margin: 
0 
auto">
</div>
<script language = "JavaScript">

function drawChart() {
// Define the chart to be drawn.
var data = google.visualization.arrayToDataTable([
['Lat', 'Long', 'Name'],
[37.4232, -122.0853, 'Work'],
[37.4289, -122.1697, 'University'],
[37.6153, -122.3900, 'Airport'],
[37.4422, -122.1731, 'Shopping']
]);

// Set chart options
var options = {
showTip: true,
};      

// Instantiate and draw the chart.
var chart = new 
google.visualization.Map(document.getElementById('container'));
chart.draw(data, options);
}
google.charts.setOnLoadCallback(drawChart);
</script>
</body>
</html>

我收到的错误消息是:

maps.google.com/mapfiles/ms/micons/red-dot.png:1 GET 
file://maps.google.com/mapfiles/ms/micons/red-dot.png 
net::ERR_FILE_NOT_FOUND

这是否意味着不再使用标记的图像?如果是这样,我是否可以更改标记的颜色,以便解决问题?

0 个答案:

没有答案