我无法让Google API制成的表格出现在我的KML弹出窗口中。我已经使其他GoogleAPI功能(例如饼图和条形图)出现了,但此表无法加载,而我只剩下一个空白。
我已经列出了下表的代码,该代码会在chrome浏览器中加载。
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['table']});
google.charts.setOnLoadCallback(drawTable);
function drawTable() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Site');
data.addColumn('string', 'Figure 1');
data.addColumn('string', 'Figure 2');
data.addColumn('string', 'Figure 3');
data.addColumn('string', 'Figure 4');
data.addRows([
['A','0','2.75','3.88','1.59'],['B','0','4','4.54','1.21'], ['C','0','0.5','4.2','8.98'],['D','0','5','0.06','0.01'],['E','0','5','0.26','0.06'],['F','0','5','0.07','0.02'],['G','0','3.68','0.61','0.24'],['H','0','0.5','1.29','3.02'],['I','0','0.5','0.42','1.0'],['J','0','5','0.72','0.15'],['K','0','1.66','60.73','38.74'],['L','0','5','0.14','0.03'],['M','0','5','0.25','0.06'],['N','0','5','0.05','0.01'],['O','0','5','0.06','0.01'],['P','0','1.55','0.31','0.23'],['Q','0','5.29','82.96','16.53'],['R','0','2.85','0.38','0.17'],['S','0','0.5','0.31','0.71'],['T','0','3.77','4.54','1.49']
]);
var table = new google.visualization.Table(document.getElementById('table_div'));
table.draw(data, {showRowNumber: true, width: '1000px', height: '500px'});
}
</script>
</head>
<body>
<h1>TABLE </h1>
<div id="table_div"></div>
</body>
我希望表格出现在KML点的弹出窗口中。目前,当我打开它时,它完全是空白。
任何人以前都遇到过这个问题或有任何想法吗?