Home > Blogosphere > Contoh Script Parsing Jumlah Operator Pada Gammu

Contoh Script Parsing Jumlah Operator Pada Gammu

November 18th, 2015 Leave a comment Go to comments

Langsung saja saya berikan contoh JQuery untuk menghasilkan Chart/Grafik Jumlah Operator Pada Gammu seperti ini

sms-operator

$interval = $_POST[‘interval’];

$sqlmasuk1 = “SELECT count(DISTINCT sentitems.destinationnumber) as tes FROM sentitems WHERE sentitems.destinationnumber LIKE ‘0811%’
OR sentitems.destinationnumber LIKE ‘0812%’
OR sentitems.destinationnumber LIKE ‘0813%’
OR sentitems.destinationnumber LIKE ‘0821%’
OR sentitems.destinationnumber LIKE ‘0822%’
OR sentitems.destinationnumber LIKE ‘0823%’
OR sentitems.destinationnumber LIKE ‘0852%’
OR sentitems.destinationnumber LIKE ‘0853%'”;
$resultmasuk1 = $conn->query($sqlmasuk1);
$row1 = $resultmasuk1->fetch_array();
$classId1 = $row1[0];

$sqlmasuk2 = “SELECT count(DISTINCT sentitems.destinationnumber) as tes FROM sentitems WHERE sentitems.destinationnumber LIKE ‘0814%’
OR sentitems.destinationnumber LIKE ‘0815%’
OR sentitems.destinationnumber LIKE ‘0816%’
OR sentitems.destinationnumber LIKE ‘0858%’
OR sentitems.destinationnumber LIKE ‘0856%’
OR sentitems.destinationnumber LIKE ‘0855%’
OR sentitems.destinationnumber LIKE ‘0857%'”;
$resultmasuk2 = $conn->query($sqlmasuk2);
$row2 = $resultmasuk2->fetch_array();
$classId2 = $row2[0];

$sqlmasuk3 = “SELECT count(DISTINCT sentitems.destinationnumber) as tes FROM sentitems WHERE sentitems.destinationnumber LIKE ‘0817%’
OR sentitems.destinationnumber LIKE ‘0818%’
OR sentitems.destinationnumber LIKE ‘0819%’
OR sentitems.destinationnumber LIKE ‘0859%’
OR sentitems.destinationnumber LIKE ‘0877%’
OR sentitems.destinationnumber LIKE ‘0878%’
OR sentitems.destinationnumber LIKE ‘0879%'”;
$resultmasuk3 = $conn->query($sqlmasuk3);
$row3 = $resultmasuk3->fetch_array();
$classId3 = $row3[0];

$sqlmasuk4 = “SELECT count(DISTINCT sentitems.destinationnumber) as tes FROM sentitems WHERE sentitems.destinationnumber LIKE ‘0896%’
OR sentitems.destinationnumber LIKE ‘0897%’
OR sentitems.destinationnumber LIKE ‘0898%’
OR sentitems.destinationnumber LIKE ‘0899%'”;
$resultmasuk4 = $conn->query($sqlmasuk4);
$row4 = $resultmasuk4->fetch_array();
$classId4 = $row4[0];

$label1 = “”TELKOMSEL””;
$label2 = “”INDOSAT””;
$label3 = “”XL””;
$label4 = “”TRI””;
$conn->close();
?>
Bar Chart
http://Chart.js

var randomScalingFactor = function(){ return Math.round(Math.random()*100)};

var barChartData = {
labels : [],
datasets : [
{
label: “Masuk”,
fillColor : “rgba(0,255,0,0.6)”,
strokeColor : “rgba(0,0,255,0.5)”,
highlightFill: “rgba(220,220,220,0.75)”,
highlightStroke: “rgba(220,220,220,1)”,
data : []
} /*,
{
label: “Keluar”,
fillColor : “rgba(151,187,205,0.5)”,
strokeColor : “rgba(151,187,205,0.8)”,
highlightFill : “rgba(151,187,205,0.75)”,
highlightStroke : “rgba(151,187,205,1)”,
data : []
}*/
]

}
window.onload = function(){
var ctx = document.getElementById(“canvas”).getContext(“2d”);
window.myBar = new Chart(ctx).Bar(barChartData, {
animationSteps: 10,
barValueSpacing : 2,
barDatasetSpacing : 0,
barStrokeWidth : 1,
responsive : true
});
}

  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.