thanks a lot for your help am gonna try it
On Tue, Sep 3, 2013 at 3:56 AM, asgallant <[email protected]> wrote: > The JSON you are creating in your PHP is not the correct structure for the > Visualization API. Try this instead: > > $arr = array( > 'cols' => array( > array('type' => 'number', 'label' => 'Watts'), > array('type' => 'number', 'label' => 'Dollars'), > array('type' => 'number', 'label' => 'Money') > ), > 'rows' => array( > array('c' => array(array('v' => 1), array('v' => 67), array('v' => > 76))) > ) > ); > > > On Monday, September 2, 2013 4:43:20 PM UTC-4, King Musa wrote: >> >> >> This is my php page called getData.php >> <?php >> $arr = array('Watts' => 1, 'Dollars'=>67, 'Money' => 76); >> $json_table = json_encode($arr); >> //echo $json_table; >> ?> >> >> here is my index page containing gooogle chart >> <html> >> <head> >> <!--Load the AJAX API--> >> <script >> src="http://code.jquery.com/**jquery-latest.js<http://code.jquery.com/jquery-latest.js> >> "></script> >> <script type="text/javascript" >> src="https://www.google.com/**jsapi<https://www.google.com/jsapi> >> "></script> >> <script type="text/javascript" src="//ajax.googleapis.com/** >> ajax/libs/jquery/1.10.2/**jquery.min.js<http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js> >> "></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 server. >> var data = new google.visualization.**DataTable(jsonData); >> >> // Instantiate and draw our chart, passing in some options. >> var 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> >> >> -- > You received this message because you are subscribed to a topic in the > Google Groups "Google Visualization API" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/google-visualization-api/mcYS1Znwqik/unsubscribe > . > To unsubscribe from this group and all its topics, 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. > -- 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.
