0
我試圖將Google圖表添加到我的項目時出現問題。該頁面不加載或加載空白頁面。嘗試加載後,它會正確顯示頁面幾秒鐘,然後頁面變爲空白並卡住。 這是我的代碼:Google Chart不加載
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart','table']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
['TEST 1', 3],
['TEST 2', 1],
['TEST 3', 1],
['TEST 4', 1],
['TEST 5', 2]
]);
// Set chart options
var options = {'title':'ACTIONS',
'width':400,
'height':300};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
這是我在應用程序
<div id="chart_div" style="width:400; height:300"></div>
您確定此代碼在body onload後運行嗎? – juvian 2015-01-20 19:24:09
ypeError:無法在fb(http://liondesk.it/js/libs/jquery.dataTables.min.js:7:148) 處以HTMLTableElement讀取未定義的 屬性'offsetWidth'。(http://liondesk.it/js/libs/jquery.dataTables.min.js:91:45) at Function.m.extend.each(http://liondesk.it/js/libs/jquery- 1.11.1.min.js:2:2973) –
2015-01-20 19:25:51
該頁面試圖獲取請求,但通過後可能會有2秒頁面進入空白頁面,並顯示控制檯上的錯誤 – 2015-01-20 19:28:42