Nothing works:(
You can view results of php @ sunminer.co/getData.php
//connection successful...
$sth = mysql_query("SELECT * FROM testpower WHERE datetime > 0");
$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;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html
xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="content-type"
content="text/html; charset=utf-8" /> <title>Google Visualization API
Sample</title> <script type="text/javascript" src="http://www.google.com/jsapi
<view-source:http://www.google.com/jsapi>"></script> <script
type="text/javascript" src="jquery-1.6.2.min.js
<view-source:http://sunminer.net/jquery-1.6.2.min.js>"></script> <script
type="text/javascript"> google.load('visualization', '1', {packages:
['annotatedtimeline']}); function drawVisualization() { var data = new
google.visualization.DataTable({cols:[{label: 'date', type: 'datetime'},
{label: 'power', type: 'number'}], rows: [{c: [{v:'2007-12-01
00:12:00'},{v:0}]}, {c: [{v:'2007-12-01 01:12:00'},{v:101}]}, {c:
[{v:'2007-12-01 02:12:00'},{v:201}]}, {c: [{v:'2007-12-01
03:12:00'},{v:302}]}]}); var annotatedtimeline = new
google.visualization.AnnotatedTimeLine(
document.getElementById('visualization')); annotatedtimeline.draw(data,
{'displayAnnotations': true}); }
google.setOnLoadCallback(drawVisualization); </script></head><body
style="font-family: Arial;border: 0 none;"><div id="visualization"
style="width: 800px; height: 400px;"></div></body></html>
--
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/-/QHLrZeZgsBMJ.
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.