Answered over on StackOverflow: http://stackoverflow.com/a/24295034/613559
On Wednesday, June 18, 2014 4:29:24 AM UTC-4, Ravindra Gharge wrote:
>
> I am populating the chart by getting the datatable as the response from
> other page.
> so am creating json object at other side and transfer to the requesting
> site and their i parse the object and create the datatable and populating
> the chart.
>
> following my code to request the chart data :
>
> var jsonData = $.ajax({
> type: "post",
> url: "getHourDrillChart.php",
> data: $("#my_form").serialize(),
> dataType: "json",
> async: false
> }).responseText;
> var obj = jQuery.parseJSON(jsonData); //alert(""+obj.toSource());
> var dataHour = google.visualization.arrayToDataTable(obj);\
>
> chart.setDataTable(dataHour);
> chart.setOptions(options);
> chart.draw();
>
> other site where i creating the chart data :
>
> $data[0] = array('Hour',$user);
> $getTownLocalityInfo = mysql_query($SQLString);
>
> # set heading
> //$data[0] = array('hour','Count');
> $i=1;
> $dayArray = array();
> while( $row = mysql_fetch_assoc($getTownLocalityInfo)){
> $date = $row['date'];
> $hour = $row['day_hours'];
> $count = (int) $row['sumCount'];
> $dayArray[] = $hour;
>
> mysql_query("INSERT INTO
> trend_hour_chart_temp(hour,$user,userId) VALUES
> ('$hour',$count,'$staffId')");
> $data[$i] = array($hour , $count);
> $i++;
> }
> echo json_encode($data);
>
>
>
>
--
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.