diff --git a/tools/web_monitor/app.py b/tools/web_monitor/app.py index 14a30d4c..4e527be4 100644 --- a/tools/web_monitor/app.py +++ b/tools/web_monitor/app.py @@ -46,7 +46,7 @@ async def dashboard_websocket(websocket: WebSocket): all_miner_data.sort(key=lambda x: x["ip"]) await websocket.send_json({"datetime": datetime.datetime.now().isoformat(), "miners": all_miner_data}) - await asyncio.sleep(5) + await asyncio.sleep(.1) except WebSocketDisconnect: print("Websocket disconnected.") pass diff --git a/tools/web_monitor/templates/index.html b/tools/web_monitor/templates/index.html index ac51460f..8b825197 100644 --- a/tools/web_monitor/templates/index.html +++ b/tools/web_monitor/templates/index.html @@ -27,7 +27,6 @@ ws.onmessage = function(event) { document.getElementById(new_data["miners"][i]["ip"] + "_error").remove() } total_hashrate += parseFloat(new_data["miners"][i]["hashrate"]) - console.log(total_hashrate) } }; var chart = document.getElementById("line-chart") @@ -85,17 +84,34 @@ var minerDataChart = new Chart(document.getElementById("line-chart"), { borderColor: chartGradient, borderWidth: 1 }, + legend: { + labels: { + color: chartGradient + } + }, + tooltip: { + callbacks: { + label: function(data) { + return data.dataset.data[data.dataIndex] + " TH/s"; + } + } + } }, scales: { y: { min: 0, // minimum value suggestedMax: 100, - stepSize: 10 + stepSize: 10, + ticks: { + callback: function(value, index, ticks) { + return value + " TH/s"; + } + } }, x: { ticks: { maxTicksLimit: 6, - maxRotation: 0 + maxRotation: 0, } } } diff --git a/tools/web_monitor/templates/miner.html b/tools/web_monitor/templates/miner.html index d2cf9ee1..4ad19a79 100644 --- a/tools/web_monitor/templates/miner.html +++ b/tools/web_monitor/templates/miner.html @@ -121,14 +121,28 @@ var minerDataChart = new Chart(document.getElementById("line-chart"), { borderWidth: 1 }, legend: { - display: false + labels: { + color: chartGradient + } + }, + tooltip: { + callbacks: { + label: function(data) { + return data.dataset.data[data.dataIndex] + " TH/s"; + } + } } }, scales: { y: { min: 0, // minimum value suggestedMax: 10, - stepSize: 1 + stepSize: 1, + ticks: { + callback: function(value, index, ticks) { + return value + " TH/s"; + } + } }, x: { ticks: {