save website from rpi
This commit is contained in:
112
web/index.html
112
web/index.html
@@ -5,26 +5,26 @@
|
||||
<script src="https://cdn.plot.ly/plotly-latest.min.js" charset="utf-8"></script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<title>Climate-Measuring-Box</title>
|
||||
<title>Node dev page</title>
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
|
||||
</head>
|
||||
</head>a
|
||||
|
||||
<body>
|
||||
<!-- Make a new header with a navigation bar -->
|
||||
<header>
|
||||
<nav class="navbar">
|
||||
<ul>
|
||||
<li><a href="climate-monitor.html">Monitoring</a></li>
|
||||
<li><a href="climate-monitor.html">Monitoring deez</a></li>
|
||||
<li><a href="Map.html">Map</a></li>
|
||||
<li><a onclick="serialConnect()" class="navRight">Connect to port</a></li>
|
||||
<li><a onclick="disconnect()" class="navRight">Disconnect from port</a></li>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<!-- Make a new flex container for the live data -->
|
||||
<div class="nodeData">
|
||||
<div class="flex-NodeData">
|
||||
<div class="flex-LiveData">
|
||||
<div>
|
||||
<div>Temperatuur: <p id="temperature">Not connected</p>
|
||||
@@ -55,14 +55,110 @@
|
||||
<p>Live graph:</p>
|
||||
<div id="liveGraph"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-NodeData">
|
||||
<div class="flex-LiveData">
|
||||
<div>
|
||||
<div>Time until POST request to API:<p id="cnt">Connect to port</p></div>
|
||||
<div>Temperatuur: <p id="temperature">Not connected</p>
|
||||
</div>
|
||||
<div class="statusElement">
|
||||
<p class="statusText" id="tempStatus">Not connected</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<p>API data:</p>
|
||||
<div id="apiGraph"></div>
|
||||
<div>Luchtvochtigheid: <p id="humidity">Not connected</p>
|
||||
</div>
|
||||
<div class="statusElement">
|
||||
<p class="statusText" id="humidStatus">Not connected</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>Lichtintensiteit: <p id="lightIntensity">Not connected</p>
|
||||
</div>
|
||||
<div class="statusElement">
|
||||
<p class="statusText" id="lightIntensityStatus">Not connected</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Make a new flexcontainer for the graphs and API request time -->
|
||||
<div class="flex-graph">
|
||||
<div>
|
||||
<p>Live graph:</p>
|
||||
<div id="liveGraph"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- class="nodeData" -->
|
||||
<div class="nodeData">
|
||||
<div class="flex-NodeData">
|
||||
<div class="flex-LiveData">
|
||||
<div>
|
||||
<div>Temperatuur: <p id="temperature">Not connected</p>
|
||||
</div>
|
||||
<div class="statusElement">
|
||||
<p class="statusText" id="tempStatus">Not connected</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>Luchtvochtigheid: <p id="humidity">Not connected</p>
|
||||
</div>
|
||||
<div class="statusElement">
|
||||
<p class="statusText" id="humidStatus">Not connected</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>Lichtintensiteit: <p id="lightIntensity">Not connected</p>
|
||||
</div>
|
||||
<div class="statusElement">
|
||||
<p class="statusText" id="lightIntensityStatus">Not connected</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Make a new flexcontainer for the graphs and API request time -->
|
||||
<div class="flex-graph">
|
||||
<div>
|
||||
<p>Live graph:</p>
|
||||
<div id="liveGraph"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <div class="flex-NodeData">
|
||||
<div class="flex-LiveData">
|
||||
<div>
|
||||
<div>Temperatuur: <p id="temperature">Not connected</p>
|
||||
</div>
|
||||
<div class="statusElement">
|
||||
<p class="statusText" id="tempStatus">Not connected</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>Luchtvochtigheid: <p id="humidity">Not connected</p>
|
||||
</div>
|
||||
<div class="statusElement">
|
||||
<p class="statusText" id="humidStatus">Not connected</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>Lichtintensiteit: <p id="lightIntensity">Not connected</p>
|
||||
</div>
|
||||
<div class="statusElement">
|
||||
<p class="statusText" id="lightIntensityStatus">Not connected</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Make a new flexcontainer for the graphs and API request time -->
|
||||
<div class="flex-graph">
|
||||
<div>
|
||||
<p>Live graph:</p>
|
||||
<div id="liveGraph"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- class="nodeData" -->
|
||||
|
||||
<!-- Include the js file -->
|
||||
<script src="main.js"></script>
|
||||
|
52
web/main.js
52
web/main.js
@@ -1,26 +1,29 @@
|
||||
let data;
|
||||
let measurements;
|
||||
let date;
|
||||
let value;
|
||||
let newArrayTemp = [];
|
||||
let newArrayHumid = [];
|
||||
let newArrayLight = [];
|
||||
let timeArray = []; // Array to store time values`
|
||||
let dateArray = [1,2,3];
|
||||
let valueArray = [1,2,3,4,5];
|
||||
let newValueArray = [4,5,6];
|
||||
let myValue = 1;
|
||||
|
||||
//const timeArray = [1,2,3,4];
|
||||
//const dateArray = [5,6,7,8];
|
||||
//const valueArray = [1,1,1,3];
|
||||
|
||||
// Make lines in the graph of the live data
|
||||
Plotly.plot("liveGraph", [
|
||||
{
|
||||
x: timeArray, // Use timeArray as x values
|
||||
y: newArrayTemp,
|
||||
y: valueArray,
|
||||
mode: "lines",
|
||||
line: { color: "#80CAF6" },
|
||||
name: "Temperature",
|
||||
},
|
||||
{
|
||||
x: timeArray, // Use timeArray as x values
|
||||
y: newArrayHumid,
|
||||
mode: "lines",
|
||||
line: { color: "#FFA500" },
|
||||
name: "Humidity",
|
||||
},
|
||||
{
|
||||
x: timeArray, // Use timeArray as x values
|
||||
y: newArrayLight,
|
||||
mode: "lines",
|
||||
line: { color: "#00FF00" },
|
||||
name: "Light / 100",
|
||||
},
|
||||
]);
|
||||
|
||||
let cnt = 0;
|
||||
@@ -28,10 +31,13 @@ let cnt = 0;
|
||||
// Update the graph every 1 ms
|
||||
let interval = setInterval(function () {
|
||||
var time = new Date();
|
||||
timeArray.push(new Date());
|
||||
|
||||
valueArray.push(Math.random() * 10);
|
||||
|
||||
var update = {
|
||||
x: [[time]],
|
||||
y: [[newArrayTemp], [newArrayHumid], [newArrayLight]],
|
||||
y: [[newValueArray]],
|
||||
};
|
||||
|
||||
var olderTime = time.setMinutes(time.getMinutes() - 1);
|
||||
@@ -45,19 +51,5 @@ let interval = setInterval(function () {
|
||||
};
|
||||
Plotly.relayout("liveGraph", minuteView);
|
||||
|
||||
apiGraph = document.getElementById("apiGraph");
|
||||
Plotly.newPlot(
|
||||
apiGraph,
|
||||
[
|
||||
{
|
||||
x: dateArray,
|
||||
y: valueArray,
|
||||
},
|
||||
],
|
||||
{
|
||||
margin: { t: 0 },
|
||||
}
|
||||
);
|
||||
|
||||
if (cnt === 100) clearInterval(interval);
|
||||
}, 1);
|
@@ -8,7 +8,7 @@ body {
|
||||
|
||||
h1 {
|
||||
opacity: 0.8;
|
||||
color: black;
|
||||
color: green;
|
||||
margin: auto;
|
||||
width: 50%;
|
||||
}
|
||||
@@ -49,6 +49,23 @@ body {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.flex-NodeData {
|
||||
display: flex;
|
||||
margin-left: 10%;
|
||||
margin-right: 10;
|
||||
height: 40%;
|
||||
flex-direction: column;
|
||||
border: 1px solid red;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.nodeData {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: row;
|
||||
border: 2px solid red;
|
||||
}
|
||||
|
||||
.flex-LiveData {
|
||||
display: flex;
|
||||
align-content: begin;
|
||||
@@ -59,7 +76,9 @@ body {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
|
||||
.flex-LiveData > div {
|
||||
|
||||
border: solid #1f82d3 2px;
|
||||
padding: 15px 0;
|
||||
font-size: 30px;
|
||||
|
Reference in New Issue
Block a user