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屋!
查看全文