-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclassement.html
More file actions
35 lines (32 loc) · 1.08 KB
/
classement.html
File metadata and controls
35 lines (32 loc) · 1.08 KB
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Classement</title>
<script src="http://d3js.org/d3.v2.js"></script>
</head>
<body>
<div id="classement">
</div>
<a href="resultat.html">Ajouter un résultat</a>
<script type="text/javascript">
d3.json("joueurs.json", function(data) {
var classement = [];
function compare(a, b) {
return b[1] - a[1];
}
console.log(data);
for(var i in data) {
classement.push([i, Math.ceil(data[i]['mu'] - data[i]['sigma']*2)]);
}
var ranks = classement.sort(compare);
var res = "<table><tr><td>#</td><td>joueur</td><td>BASS</td></tr>";
for (var i in ranks)
res += "<tr><td>"+(parseInt(i)+1)+"</td><td>"+ ranks[i][0] + "</td><td>" + ranks[i][1] + "</td></tr>";
res += "</table>";
document.getElementById("classement").innerHTML = res;
});
</script>
</body>
</html>