| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <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>
- <select id="selector" onchange="document.location.href=document.location.href.split('#')[0]+'#'+this.value;run();"></select>
- <button onclick="document.getElementById('editor').hidden = false; this.hidden = true;" >Editor</button>
- <div id='editor' hidden='true'>
- <textarea id="cnsl">
- var hash = window.location.hash;
- console.log (hash);
- var d = new Date();
- var options="<option>Please Select...</option>";
- for (var i=0; i<27; i++) {
- var currentDate = new Date(d-i*60*60*24*1000);
- var option = currentDate.getFullYear()+"-"+(currentDate.getMonth()+1)+"-"+currentDate.getDate()
- options += "<option>"+option+"</option>\n";
- }
- document.getElementById("selector").innerHTML = options;
- var dateString = d.getFullYear() + "-" + (d.getMonth()+1) + "-" + d.getDate();
- if (hash!="") {
- dateString = hash.substring(1);
- }
- fetch('/fileserver/log/message/log_'+dateString+'.txt')
- .then(response => {
- // handle the response
- if (response.status == 404) {
- alert("no log data available for "+dateString);
- }
- 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
- console.log(error);
- alert("test");
- });
- </textarea><br />
- <button onclick="run();">run</button>
- </div>
- <script>run();</script>
- </body>
- </html>
|