-
Notifications
You must be signed in to change notification settings - Fork 1
/
waterTemp.php
101 lines (94 loc) · 3.63 KB
/
waterTemp.php
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
<?php
$dataPoints = array();
$y = 28;
for ($i = 0; $i < 10; $i++) {
$y += rand(-1, 1) * 0.1;
array_push($dataPoints, array("x" => $i, "y" => $y));
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="styles/style.css">
<title>Document</title>
</head>
<body>
<nav>
<section>
<h2>Dashboard</h2>
<i class="fas fa-leaf"></i>
</section>
<section>
<h5>Admin</h5>
<i class="fas fa-user-shield" id="admin-ico"></i>
</section>
</nav>
<div class="container">
<div class="navLinks">
<ul>
<li><i class="fas fa-th-large"></i> <a href="index.php">Dashboard</a></li>
<br />
<small>Statistics</small>
<li>
<i class="fas fa-temperature-low"></i> <a href="temp.php">Temperature</a>
</li>
<li><i class="fas fa-tint"></i> <a href="humidity.php">Humidity</a></li>
<li><i class="fas fa-percentage"></i> <a href="">NPK</a></li>
<li><i class="fad fa-dewpoint"></i> <a href="waterTemp.php">Water Temperature</a></li>
<li><i class="fas fa-ruler-horizontal"></i> <a href="ph.php">pH</a></li>
<li><i class="fas fa-heat"></i> <a href="co2.php">CO2</a></li>
<br />
<small>View</small>
<li><i class="fas fa-eye"></i> <a href="camera.php">Observe</a></li>
<br />
<li><i class="fas fa-sign-out-alt"></i> <a href="">Logout</a></li>
</ul>
</div>
<div class="navContent">
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
<script>
window.onload = function() {
var dataPoints = <?php echo json_encode($dataPoints, JSON_NUMERIC_CHECK); ?>;
var chart = new CanvasJS.Chart("chartContainer", {
theme: "light2",
title: {
text: "Water Temperature"
},
axisX: {
title: "Time in millisecond"
},
axisY: {
suffix: " °C"
},
data: [{
type: "line",
yValueFormatString: "#,##0.0#",
toolTipContent: "{y} °C",
dataPoints: dataPoints
}]
});
chart.render();
var updateInterval = 1500;
setInterval(function() {
updateChart()
}, updateInterval);
var xValue = dataPoints.length;
var yValue = dataPoints[dataPoints.length - 1].y;
function updateChart() {
yValue += (Math.random() - 0.5) * 0.1;
dataPoints.push({
x: xValue,
y: yValue
});
xValue++;
chart.render();
};
}
</script>
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<script src="https://kit.fontawesome.com/56016c02ef.js" crossorigin="anonymous"></script>
</body>
</html>