0
過去幾天我一直試圖執行我的谷歌圖表網頁(jsfiddle),但它似乎像錯誤不斷變化,即使我沒有做任何不同的事情,除了刷新網頁。我曾嘗試使用Chrome的「清空緩存和硬重新載入」功能,但這並沒有改變任何內容。我收到的錯誤包括諸如Uncaught typeError: hi is not a function
之類的內容。我知道這個代碼的作品,因爲我昨天使用它,它工作得很好。我的代碼在它的工作時間和現在之間沒有改變。我是否導入了錯誤的東西,或者Google Charts API有什麼問題。我得到了同樣的問題,每當我試圖打開Google's APIGoogle Charts:嗨不是函數
的javascript:
google.charts.load('current',{'packages':['controls','corechart']});
google.charts.setOnLoadCallback(drawDashboard);
function drawDashboard(){
var dataSet = google.visualization.arrayToDataTable([
[{label:'date',type:'datetime'},{label:'Bytes from network:Bytes to network',type:'number'}],
[new Date(2016,01,23,00,00),1.0],
[new Date(2016,01,23,01,00),1.0075187969924813],
[new Date(2016,01,23,03,00),1.126865671641791],
[new Date(2016,01,24,22,00),0.987012987012987],
[new Date(2016,01,25,01,00),1.0],
[new Date(2016,01,25,02,00),0.9166666666666666],
[new Date(2016,01,25,10,00),1.0],
[new Date(2016,01,26,12,00),1.0],
[new Date(2016,01,27,17,00),0.9864864864864865],
[new Date(2016,01,28,22,00),0.03125],
[new Date(2016,02,01,22,00),0.97],
]);
var dashboard = new google.visualization.Dashboard(document.getElementById('dashboard_div'));
var dateRangeFilter = new google.visualization.ControlWrapper({'controlType':'ChartRangeFilter',
'containerId':'filter_div',
'options':{
'filterColumnLabel':'date',
'ui':{
'chartOptions':{
'chartArea':{
'width':'90%'
}
}
}
}
});
var lineChart = new google.visualization.ChartWrapper({'chartType':'LineChart',
'containerId':'curve_chart',
'options':{
'title': 'Total Bytes from the Source Network to Total Bytes To the Source Network per Day',
'curveType': 'function',
'chartArea': {'height': '80%', 'width': '90%'},
'legend': 'none'
}
});
dashboard.bind(dateRangeFilter,lineChart);
dashboard.draw(dataSet);
}
HTML:
<html>
<head>
<link rel="stylesheet" href="styles.css">
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
//javascript code from above
</script>
</head>
<body>
<h1>Data for this IP network</h1>
<hr />
<a href="../index.html"><<BACK TO INDEX</a>
<div id="dashboard_div">
<div id="curve_chart"></div>
<div id="filter_div"></div>
</div>
</body>
</html>
CSS:
h1{
text-align:center;
}
#dashboard_div{
border:1px solid #ccc;
margin:10px;
}
#curve_chart{
width:915px;
height:300px;
}
#filter_div{
width:915px;
height:50px;
}
我只是改變'google.charts.load( '當前',{ '包':[ '控制', 'corechart']});''到google.charts.load(」 44',{'packages':['controls','corechart']});'現在它可以工作。謝謝您的幫助! –