-
Notifications
You must be signed in to change notification settings - Fork 0
/
Table.html
executable file
·55 lines (50 loc) · 1.14 KB
/
Table.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
<!DOCTYPE HTML>
<html>
<head>
<script>
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
zoomEnabled: true,
title:{
text: "Try Zooming and Panning"
},
axisY :{
includeZero:false
},
data: data // random generator below
});
chart.render();
}
var limit = 1000;
var y = 0;
var data = [];
var dataSeries = { type: "line" };
var dataPoints = [];
var temp=[];
const Http=new XMLHttpRequest();
const url='http://127.0.0.1:5000/keyboard/';
Http.open("GET", url);
Http.send();
Http.onreadystatechange=(e)=>{
temp=JSON.parse(Http.responseText);
var limit=temp.length;
dataPoints=[];
for (var i = 1; i < limit; i += 100) {
//y += (Math.random() * 10 - 5);
console.log(temp[i]);
dataPoints.push({
x: parseInt(temp[i].quantity),
y: parseInt(temp[i].price)
});
}
dataSeries.dataPoints = dataPoints;
data.push(dataSeries);
}
</script>
<script type="text/javascript" src="https://canvasjs.com/assets/script/canvasjs.min.js"></script></head>
<body>
<div id="chartContainer" style="height: 300px; width: 100%;">
</div>
</body>
</html>