Good morning, I am making an application in PHP
and Mysql
to manage the reports attended in a customer service office of a water and sanitation services company. At the moment I am trying to generate graphical statistical reports using Google Chart
and I have problems generating a grafico de barras
.
I need a graphic like this:
but the code used is throwing me the following graph:
the code used is the following:
PHP query ("SELECT service, status, count (status) as SUBTOTAL FROM report GROUP by service, status"); ? >
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="js/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['servicio', 'TOTAL'],
<?php
if($resulta_estatus->num_rows > 0){
while($row = $resulta_estatus->fetch_assoc()){
echo "['".$row['estatus']."', ".$row['SUBTOTAL']."],";
}
}
?>
]);
var options = {
title: 'Indicador de Gestion Mensual',
hAxis: {title: 'Tipo de Servicio', titleTextStyle: {color: 'red'}}
};
var chart = new google.visualization.ColumnChart(document.getElementById('piechart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="piechart"></div>
</body>
</html>
Thankful for any help you can give me