-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraf_usuarios.php
62 lines (52 loc) · 1.79 KB
/
graf_usuarios.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php include(SQL_PATH."select.php"); ?>
<!--Div that will hold the pie chart-->
<div id="chart_div_usuarios"></div>
<script type="text/javascript">
// Load the Visualization API and the corechart package.
google.charts.load('current', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.charts.setOnLoadCallback(drawChartMaterias);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChartMaterias() {
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
<?php $totalPergunta = 0;
while($row_RsRegiao = mysqli_fetch_assoc($RsRegiao)){
$estado = $row_RsRegiao["estado"];
include(SQL_PATH."conta_users_uf.php");
while ($row_qtd_perguntasEstado = mysqli_fetch_assoc($qtd_perguntasEstado)){
$qtdPerguntas = $row_qtd_perguntasEstado['qtd_perguntas_estado'];
$totalPergunta = $totalPergunta + $qtdPerguntas;
}
echo "['";
echo ($estado);
echo "',";
echo ($qtdPerguntas);
echo "],";
}
while ($row_qtd_perguntas = mysqli_fetch_assoc($qtd_perguntas)){
$qtdTotalPerguntas = $row_qtd_perguntas['qtdTotalPerguntas'];
}
$total = $qtdTotalPerguntas - $totalPergunta;
if($total != 0){
echo "['";
echo "Não Informado";
echo "',";
echo ($total);
echo "],";
}?>
]);
// Set chart options
var options = {'title':'Usuários por estado',
'width':300,
'height':300};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('chart_div_usuarios'));
chart.draw(data, options);
}
</script>