diff --git a/assets/css/main.css b/assets/css/main.css index ae3fa79..9f0606b 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -179,7 +179,7 @@ h3 { } /* The big graph */ -#big-graph, #big-graph-controls { +#big-graph, #big-graph-controls, #big-graph-checkboxes { width: 1000px; margin: 15px auto 0 auto; } @@ -188,6 +188,11 @@ h3 { height: 500px; } -#big-graph-controls > table { +#big-graph-checkboxes > table { width: 100%; +} + +/* Basic elements */ +.button { + } \ No newline at end of file diff --git a/assets/html/index.html b/assets/html/index.html index cb16c3b..7247bae 100644 --- a/assets/html/index.html +++ b/assets/html/index.html @@ -35,7 +35,14 @@
-
+
+ +
+ + + + +
diff --git a/assets/js/site.js b/assets/js/site.js index b1307d1..a18317a 100644 --- a/assets/js/site.js +++ b/assets/js/site.js @@ -66,6 +66,10 @@ var lastMojangServiceUpdate; var graphs = {}; var lastPlayerEntries = {}; +var historyPlot; +var displayedGraphData; +var hiddenGraphData = []; + // Generate (and set) the HTML that displays Mojang status. function updateMojangServices() { if (!lastMojangServiceUpdate) { @@ -182,6 +186,35 @@ function sortServers() { } } +function setAllGraphVisibility(visible) { + if (visible) { + var keys = Object.keys(hiddenGraphData); + + for (var i = 0; i < keys.length; i++) { + displayedGraphData[keys[i]] = hiddenGraphData[keys[i]]; + } + + hiddenGraphData = []; + } else { + var keys = Object.keys(displayedGraphData); + + for (var i = 0; i < keys.length; i++) { + hiddenGraphData[keys[i]] = displayedGraphData[keys[i]]; + } + + displayedGraphData = []; + } + + $('.graph-control').each(function(index, item) { + item.checked = visible; + }); + + historyPlot.setData(convertGraphData(displayedGraphData)); + historyPlot.setupGrid(); + + historyPlot.draw(); +} + $(document).ready(function() { var socket = io.connect({ reconnect: true, @@ -192,10 +225,6 @@ $(document).ready(function() { var mojangServicesUpdater; var sortServersTask; - var historyPlot; - var displayedGraphData; - var hiddenGraphData = []; - socket.on('connect', function() { $('#tagline-text').text('Loading...'); }); @@ -218,7 +247,7 @@ $(document).ready(function() { $('#server-container').html(''); $('#quick-jump-container').html(''); $('#big-graph').html(''); - $('#big-graph-controls').html(''); + $('#big-graph-checkboxes').html(''); }); socket.on('historyGraph', function(rawData) { @@ -247,7 +276,7 @@ $(document).ready(function() { } } - $('#big-graph-controls').append(html + ''); + $('#big-graph-checkboxes').append(html + ''); }); socket.on('updateHistoryGraph', function(rawData) {