Dear all,

       Since I am new to Google charts, I would like to know how 
to Integrate the GEO chart for states in india in PHP.

          The following PHP not working properly.Can anyone correct me 
where i went wrongly?

Thanks in advance
R Logeswaran 

<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "hitech";
$text="";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
 
?>
<!DOCTYPE HTML>
<html>
<head>
 <meta charset="utf-8">
 <title>
 Create Google Charts
 </title>
 <script type="text/javascript" src="https://www.google.com/jsapi";></script>
 <script type="text/javascript">
 google.load("visualization", "1", {packages:["geochart"]});
 google.setOnLoadCallback(drawRegionsMap);

 function drawRegionsMap() {

 var data = google.visualization.arrayToDataTable([

 ['LOCATION', 'Sales value'],
 <?php 
 //$query = "SELECT count(ip) AS count, country FROM visitors GROUP BY 
country";
 $query = "SELECT SUM(AMOUNT) AS count, LOCATION FROM SALES_DATA GROUP BY 
LOCATION ORDER BY LOCATION";

 $exec = mysqli_query($conn,$query);
 while($row = mysqli_fetch_array($exec)){

 echo "['".$row['LOCATION']."',".$row['count']."],";
 }
 ?>
 ]);

 var options = {
 region: 'IN', // India 
            displayMode: 'markers', //If you want to highlight some cities
            resolution: 'provinces', //If you want to display provinces in 
India
            colorAxis: {colors: ['blue']} //If you want specific color for 
your markers (cities)
 };

 var chart = new 
google.visualization.GeoChart(document.getElementById('geochart'));

 chart.draw(data, options);
 }
 </script>
</head>
<body>
 <h3>Geo Chart</h3>
 <div id="geochart" 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/e7f2d5d9-78a9-41d3-a58f-2abda5f72e1en%40googlegroups.com.

Reply via email to