<ul id="myList"><li>Coffee</li><li>Tea</li></ul>
我有上面的代码来获取地理位置。但我得到this.each不是geochart div中的函数错误。请给我解决方案。
答案 0 :(得分:0)
包加载在load
语句中......
google.charts.load('current', {
callback: drawCharts,
packages: ['corechart', 'geochart'] // <-- packages for regular charts and geo charts
});
常规图表(如行,列和散点图)都使用'corechart'
包
专业图表,如地理图表,通常有自己的包需要加载......
请务必加载'geochart'
包...
请参阅以下工作代码段...
google.charts.load('current', {
callback: drawCharts,
// packages for regular charts, and geo charts
packages: ['corechart', 'geochart']
});
function drawCharts() {
var data = google.visualization.arrayToDataTable([
['Country', 'Popularity'],
['Germany', 200],
['United States', 300],
['Brazil', 400],
['Canada', 500],
['France', 600],
['RU', 700]
]);
var chartGeo = new google.visualization.GeoChart(document.getElementById('regions_div'));
chartGeo.draw(data);
var chartCol = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chartCol.draw(data);
}
&#13;
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>
<div id="regions_div"></div>
&#13;