The past few days I have been trying to execute my Google Charts webpage ( jsfiddle ), but it seems like the error keeps changing, even when I didn't do anything different except refresh the webpage. I have tried using Chrome's "Empty Cache and hard reload" function, but that doesn't change anything. The errors I have been getting include things like Uncaught typeError: hi is not a function
. I know this code works, because I was using it yesterday and it worked just fine. I changed nothing in my code between the time it worked and now. Am I importing something incorrectly, or is there something wrong with the Google Charts API. I get the same issue whenever I try to open Google's API
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;
}
This is related to caching and redirects used by the loader mechanism. A new release was pushed by the Google Visualization Team, and it broke a lot of people. Fixing to version 43 or 44 instead of using 'current' in your loader call should fix the issue for now.
See https://github.com/google/google-visualization-issues/issues/2185
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.