| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <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 onclick="document.getElementById('editor').hidden = false; this.hidden = true;" >Editor</button>
- <div id='editor' hidden='true'>
- <textarea id="cnsl">
- const d = new Date();
- var date = d.getFullYear() + "-" + (d.getMonth()+1) + "-" + d.getDate();
- fetch('/fileserver/log/message/log_'+date+'.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");
- 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>
|