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();
The Google Chart API is an extremely simple tool that lets you easily create a chart from some data and embed it in a webpage. You embed the data and formatting parameters in an HTTP request, and Google returns a PNG image of the chart.
Use noData() method to enable "No data" label: chart. noData().
arrayToDataTable()This helper function creates and populates a DataTable using a single call. Advantages: Very simple and readable code executed in the browser. You can either explicitly specify the data type of each column, or let Google Charts infer the type from the data passed in.
This error occurs because google visualization is not loaded.
Add this below the drawVisualization
function:
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawVisualization);
instead of
drawVisualization();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With