From ae018acba482e7f3ea722dbe143f604052946ade Mon Sep 17 00:00:00 2001 From: Cryptkeeper Date: Mon, 1 Feb 2016 05:29:09 -0600 Subject: [PATCH] Load back the graph controls --- assets/js/site.js | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/assets/js/site.js b/assets/js/site.js index d9c459e..8a1590e 100644 --- a/assets/js/site.js +++ b/assets/js/site.js @@ -277,11 +277,27 @@ $(document).ready(function() { }); socket.on('historyGraph', function(rawData) { - displayedGraphData = rawData; + var shownServers = loadGraphControls(); + + if (shownServers) { + var keys = Object.keys(rawData); + + for (var i = 0; i < keys.length; i++) { + var name = keys[i]; + + if (shownServers.indexOf(name) !== -1) { + displayedGraphData[name] = rawData[name]; + } else { + hiddenGraphData[name] = rawData[name]; + } + } + } else { + displayedGraphData = rawData; + } $('#big-graph').css('height', '400px'); - historyPlot = $.plot('#big-graph', convertGraphData(rawData), bigChartOptions); + historyPlot = $.plot('#big-graph', convertGraphData(displayedGraphData), bigChartOptions); $('#big-graph').bind('plothover', handlePlotHover); @@ -293,7 +309,13 @@ $(document).ready(function() { keys.sort(); for (var i = 0; i < keys.length; i++) { - html += ' ' + keys[i] + ''; + var checkedString = ''; + + if (displayedGraphData[keys[i]]) { + checkedString = 'checked=checked'; + } + + html += ' ' + keys[i] + ''; if (sinceBreak >= 7) { sinceBreak = 0;