diff --git a/src/web/html/api.js b/src/web/html/api.js index 13ca50b5..de273e41 100644 --- a/src/web/html/api.js +++ b/src/web/html/api.js @@ -30,7 +30,7 @@ iconSuccess = [ "M10.97 4.97a.235.235 0 0 0-.02.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-1.071-1.05z" ]; - /** +/** * GENERIC FUNCTIONS */ function ml(tagName, ...args) { @@ -135,6 +135,32 @@ function toggle(id, cl="hide") { e.classList.remove(cl); } +function getCSV(url, ptr) { + var xhr = new XMLHttpRequest(); + if(xhr != null) { + xhr.open("GET", url, true); + xhr.onreadystatechange = q; + try { + xhr.send(); + } catch (error) { + console.log(error.message); + } + } + function q() { + if(xhr.readyState == 4) { + if(null != xhr.responseText) { + if(null != ptr) { + try { + ptr(xhr.responseText); + } catch (error) { + console.log(error.message); + } + } + } + } + } +} + function getAjax(url, ptr, method="GET", json=null) { var xhr = new XMLHttpRequest(); if(xhr != null) { @@ -142,13 +168,22 @@ function getAjax(url, ptr, method="GET", json=null) { xhr.onreadystatechange = p; if("POST" == method) xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); - xhr.send(json); + try { + xhr.send(json); + } catch (error) { + console.log(error.message); + } } function p() { if(xhr.readyState == 4) { if(null != xhr.responseText) { - if(null != ptr) - ptr(JSON.parse(xhr.responseText)); + if(null != ptr) { + try { + ptr(JSON.parse(xhr.responseText)); + } catch (error) { + console.log(error.message); + } + } } } } diff --git a/src/web/html/style.css b/src/web/html/style.css index bb231881..daf12d38 100644 --- a/src/web/html/style.css +++ b/src/web/html/style.css @@ -636,3 +636,9 @@ div.hr { margin-left: -5px; transform: translate(0,0px); } +#powerchart { + min-width: 310px; + max-width: 800px; + height: 300px; + margin: 0 auto; +} diff --git a/src/web/html/visualization.html b/src/web/html/visualization.html index de5b0069..acb0cfe0 100644 --- a/src/web/html/visualization.html +++ b/src/web/html/visualization.html @@ -6,13 +6,29 @@ + + + {#HTML_NAV}
+

Every seconds the values are updated

+ + + + + {#HTML_FOOTER}