-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathartificial.js
29 lines (27 loc) · 1.01 KB
/
artificial.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
function gauss(x, a, s) {
return Math.exp(-(x - a) * (x - a) / s);
}
var a = {}
for (j = 0; j < 1440; j++) {
a[j] = {
0: 67 * gauss(j, 1220, 1e5) * ( 1 + gauss(Math.floor(Math.random() * 4), 0, 1) / 2),
1: 92 * gauss(j, 400, 1e5) * ( 1 + gauss(Math.floor(Math.random() * 4), 0, 1) / 3),
2: 75 * gauss(j, 1040, 1e5) * ( 1 + gauss(Math.floor(Math.random() * 4), 0, 1) / 2),
3: 198 * gauss(j, 800, 6e5) * ( 1 + gauss(Math.floor(Math.random() * 4), 0, 1) / 5),
4: 311 * gauss(j, 680, 9e5) * ( 1 + gauss(Math.floor(Math.random() * 4), 0, 1) / 9),
5: (400 * gauss(j, 400, 1e5) + 600 * gauss(j, 1000, 1e5)) * ( 1 + gauss(Math.floor(Math.random() * 4), 0, 1) / 13),
}
}
var artificial = {
"name": "example stacked bars",
"type": "multibar",
"source-type": "artificial",
"max": 1400,
"min": 0,
"sum": 1624392,
"count": 1440,
"interval": 60,
"interval_start": +new Date(new Date(Date.now() - 86400000).toDateString())/1000,
"interval_end": +new Date(new Date().toDateString())/1000,
"data": a
}