fhdfhdfhdfhdfhdfhdfdfhdfhdfhdhfdfhdfhdfhd dfhdfhdfhdfhdfhdfhdfhdfdfhdfhdfhdhfdfhdfhdfhdfh
| DIR:/home/u1105814/public_html/monitoring_as400/dist/js/ |
| Current File : /home/u1105814/public_html/monitoring_as400/dist/js/rizki.js |
$(document).ready(function(){
$.getJSON({
url: "https://lcmshipping.co.id/test/tampil.php",
method: "GET",
success: function(data) {
console.log(data);
var player = [];
var score = [];
$.each(data, function(key, value){
player.push("Player "+value[0]);
score.push(parseInt(value[1]));
});
var chartdata = {
labels: player,
datasets : [
{
label: 'Player Score',
backgroundColor: 'rgba(200, 200, 200, 0.75)',
borderColor: 'rgba(200, 200, 200, 0.75)',
hoverBackgroundColor: 'rgba(200, 200, 200, 1)',
hoverBorderColor: 'rgba(200, 200, 200, 1)',
data: score
}
]
};
var ctx = $("#mycanvas");
var barGraph = new Chart(ctx, {
type: 'line',
data: chartdata
});
},
error: function(data) {
console.log(data);
}});
updateChart();
});
function updateChart()
{
var x=2;
$(document).ready(function(){
$.getJSON({
url: "http://localhost/chartJS/data.php?x="+x,
method: "GET",
success: function(data) {
console.log(data);
var player = [];
var score = [];
$.each(data, function(key, value){
player.push("Player "+value[0]);
score.push(value[1]);
});
var chartdata = {
labels: player,
datasets : [
{
label: 'Player Score',
backgroundColor: 'rgba(200, 200, 200, 0.75)',
borderColor: 'rgba(200, 200, 200, 0.75)',
hoverBackgroundColor: 'rgba(200, 200, 200, 1)',
hoverBorderColor: 'rgba(200, 200, 200, 1)',
data: score
}
]
};
var ctx = $("#mycanvas");
var barGraph = new Chart(ctx, {
type: 'line',
data: chartdata,
});
},
error: function(data) {
console.log(data);
}
});
});
setTimeout(function(){updateChart()}, 1000);
} |