Hi all

I'm new at this, but i spend lots of hours working at it, but still i get 
no pie chart.
If anyone can offer any help i would greatly appreciate it.

here is the code and thanks a lot in advance

<?php

$tns = "  
(DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = xxx.xxx.xxx.xxx)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = XE)
    )
  )
       ";
$db_username = "xxxxxxx";
$db_password = "xxxxxxx";
try{
    $conn = new PDO("oci:XXX.WORLD=".$tns,$db_username,$db_password);
}catch(PDOException $e){
    echo ($e->getMessage());
}



 $query = "SELECT t31.a AS A_GROUP, count(t31.b) AS T_COUNT
  FROM a_DATABASE.T31 T31
WHERE (t31.a NOT IN ('bananas'))
       AND trunc(T31.ARRIVAL_DATE) = trunc(sysdate)
GROUP BY t31.a
ORDER BY t31.b DESC";
?>

<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);
            var agroup = new Array;
            var tcount = new Array;
            var dataz = new Array;
            <?php

            foreach($conn->query($query) as $row)
            {
                print 'agroup.push('.$row['A_GROUP'] . '); tcount.push(' . 
$row['T_COUNT'] . ");\r\n";
            } 

            ?>
                
      for(i = 0; i <= agroup.length; i++){
                dataz.push([agroup[i], tcount[i]]);
            }
            
      function drawChart() {

        var data = google.visualization.arrayToDataTable(dataz);

        var options = {
          title: 'The Chart'
        };

        var chart = new 
google.visualization.PieChart(document.getElementById('piechart'));

        chart.draw(data, options);
        </script>
    </head>
    

<body>
    
    <div id="piechart" style="width: 900px; height: 500px;"></div>
    
</body>
</html>

<?php

$conn = NULL;

?>



-- 
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.

Reply via email to