forked from Basilskar/air-quality-monitoring-system
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplot_feels_like.js
64 lines (51 loc) · 1.06 KB
/
plot_feels_like.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
function plot2_feels_like(bs_feel) {
// Data for the chart
const len = bs_feel.length;
const div = Math.floor(len / 24);
let j = 0;
let num = 0;
xValues = [];
for (let i = 0; i < len - 1; i++) {
if (i == num && j != 24) {
xValues.push(`${j}:00`);
num += div;
j++;
}
else {
xValues.push("xx:" + i);
}
}
xValues.push('23:59');
// Trace for the chart
var trace = {
x: xValues,
y: bs_feel,
type: 'scatter',
mode: 'lines+markers',
marker: {
color: 'white',
size: 3
},
line: {
color: 'lightgreen' // Line color
}
};
// Data array
var data = [trace];
var layout = {
plot_bgcolor: 'black',
paper_bgcolor: 'black',
xaxis: {
color: 'white',
title: 'Time',
tickvals: ["0:00", "4:00", "8:00", "12:00", "16:00", "20:00", "23:59"]
},
yaxis: {
color: 'white', // Y-axis text color
title: 'Feels Like Temperature',
}
};
// Plot the chart
Plotly.newPlot('feel', data, layout);
}
// plot2_feels_like(bs_feel);