Google 可视化 - TypeError:无法读取未定义的属性“DataTable"[Chrome 特定] [英] Google Visualization - TypeError: Cannot read property 'DataTable' of undefined [Chrome specific]
本文介绍了Google 可视化 - TypeError:无法读取未定义的属性“DataTable"[Chrome 特定]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 Google 可视化库,我的应用程序运行正常,我无法弄清楚在 chrome 上(特别是)这个错误是如何开始出现的.在 Firefox 中运行良好
I am using Google Visualization Library my application was working correctly, I am unable to figure out how on chrome (specifically) this err starts coming up. Working fine in Firefox
function drawVisualization() {
var data = new google.visualization.DataTable(countArray);
// Declare columns
data.addColumn('date', 'Day');
data.addColumn('number', 'Person');
// Add data.
data.addRows(countArrayFinal);
// Create and draw the visualization.
new google.visualization.LineChart(document.getElementById('visualization')).draw(data, {
title: 'Performance',
width : 700,
height : 300,
vAxis : {
maxValue : 4000
}
});
}drawVisualization();
推荐答案
出现此错误是因为未加载 google 可视化.
This error occurs because google visualization is not loaded.
在 drawVisualization
函数下面添加:
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawVisualization);
代替
drawVisualization();
这篇关于Google 可视化 - TypeError:无法读取未定义的属性“DataTable"[Chrome 特定]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文