|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
window.onload = function () {
|
|
|
|
|
function dashboard () {
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayersPseudo', true);
|
|
|
|
|
xhr.responseType = 'text';
|
|
|
|
@ -9,45 +9,83 @@ window.onload = function () {
|
|
|
|
|
xhr.send(null);
|
|
|
|
|
data = [];
|
|
|
|
|
|
|
|
|
|
if (players[0] != null) {
|
|
|
|
|
v = {}
|
|
|
|
|
v.type="line";
|
|
|
|
|
v.xValueFormatString=players[0];
|
|
|
|
|
v.dataPoints=[];
|
|
|
|
|
data.push(v);
|
|
|
|
|
if (players[1][0] != null) {
|
|
|
|
|
v1 = {}
|
|
|
|
|
v1.type="line";
|
|
|
|
|
v1.xValueFormatString=players[1][0];
|
|
|
|
|
v1.dataPoints=[];
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. players[0][0], true);
|
|
|
|
|
xhr.responseType = 'text';
|
|
|
|
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
|
|
|
var score = xhr.onload = function () {
|
|
|
|
|
return JSON.parse(xhr.responseText);
|
|
|
|
|
};
|
|
|
|
|
xhr.send(null);
|
|
|
|
|
for (i = 0; i < score.length; i++) {
|
|
|
|
|
v1.dataPoints.push({x:i+1,y:score[i]});
|
|
|
|
|
}
|
|
|
|
|
data.push(v1);
|
|
|
|
|
}
|
|
|
|
|
// v.dataPoints.push({x:0,y:0});
|
|
|
|
|
// v.dataPoints.push({x:0.5,y:300});
|
|
|
|
|
|
|
|
|
|
if (players[1] != null) {
|
|
|
|
|
v = {}
|
|
|
|
|
v.type="line";
|
|
|
|
|
v.xValueFormatString=players[1];
|
|
|
|
|
v.dataPoints=[];
|
|
|
|
|
data.push(v);
|
|
|
|
|
if (players[1][1] != null) {
|
|
|
|
|
v2 = {}
|
|
|
|
|
v2.type="line";
|
|
|
|
|
v2.xValueFormatString=players[1][1];
|
|
|
|
|
v2.dataPoints=[];
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. players[0][1], true);
|
|
|
|
|
xhr.responseType = 'text';
|
|
|
|
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
|
|
|
var score = xhr.onload = function () {
|
|
|
|
|
return JSON.parse(xhr.responseText);
|
|
|
|
|
};
|
|
|
|
|
xhr.send(null);
|
|
|
|
|
for (i = 0; i < score.length; i++) {
|
|
|
|
|
v2.dataPoints.push({x:i+1,y:score[i]});
|
|
|
|
|
}
|
|
|
|
|
data.push(v2);
|
|
|
|
|
}
|
|
|
|
|
// v.dataPoints.push({x:0,y:0});
|
|
|
|
|
// v.dataPoints.push({x:0.5,y:300});
|
|
|
|
|
|
|
|
|
|
if (players[2] != null) {
|
|
|
|
|
v = {}
|
|
|
|
|
v.type="line";
|
|
|
|
|
v.xValueFormatString=players[2];
|
|
|
|
|
v.dataPoints=[];
|
|
|
|
|
data.push(v);
|
|
|
|
|
if (players[1][2] != null) {
|
|
|
|
|
v3 = {}
|
|
|
|
|
v3.type="line";
|
|
|
|
|
v3.xValueFormatString=players[1][2];
|
|
|
|
|
v3.dataPoints=[];
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. players[0][2], true);
|
|
|
|
|
xhr.responseType = 'text';
|
|
|
|
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
|
|
|
var score = xhr.onload = function () {
|
|
|
|
|
return JSON.parse(xhr.responseText);
|
|
|
|
|
};
|
|
|
|
|
xhr.send(null);
|
|
|
|
|
for (i = 0; i < score.length; i++) {
|
|
|
|
|
v3.dataPoints.push({x:i+1,y:score[i]});
|
|
|
|
|
}
|
|
|
|
|
data.push(v3);
|
|
|
|
|
}
|
|
|
|
|
// v.dataPoints.push({x:0,y:0});
|
|
|
|
|
// v.dataPoints.push({x:0.5,y:300});
|
|
|
|
|
|
|
|
|
|
if (players[3] != null) {
|
|
|
|
|
v = {}
|
|
|
|
|
v.type="line";
|
|
|
|
|
v.xValueFormatString=players[3];
|
|
|
|
|
v.dataPoints=[];
|
|
|
|
|
data.push(v);
|
|
|
|
|
if (players[1][3] != null) {
|
|
|
|
|
v4 = {}
|
|
|
|
|
v4.type="line";
|
|
|
|
|
v4.xValueFormatString=players[1][3];
|
|
|
|
|
v4.dataPoints=[];
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. players[0][3], true);
|
|
|
|
|
xhr.responseType = 'text';
|
|
|
|
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
|
|
|
var score = xhr.onload = function () {
|
|
|
|
|
return JSON.parse(xhr.responseText);
|
|
|
|
|
};
|
|
|
|
|
xhr.send(null);
|
|
|
|
|
for (i = 0; i < score.length; i++) {
|
|
|
|
|
v3.dataPoints.push({x:i+1,y:score[i]});
|
|
|
|
|
}
|
|
|
|
|
data.push(v4);
|
|
|
|
|
}
|
|
|
|
|
// v.dataPoints.push({x:0,y:0});
|
|
|
|
|
// v.dataPoints.push({x:0.5,y:300});
|
|
|
|
|
|
|
|
|
|
console.log(data);
|
|
|
|
|
|
|
|
|
@ -77,4 +115,10 @@ window.onload = function () {
|
|
|
|
|
data
|
|
|
|
|
});
|
|
|
|
|
chart.render();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.addEventListener("load", start);
|
|
|
|
|
function start(){
|
|
|
|
|
setInterval('dashboard()', 1000);
|
|
|
|
|
|
|
|
|
|
}
|