If you don't want to create a data source to Google's specs, you can 
implement your own (just don't expect it to be compatible with anything 
anyone else does).  Set up an AJAX query (I like jQuery for this):

// form is the js object for the form you are submitting
function submitQuery (form) {

var data = $(form).serialize();

$.ajax({

data: data,

url: "path/to/source.php",

method: "POST", // or method: "GET"

success: function (json) {

drawChart(json);

}

});

}

// drawChart takes the json and builds the data table with it
function drawChart(json) {

var data = new google.visualization.dataTable(json);
var chart = new 
google.visualization.<chartType>(document.getElementById("chart_div");
chart.draw(data, <options>);

}

then in your source php, query MySQL, build a json string out of your data 
(formatted for you chart), and echo it, with the "Content-type: 
application/json" header:
<?php

header("Content-type: application/json");

// $json hold the json string 

echo $json;
exit;

?>

Information on the format of the JSON is here: 
http://code.google.com/apis/chart/interactive/docs/dev/implementing_data_source.html#jsondatatable

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to