]> nos-oignons.net Git - website.git/commitdiff
Services : on cache les morceaux de courbes pour lesquels on a pas toutes les données
authorLunar <lunar@anargeek.net>
Sun, 17 Nov 2013 21:37:30 +0000 (22:37 +0100)
committerLunar <lunar@anargeek.net>
Sun, 17 Nov 2013 21:37:30 +0000 (22:37 +0100)
Services/Participation.html

index 4683683657e4f82e85a79d0a07aab5e02303c837..56ae6db7d58c9be788f0b7beb07f2986567819e1 100644 (file)
@@ -214,8 +214,8 @@ function draw_bandwidth_graph(raw_data, selector, direction, period) {
   });
   color.domain(valid_fingerprints);
 
-  var minTime = d3.min(raw_data.relays.map(function(d) { return d[direction][period] && parseTime(d[direction][period].first); }));
-  var maxTime = d3.max(raw_data.relays.map(function(d) { return d[direction][period] && parseTime(d[direction][period].last); }));
+  var minTime = d3.max(raw_data.relays.map(function(d) { return d[direction][period] && parseTime(d[direction][period].first); }));
+  var maxTime = d3.min(raw_data.relays.map(function(d) { return d[direction][period] && parseTime(d[direction][period].last); }));
   var maxTotalBandwidth = 0;
 
   var data = stack(color.domain().map(function(fingerprint) {
@@ -227,13 +227,9 @@ function draw_bandwidth_graph(raw_data, selector, direction, period) {
     var last = parseTime(history.last);
     var i = 0;
     for (var current = minTime; current <= maxTime; current = d3.time.second.offset(current, history.interval)) {
-      var value;
-      if (current < first || current > last) {
-        value = 0;
-      } else {
-        value = history.factor * history.values[i++];
+      if (first <= current && current <= last) {
+        values.push({ date: current, y: history.factor * history.values[i++] });
       }
-      values.push({ date: current, y: value });
     }
 
     maxTotalBandwidth = maxTotalBandwidth + history.factor * d3.max(history.values);