reversed peer plots and fixed handling of zero-height stack items
authorForrest Voight <forrest@forre.st>
Tue, 8 May 2012 19:36:32 +0000 (15:36 -0400)
committerForrest Voight <forrest@forre.st>
Tue, 8 May 2012 19:36:32 +0000 (15:36 -0400)
web-static/graphs.html

index a17ddc0..57aa2ab 100644 (file)
                             for(var j = 0; j < line.data.length; j++)
                                 if(line.data[j] != null) {
                                     var d = line.data[j];
-                                    num += d.y*((d.y0 + d.y) + (d.y0))/2;
-                                    denom += d.y;
+                                    num += (d.y+1)*((d.y0 + d.y) + (d.y0))/2;
+                                    denom += (d.y+1);
                                 }
                             text_boxes.push([i, g.append("svg:text")
                                 .text(line.label + " (mean: " + d3.format(".3s")(stats.mean) + unit + ")")
                     plot(d3.select('#pool'), 'H/s', null, data_to_lines(data), true);
                 });
                 plot_later(d3.select("#peers"), "", null, [
-                    {"url": "/web/graph_data/incoming_peers/last_" + lowerperiod, "color": "#0000FF", "label": "Incoming"},
-                    {"url": "/web/graph_data/outgoing_peers/last_" + lowerperiod, "color": "#FF0000", "label": "Outgoing"}
+                    {"url": "/web/graph_data/outgoing_peers/last_" + lowerperiod, "color": "#FF0000", "label": "Outgoing"},
+                    {"url": "/web/graph_data/incoming_peers/last_" + lowerperiod, "color": "#0000FF", "label": "Incoming"}
                 ], true);
                 
                 d3.json("/web/graph_data/miner_hash_rates/last_" + lowerperiod, function(data) {