What am I missing here?
<code>
<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['annotatedtimeline']});
function drawVisualization() {
var jsonData = $.ajax({
url: "getData.php",
dataType:"json",
async: false
}).responseText;
var data = new google.visualization.DataTable(jsonData);
var annotatedtimeline = new google.visualization.AnnotatedTimeLine(
document.getElementById('visualization'));
annotatedtimeline.draw(data, {'displayAnnotations': true});
}
</code>
sunminer.net/getData.php :
<code>
$sth = mysql_query("SELECT * FROM testpower");
$rows = array();
$flag = true;
while($r = mysql_fetch_assoc($sth)) {
$rows[] = $r;
}
$tablej = '{cols:[{label: \'date\', type: \'datetime\'}, {label: \'power\',
type: \'number\'}], rows: [';
foreach($rows as $i){
if ($flag){
$tablej .= '{c: [{v:'.$i["datetime"].'},{v:'.$i["power"].'}]}';
$flag = false;
}
else
$tablej .= ', {c: [{v:'.$i["datetime"].'},{v:'.$i["power"].'}]}';
}
$tablej .= ']}';
header("Content-type: application/json");
echo $tablej;
</code>
On Friday, July 13, 2012 6:28:04 PM UTC-7, shown wrote:
>
> Does DataTable() not take json_encode(mysql_query) data?
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/gbm02TOr6RwJ.
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.