I have to plot timeofday. I have extracted my times, minutes and seconds
and now I want to define them in json. Whenever I just put a single
variable, it takes it as seconds and plots it. and when I write
$dt1,$dt2,$dt3 so that it takes 3 values, it does not plot the graph. Can
someone please tell me that how can I make it understand that it has to
consider the 3 variables as hours, minutes and seconds. I have attached my
result when I enter single value. My code for json is:
echo "{ \"cols\": [
{\"id\":\"\",\"label\":\"Name-Label\",\"pattern\":\"\",\"type\":\"timeofday\"},
{\"id\":\"\",\"label\":\"PointSum\",\"pattern\":\"\",\"type\":\"number\"}
], \"rows\": [ ";
$total_rows = mysql_num_rows($result);
$row_num = 0;
while($row = mysql_fetch_array($result)){
$row_num++;
$date = strtotime($row['Time']);
$date2 = date("H:i:s",$date); // Gives time with colon
$dt1= date("H",$date); // Extracts hours from time
$dt2= date("i",$date); //Extracts minutes from time
$dt3= date("s",$date); // Extracts seconds from time
if ($row_num == $total_rows){
echo "{\"c\":[{\"v\":\"" . $dt1 . "\",\"f\":null},{\"v\":" . $dt2 .
",\"f\":null}]}";
} else {
echo "{\"c\":[{\"v\":\"" . $dt1 . "\", \"f\":null},{\"v\":" . $dt2 .
",\"f\":null}]}, ";
}
}
echo " ] }";
--
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/d/optout.