-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchartscript.js
33 lines (31 loc) · 988 Bytes
/
chartscript.js
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
var randomScalingFactor = function(){ return Math.round(Math.random()*100)};
var lineChartData = {
labels : [" "," "," "," "," "," ",time],
datasets : [
{
label: "My First dataset",
fillColor : "rgba(220,220,220,0.2)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
pointHighlightFill : "#fff",
pointHighlightStroke : "rgba(220,220,220,1)",
data : ["0","0","0","0","0","0",dB2]
}
]
}
window.onload = function(){
var ctx = document.getElementById("canvas").getContext("2d");
window.myLine = new Chart(ctx).Line(lineChartData, {
responsive: true,
scaleShowGridLines : false,
pointDot : false,
scaleOverride: true, scaleStartValue: 0, scaleStepWidth: 20, scaleSteps: 5
});
}
var index = 1;
setInterval(function() {
myLine.removeData();
myLine.addData([dB2],time);
index++;
}, 1000);