Replacing your PHP with static numbers seems to work fine. I suspect your
PHP is wrong somewhere outside the scope of the charting API.
Have you tried just inserting static data to see if and chart renders? Have
you put a breakpoint, and looked to see that the PHP is generating proper
JS? What's the console output say? Any errors from you PHP?
On Tuesday, June 11, 2013 8:39:51 AM UTC-4, armon d wrote:
>
> this is my cod, there is any error but when i test it my page web a empty
> ???????
>
>
>
> <?php
>
>
> pg_connect("host=localhost port=5432 dbname=base_test user=postgres
> password=123456") or die('Could not connect: ' . pg_last_error());
>
> $q='SELECT "Facteur","building" from "Cout" where site=\'Montmorin\'';
> $query=pg_query($q);
> $n=pg_num_rows($query);
> ?>
>
>
> <html>
> <head>
> <script type="text/javascript" src="https://www.google.com/jsapi
> "></script>
> <script type="text/javascript">
> google.load("visualization", "1", {packages:["corechart"]});
> google.setOnLoadCallback(drawChart);
> function drawChart() {
> var data = google.visualization.arrayToDataTable([
> ['building', 'Facteur'],
> <?php
> for($i=0; $i<$n; $i++)
> {
> $f=pg_fetch_row($query);
> echo("['".$f[1]."', ".$f[0]."]");
> }
> ?>
>
> ]);
>
> var options = {
> title: 'My Daily Activities'
> };
>
> var chart = new
> google.visualization.PieChart(document.getElementById('chart_div'));
> chart.draw(data, options);
> }
> </script>
> </head>
> <body>
> <div id="chart_div" style="width: 900px; height: 500px;"></div>
> </body>
> </html>
>
>
>
--
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.