-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
159 lines (146 loc) · 3.16 KB
/
index.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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
var dayData = {
labels: [
"bat"
],
datasets: [
{
data: [20, 80],
backgroundColor: [
"#0AD69C",
"#455a64"
],
hoverBackgroundColor: [
"#0AD69C",
"#455a64"
],
borderWidth: [
0, 0
]
}]
};
var hmdData = {
labels: [
"hmd"
],
datasets: [
{
data: [70, 30],
backgroundColor: [
"#0C85E9",
"#455a64"
],
hoverBackgroundColor: [
"#0C85E9",
"#455a64"
],
borderWidth: [
0, 0
]
}]
};
var tempData = {
labels: [
"temp"
],
datasets: [
{
data: [76, 38],
backgroundColor: [
"#FF6542",
"#455a64"
],
hoverBackgroundColor: [
"#FF6542",
"#455a64"
],
borderWidth: [
0, 0
]
}]
};
var gaugeOpt = {
cutoutPercentage: 85,
animation: {
animationRotate: true,
duration: 2000
},
legend: {
display: false
},
tooltips: {
enabled: false
}
};
var trendOpt = {
legend: {
display: false
},
scales: {
display: false,
xAxes: [{
ticks: {
display: false
},
gridLines: {
display: false
}
}],
yAxes: [{
ticks: {
display: false
},
gridLines: {
display: false
}
}]
}
};
var hTrendData = {
"labels":["January","February","March","April","May","June","July"],
"datasets":[{
"label":"Humidity Trend",
"data":[65,59,80,81,56,55,40],
"backgroundColor":"#0C85E9",
"fill":false,
"borderColor":"#0C85E9",
"borderWidth": 2,
"pointRadius": 0,
"lineTension":0.1}]
};
var tTrendData = {
"labels":["January","February","March","April","May","June","July"],
"datasets":[{
"label":"Temperature Trend",
"data":[65,59,80,81,56,55,40],
"backgroundColor":"#FF6542",
"fill":false,
"borderColor":"#FF6542",
"borderWidth": 2,
"pointRadius": 0,
"lineTension":0.1}]
};
var chart = new Chart($('#dayGauge'), { // day gauge
type: 'doughnut',
data: dayData,
options: gaugeOpt
});
var chart = new Chart($('#hmdGauge'), { // humidity gauge
type: 'doughnut',
data: hmdData,
options: gaugeOpt
});
var chart = new Chart($('#tempGauge'), { // temperature gauge
type: 'doughnut',
data: tempData,
options: gaugeOpt
});
var hTrendChart = new Chart("hmdTrend", { // humidity trend graph
type: 'line',
data: hTrendData,
options: trendOpt
});
var tTrendChart = new Chart("tempTrend", { // temperature trend graph
type: 'line',
data: tTrendData,
options: trendOpt
});