-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
70 lines (70 loc) · 1.79 KB
/
index.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
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-41757885-3"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-41757885-3');
</script>
<script type="text/javascript" src="https://pubnub.github.io/eon/v/eon/1.0.0/eon.js"></script>
<link type="text/css" rel="stylesheet" href="https://pubnub.github.io/eon/v/eon/1.0.0/eon.css" />
<div id="chart"></div>
<script type="text/javascript">
var __eon_pubnub = new PubNub({
subscribeKey: "sub-c-f6b3e9d0-83b9-11e8-ac0f-0e4b9865ddaa" // Replace with your key from your PubNub Developer Portal. https://admin.pubnub.com/
});
var __eon_cols = ["uvindex"];
var __eon_labels = {"uvindex":"UV Index"};
chart = eon.chart({
pubnub: __eon_pubnub,
channels: ["uvindex"],
history: true,
flow: false,
rate: 2000,
limit: 5,
generate: {
bindto: "#chart",
data: {
colors: {"UV Index":"#ff0000","uvindex":"#1f77b4"},
type: "area"
},
axis: {
x: {
label: "",
tick: {
format: '%H:%M'
}
},
y: {
label: ""
}
},
grid: {
x: {
show: true
},
y: {
show: true
}
},
tooltip: {
show: true
},
point: {
show: true
}
},
transform: function(message) {
var message = eon.c.flatten(message.eon);
var o = {};
for(index in message) {
if(__eon_cols.indexOf(index) > -1){
o[__eon_labels[index] || index] = message[index];
}
}
return {
eon: o
};
}
});
</script>