Hello.. I am unable to display chart. Please help. I am unable to figure
out the problem.
getdata.php
<?php
mysql_connect('localhost','akshita','123456');
mysql_select_db('rcusers');
$sqlquery1="select userid,group_name,req_nodes,actualPE from jobs
<http://stackoverflow.com/questions/15073654/unable-to-extract-data-to-get-google-chart-nothing-is-being-displayed-but-getda#>
where userid='zhang' limit 200";
$sqlresult1=mysql_query($sqlquery1);
$rows=array();
while($r=mysql_fetch_assoc($sqlresult1)){
$rows[]=$r;}print json_encode($rows);?>
chartDraw.php
<html><head><!--Load the AJAX API --><script type="text/javascript"
src="https://www.google.com/jsapi"></script><script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"
type="text/javascript"></script>
<script type="text/javascript">
//Load the visualization API and the piechart package
google.load('visualization','1',{'packages':['corechart']});
//Set a callback to run when the google visualization API is loaded
google.setOnLoadCallback(drawchart);
function drawChart(){
var jsonData = $.ajax({
url:"getData.php",
dataType:"json",
async:false
}).responseText;
//Create our data table out of JSON data loaded from servervar data=new
google.visualization.DataTable(jsonData);
//Instantiate and draw our chart
<http://stackoverflow.com/questions/15073654/unable-to-extract-data-to-get-google-chart-nothing-is-being-displayed-but-getda/15073745#>,
passing in some optionsvar chart=new
google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data,{width:400,height:240});}
</script></head>
<body>
<!--Div that will hold the pie chart -->
<div id="chart_div"></div></body></html>
On Tuesday, 26 July 2011 15:24:36 UTC-4, GerBen wrote:
>
> Hello Colleagues,
> How can I read data from an external database (say, MS SQL Server or
> MySQL) and show it in a Google Chart?
> Thank you.
--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.