I am trying to create a simple column chart by pulling data from a sql
database and then using json_encode to throw it back to the javascript. 3
columns of data - day (str), joined (int), canceled (int). The php I have
gives the following json data:
{ "cols": ["Day","Joined","Canceled"], "rows":
[["29",6,0],["30",7,0],["31",8,0],["01",12,1],["02",14,0],["03",18,2],["04",16,0],["05",20,1]]}
I then pass this to same javascript as in the documentation:
// Load the Visualization API and the columnchart package.
google.load('visualization', '1', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
function drawChart() {
var jsonData = $.ajax({
url: "getdata.php",
dataType:"json",
async: false
}).responseText;
// Create our data table out of JSON data loaded from server.
var data = new google.visualization.DataTable(jsonData);
// Instantiate and draw our chart, passing in some options.
var chart = new
google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data,
{title:"Member Activity",
width:600, height:400,
hAxis: {title: "Day"}}
);
}
When run, gives the error "this.D[a].c is undefined". Any ideas? Help is
deeply appreciated.
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.