I am using Google Charts Visualization API in my application and have encountered a problem whereby the charts are failing to load.
The problem first occurred when I loaded my application without making any prior changes from a working copy and the Javascript Charts were not loaded on the page. I checked the Chrome and FireFox console errors and they are as follows:
Firefox: ReferenceError: dr is not definedin loader.js
Chrome: Uncaught TypeError: google.visualization.PieChart is not a function
Here is my code for drawing my two charts.
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', { 'packages': ['corechart', 'table'] });
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Signatures');
data.addColumn('number', 'Number of Occurence');
for (i = 0; i < num.length; i++) {
data.addRow([num[i], parseInt(num[i + 1])]);
i++;
}
var options = {
title: 'Top 5 Alerts'
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
</script>
Here is the JQuery I load within the head of the page.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
After digging around and heading to the Google Charts official site here:
https://developers.google.com/chart/interactive/docs/gallery/piechart
I noticed the PieChart Google is attempting to load for their example will not work on my machine either with the same Firefox and Chrome console errors.
I am not sure where to go from here and was wondering if mayby Google could be blocking my IP from loading the API or such?
Or if settings have been changed which are now preventing the charts from loading?
Any insight into why this might be happening would be a great help.