-
Notifications
You must be signed in to change notification settings - Fork 3
/
example_aw.js
49 lines (41 loc) · 996 Bytes
/
example_aw.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*global $, HistoryBuffer*/
/*jshint browser: true*/
$(function () {
'use strict';
var plot;
var buffer = new HistoryBufferWaveform(10, 1);
var globalIndex = 0;
var chartStep = 0.01;
var arr = [];
function updateData() {
var sin,
AWdata = [];
for (var i = 0; i < 512; i++) {
sin = Math.sin(globalIndex * chartStep);
globalIndex++;
AWdata.push(sin);
}
var aw = new NIAnalogWaveform({t0: globalIndex/256,Y:AWdata, dt:0.001});
buffer.push(aw);
}
plot = $.plot('#placeholder', [[]], {
series: {
historyBuffer: buffer,
lines: {
show: true,
//lineWidth: 1
},
shadowSize: 0
},
legend: {
show: false
},
xaxis: {
show: true
},
yaxis: {
show: true
}
});
setInterval(updateData, 1);
});