Postingan lainnya
Memasukkan data ke dalam chart
Assalamulaikum mau nanya sya ada query sperti ini cara memasukkan ke dalam chart pie bagaimana ya?
SELECT
DATE_FORMAT(tgl,'%Y-%m-%d') AS periode,
SUM(IF(ttr<=15,1,0)) AS ttr_15,
SUM(IF(ttr>15 AND ttr<=30,1,0)) AS ttr_15_30,
SUM(IF(ttr>30 AND ttr<=60,1,0)) AS ttr_30_60,
SUM(IF(ttr>60,1,0)) AS ttr_60
FROM(
SELECT
`trouble_no` AS tiket,
ROUND(TIMESTAMPDIFF(SECOND,in_timestamp,out_timestamp)/60,2) AS ttr,
in_timestamp AS tgl
FROM wifi_nossa.`user_tiket`
WHERE STATUS='complete'
AND out_timestamp IS NOT NULL
) AS us
WHERE DATE_FORMAT(tgl,'%Y-%m-%d') BETWEEN
DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -1 DAY),'%Y-%m-%d')
AND
DATE_FORMAT(CURDATE(),'%Y-%m-%d')
GROUP BY periode;
$query1 = "SELECT
DATE_FORMAT(tgl,'%Y-%m-%d') AS periode,
SUM(IF(ttr<=15,1,0)) AS ttr_15,
SUM(IF(ttr>15 AND ttr<=30,1,0)) AS ttr_15_30,
SUM(IF(ttr>30 AND ttr<=60,1,0)) AS ttr_30_60,
SUM(IF(ttr>60,1,0)) AS ttr_60
FROM(
SELECT
`trouble_no` AS tiket,
ROUND(TIMESTAMPDIFF(SECOND,in_timestamp,out_timestamp)/60,2) AS ttr,
in_timestamp AS tgl
FROM wifi_nossa.`user_tiket`
WHERE STATUS='complete'
AND out_timestamp IS NOT NULL
) AS us
WHERE DATE_FORMAT(tgl,'%Y-%m-%d') BETWEEN
DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -1 DAY),'%Y-%m-%d')
AND
DATE_FORMAT(CURDATE(),'%Y-%m-%d')
GROUP BY periode";
$eksekusi1 = mysql_query($query1, $db_local);
$jumlah1 = mysql_num_rows($eksekusi1);
$jml1 = $jumlah1/$jumlah;
<script type="text/javascript">
// Build the chart
$(function () {
$('#container').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: 'TTR Crew Hari Ini <?php echo $jumlah;?> Ticket'
},
subtitle: {
text: 'Source: TEs'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
}
},
series: [{
name: 'Persentase',
colorByPoint: true,
data: [{
name: '0-5 Menit : <br> <?php echo $jumlah1;?> Ticket',
y : <?php echo $jml1;?>,
sliced: true,
selected: true
}]
});
});
</script>
1
Belum ada Jawaban. Jadi yang pertama Jawaban
Login untuk ikut Jawaban