my column chart was working fine before this new release now my chart is
not displayed on browser. Ctrl+Shift+j shows the syntax error on var float
and JsonTable undefined
$data = mysql_query("select SUM(speed) as speed, CAST( Time AS date) as
Time from gps where DeviceId=$DeviceId and Time between '$from' and '$to'
group by CAST(Time AS date) order by CAST( Time AS date)")
or die(mysql_error());
$table = array();
$table['cols'] = array(
array('label' => 'Time', 'type' => 'string'),
array('label' => 'speed', 'type' => 'string')
);
$rows = array();
while ($nt = mysql_fetch_array($data))
{
$temp = array();
$temp[] = array('v' => (string)$nt['Time']);
$temp[] = array('v' =>(string) $nt['speed']);
//$temp[] = array('v' => (string)$nt['Time']);
// insert the temp array into $rows
$rows[]['c'] = $temp;
// $rows[] = array('c' => $temp);
}
$table['rows'] = $rows;
$jsonTable = json_encode($table);
// set up header; first two prevent IE from caching queries
//header('Cache-Control: no-cache, must-revalidate');
//header('Content-type: application/json');
// echo $jsonTable;
}
?>
google.load('visualization', '1.1', {'packages':['columnchart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
// Create our data table out of JSON data loaded from server.
var data = new google.visualization.DataTable(<?=$jsonTable?>);
var options = {
title: 'Speed Chart',
//is3D: 'true',
width: 1000,
height: 500,
align:'left'
};
// Instantiate and draw our chart, passing in some options.
// Do not forget to check your div ID
var chart = new
google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
--
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.
For more options, visit https://groups.google.com/groups/opt_out.