mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-13 23:16:55 +03:00
made editor hidden as default
This commit is contained in:
62
sd-card/html/graph.html
Normal file
62
sd-card/html/graph.html
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src='https://cdn.plot.ly/plotly-2.14.0.min.js'></script>
|
||||||
|
<style>
|
||||||
|
textarea {
|
||||||
|
width: 600px;
|
||||||
|
height: 300px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
function run() {
|
||||||
|
var el = document.getElementById('cnsl');
|
||||||
|
el && eval(el.value);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id='chart'></div>
|
||||||
|
<button click="document.getElementById('editor').hidden = false; this.hidden = true;" >Editor</button>
|
||||||
|
<div id='editor' hidden='true'>
|
||||||
|
<textarea id="cnsl">
|
||||||
|
fetch('/fileserver/log/message/log_2022-10-15.txt')
|
||||||
|
.then(response => {
|
||||||
|
// handle the response
|
||||||
|
response.text()
|
||||||
|
.then( result => {
|
||||||
|
var lines = result.split("\n");
|
||||||
|
var trace = {
|
||||||
|
x: [],
|
||||||
|
y: [],
|
||||||
|
type: 'scatter'
|
||||||
|
};
|
||||||
|
|
||||||
|
var timex = 1;
|
||||||
|
for (let line of lines) {
|
||||||
|
if (line.includes("PostProcessing - Raw")) {
|
||||||
|
console.log(line);
|
||||||
|
var value = line.split(" ")[6];
|
||||||
|
var time = line.split(" ")[0];
|
||||||
|
console.log("> "+time+" "+value+"\n");
|
||||||
|
if (value<1000) {
|
||||||
|
trace.x.push(timex);
|
||||||
|
timex += 1;
|
||||||
|
trace.y.push(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(trace);
|
||||||
|
var data = [trace];
|
||||||
|
Plotly.newPlot('chart', data);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
// handle the error
|
||||||
|
out.value = "error";
|
||||||
|
});
|
||||||
|
</textarea><br />
|
||||||
|
<button onclick="run();">run</button>
|
||||||
|
</div>
|
||||||
|
<script>run();</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user