-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewgrafik.php
52 lines (47 loc) · 1.65 KB
/
viewgrafik.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
<?php
include 'plugins/config.php';
$select = "SELECT asal, COUNT(*) as jumlah FROM tamu GROUP BY asal";
// $select1 = "SELECT kelompok, COUNT(*) as jumlah FROM inovasi GROUP BY kelompok";
// $select2 = "SELECT asal_peserta FROM inovasi WHERE asal_peserta<>'internal' GROUP BY asal_peserta";
// $select3 = "SELECT COUNT(*) as jumlah FROM inovasi WHERE asal_peserta<>'internal' GROUP BY asal_peserta";
$select_act = mysqli_query($con, $select);
// $select_act1 = mysqli_query($con, $select1);
// $select_nmkabkota = mysqli_query($con, $select2);
// $select_jmlinov_kabkota = mysqli_query($con, $select3);
if($select_act->num_rows>0){
//--untuk merender grafik menggunakan library highcharts.js--
echo"
$('#grafik-asal').highcharts({
chart: {
backgroundColor: null
},
title: {
text: false
},
series: [{
type: 'pie',
name: 'Jumlah pengunjung',
data: [
";
while($row=$select_act->fetch_assoc()){
echo "
{y: ".$row['jumlah'].", name: '".$row['asal']."'},
";
}
echo"
],
//size: 150,
showInLegend: true,
dataLabels: {
color: '#761c19',
enabled: true,
format: '{point.y:.0f}' // no decimal
}
}]
});
";
//--untuk merender grafik menggunakan library highcharts.js--
}
else{
echo "$('#grafik-asal').html('Tidak ada data.')";
}