-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
86 lines (68 loc) · 2.21 KB
/
index.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
<!doctype html>
<html>
<head>
<title>Line Chart</title>
<style>
canvas{
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
</style>
<script>
arr =[0,0];
chrtinfo=[0];
chrtinfo.pop();
</script>
</head>
<body>
<div style="width:75%;">
<canvas id="myChart" width="800" height="450"></canvas>
</div>
<canvas id="line-chart" width="800" height="450"></canvas>
<input type="file" onchange="loadFile(this.files[0])">
<input type="button" title="Affiche" style="width: 100px" onclick="afficharr()">
<br>
<pre id="output"></pre>
</body>
<script>
function afficharr(){
// Vide la premiere donee des datasets
for (t = 0; t < (myChart2.data.datasets.length)-1; t++) {
while ((myChart2.data.datasets[t].data.length)!= 0){
myChart2.data.datasets[t].data.pop();
}
};
// Vide les timestamps
while ((myChart2.data.labels.length)!= 0){
myChart2.data.labels.pop();
}
for (f=0;f<(arr[0].length);f++) {
// Affiche un log de ce qui va etre enregistré pour le debug
// for (t = 0; t < (arr[0].length)-1; t++) {
// console.log(arr[0][f].split(",")[t],t,f);
// chrtinfo.push(arr[0][f].split(",")[t]);
//
//
// }
// Classe et mets les données dans les datasets
myChart2.data.labels.push(arr[0][f].split(",")[0]);
myChart2.data.datasets[1].data.push(arr[0][f].split(",")[1]);
myChart2.data.datasets[2].data.push(arr[0][f].split(",")[2]);
myChart2.data.datasets[3].data.push(arr[0][f].split(",")[3]);
myChart2.data.datasets[4].data.push(arr[0][f].split(",")[4]);
myChart2.data.datasets[5].data.push(arr[0][f].split(",")[5]);
myChart2.data.datasets[6].data.push(arr[0][f].split(",")[6]);
}
for (f=0;f<arr[1].length;f++) {
// Mets les etiquettes de temps
myChart2.data.datasets[f].label=arr[1][f];
}
myChart2.update();
};
</script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.6/Chart.bundle.min.js"></script>
<script type="text/javascript" src='js/vendor/csvToArray.js'></script>
<script type="text/javascript" src='traitDonn.js'></script>
<script src="line.js"></script>
</html>