I want to get the data from the php variables into the pie chart as I tried to do it with $Utha and the value of $one in its position of the pie chart. How would this work with an example connecting from a database? How can I make multiple charts appear in the same page. For example more than one chart with different data each. Can these charts be centered.
<?php
$Utha = 'Utha';
$Ilinois = 'Ilinoins';
$WD = 'Washington DC';
$Florida = 'Florida';
$California = 'California';
$one = 1;
$two = 2;
$three = 3;
$four = 4;
$five = 5;
?>
<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([
['Task', 'Hours per Day'],
['$Utha', $one],
['$Ilinois', $two],
['$Florida', $three],
['$California', $four],
['$WD', $five]
]);
var options = {
title: 'My Daily Activities',
is3D: true,
};
var chart = new google.visualization.PieChart(document.getElementById('piechart_3d'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="piechart_3d" style="width: 900px; height: 500px;"></div>
</body>
</html>