-
Notifications
You must be signed in to change notification settings - Fork 0
/
report.html
107 lines (98 loc) · 2.19 KB
/
report.html
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<html>
<head>
<script src="https://www.gstatic.com/firebasejs/5.8.1/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyCSfC-KKmL-pw-c6PpqPUv3j0kiFizhUtc",
authDomain: "rlstats-594fd.firebaseapp.com",
databaseURL: "https://rlstats-594fd.firebaseio.com",
projectId: "rlstats-594fd",
storageBucket: "rlstats-594fd.appspot.com",
messagingSenderId: "223443638938"
};
firebase.initializeApp(config);
record="";
samer="";
for(var a=0;a<=100;a++)
{
firebase.database().ref('RLv1-Max/' + a).once('value').then(function(snapshot) {
if(snapshot.val()!=null)
record=record+snapshot.val()+",";
});
firebase.database().ref('RLv1-Same/' + a).once('value').then(function(snapshot) {
if(snapshot.val()!=null)
samer=samer+snapshot.val()+",";
});
}
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script>
</head>
<body>
<script type="text/javascript">
window.onload = function() {
setTimeout(function(){
console.log("WAITING");
record=record.split(",");
samer=samer.split(",");
console.log(record)
console.log(samer)
var config = {
type: 'line',
data: {
labels: record,
datasets: [{
label: 'Max',
backgroundColor: "#FF0000",
borderColor: "#FF0000",
data: record,
fill: false,
},
{
label: 'Same',
backgroundColor: "#FFFF00",
borderColor: "#FFFF00",
data: samer,
fill: false,
},]
},
options: {
responsive: true,
title: {
display: true,
text: 'Reinforcing 2048 - Report'
},
tooltips: {
mode: 'index',
intersect: false,
},
hover: {
mode: 'nearest',
intersect: true
},
scales: {
xAxes: [{
display: true,
scaleLabel: {
display: true,
labelString: 'Max'
}
}],
yAxes: [{
display: true,
scaleLabel: {
display: true,
labelString: 'Value'
}
}]
}
}
};
var ctx = document.getElementById('myChart').getContext('2d');
window.myLine = new Chart(ctx, config);
},2000);
};
</script>
<canvas id="myChart">asd</canvas>
</body>
</html>