forked from fchollet/hualos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
63 lines (57 loc) · 1.56 KB
/
test.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
<head>
<link href="/static/css/c3.min.css" rel="stylesheet">
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/d3.min.js"></script>
<script type="text/javascript" src="/static/js/c3.min.js"></script>
</head>
<body>
<div class="container">
<h1>Keras - Total Visualization Project</h1>
<h2>Initial tests</h2>
<hr>
<div id="visualization"></div>
</div>
</body>
<script type="text/javascript">
$(document).ready(function(){
var monitored = {};
var source = new EventSource('/subscribe/epoch/end/');
var chart = null;
source.addEventListener('message', function(e) {
console.log(e.data);
var data = JSON.parse(e.data);
console.log(data);
if (chart === null) {
for (key in data) {
monitored[key] = [key, data[key]];
}
var columns = [];
for (key in monitored) {
columns.push(monitored[key]);
}
chart = c3.generate({
bindto:'#visualization',
data: {
x: 'epoch',
columns: columns
}
});
}
else {
for (key in data) {
if (key in monitored) {
monitored[key].push(data[key]);
}
var columns = [];
for (key in monitored) {
columns.push(monitored[key]);
}
chart.load({
columns: columns
});
}
}
}, false);
});
</script>