-
Notifications
You must be signed in to change notification settings - Fork 2
/
ethereum.html
executable file
·76 lines (71 loc) · 1.92 KB
/
ethereum.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
<!DOCTYPE HTML>
<html>
<head>
<title>eth data</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.0/p5.js"></script>
<script>
var the=0;
function setup(){
}
window.onload = function () {
var dps = []; // dataPoints
var chart = new CanvasJS.Chart("chartContainer", {
title :{
text: "REAL TIME ETHEREUM STATISTICS"
},
axisY: {
includeZero: false
},
data: [{
type: "line",
dataPoints: dps
}]
});
var mn=0;
function gotData(data)
{
//console.log(weather.USD);
//var hell = weather.USD;
the = data.USD;
}
var xVal = 0;
var yVal = 7000;
var updateInterval = 5000;
var dataLength = 10; // number of dataPoints visible at any point
//console.log(weather.USD);
var updateChart = function (count) {
//loadJSON('https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD',gotData);
loadJSON('https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD',gotData);
//console.log();
//console.log(weather/1000);
count = count || 1;
for (var j = 0; j < count; j++) {
//console.log(hello/1000);
yVal = the;//Math.round(5 + Math.random() *(-5-5))
mn = the;
if(the > mn)
{
mn = the;
}
dps.push({
x: xVal,
y: yVal
});
xVal+=1;
}
console.log(mn);
if (dps.length > dataLength) {
dps.shift();
}
chart.render();
};
updateChart(dataLength);
setInterval(function(){updateChart()}, updateInterval);
}
</script>
</head>
<body>
<div id="chartContainer" style="height: 800px; width:50%;"></div>
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
</body>
</html>