Evening everyone,

        I'm trying to get data from my database to display it as a pie 
chart. I have two columns of data in my database. One being an id, and the 
other being a parameter. Here is what I have so far: 

<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi";></script>
<script type="text/javascript">
google.load("visualization", '1.0', {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['id', 'parameter']
<?php
$server = 'localhost';
$user = '';
$pass = '';
$db = '';

$link=mysqli_connect($server, $user, $pass, $db);
$result = mysqli_query($link, "SELECT * FROM userparameterselect")
    or die(mysqli_error());;
while($row = mysqli_fetch_assoc( $result )) {
        echo ",['{$row['id']}','{$row['parameter']}']"; 
    }
?>
]);
var options = {
title: 'Weather'
};
var chart = new google.visualization.PieChart(document.getElementById(
'chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>

<!--Div that will hold the pie chart-->
    <div id="chart_div" style="width:400; height:300"></div>
</body>
</html>

The title pops up, but nothing else will pop up. Any changes I should make?

-- 
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.
  • [visualization-api] Pie ch... 'razgriznation23' via Google Visualization API

Reply via email to