From 3186fa8fb70a13cb29c91ba7911586674f741c0c Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Fri, 17 Mar 2017 10:55:34 +0100 Subject: [PATCH] Button to show all datasets Also #46 --- static/slaveDisplay.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/static/slaveDisplay.js b/static/slaveDisplay.js index 741e6012..b662a547 100644 --- a/static/slaveDisplay.js +++ b/static/slaveDisplay.js @@ -23,6 +23,7 @@ setTimeout(function() { HTML += "

ID: " + slaveData[key].unique + "

Last seen: "+seenDate+"

IP: "+slaveData[key].publicIP +":"+ slaveData[key].serverPort+"

" HTML += "

Host: "+slaveData[key].mac+"

"; HTML += ""; + HTML += ""; HTML += ""; } } @@ -46,8 +47,8 @@ setTimeout(function() { // ID of slave, ID of canvasjs div without # function makeGraph(slaveID, selector) { post("api/getStats", {slaveID: slaveID}, function(data){ - console.log("Building chart " + slaveID + " with this data:") - console.log(data) + //console.log("Building chart " + slaveID + " with this data:") + //console.log(data) if(data.length > 0) { // find keys let itemNames = []; @@ -156,6 +157,17 @@ function hideAllDatasets(chartID) { return false; } } +function showAllDatasets(chartID) { + if(chartsByID[chartID]) { + let chart = chartsByID[chartID]; + for(let i = 0; i < chart.options.data.length; i++) { + chart.options.data[i].visible = true; + } + chart.render(); + } else { + return false; + } +} // function to sort arrays of objects after a keys value function sortByKey(array, key) {