[tor-commits] [metrics-tasks/master] Switch color hue for non-exit relays (#6443)

karsten at torproject.org karsten at torproject.org
Thu Jun 27 08:40:10 UTC 2013


commit 8b839580e4d4e99ed52994276e074286460b601f
Author: Lunar <lunar at torproject.org>
Date:   Fri Jun 21 15:45:06 2013 +0200

    Switch color hue for non-exit relays (#6443)
---
 task-6443/bubble-cw/bubble-cw.html |   23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/task-6443/bubble-cw/bubble-cw.html b/task-6443/bubble-cw/bubble-cw.html
index 7a44523..e89ad34 100644
--- a/task-6443/bubble-cw/bubble-cw.html
+++ b/task-6443/bubble-cw/bubble-cw.html
@@ -25,11 +25,21 @@ var svg = d3.select("body").append("svg")
     .attr("height", diameter)
     .attr("class", "bubble");
 
+svg.append("defs")
+  .append("filter")
+    .attr("id", "middle-filter")
+    .append("feColorMatrix")
+      .attr("type", "hueRotate")
+      .attr("in", "SourceGraphic")
+      .attr("values", "90");
+
 d3.json("details.json", function(error, data) {
   var relays = [];
   data["relays"].forEach(function(relay) {
     if (0 != relay['consensus_weight'] && relay['running']) {
-      relays.push({ packageName: "Relays", className: relay['nickname'], value: relay["consensus_weight"] });
+      relays.push({ packageName: "Relays", className: relay['nickname'], value: relay["consensus_weight"],
+                    exit: relay["exit_probability"] > 0,
+                  });
     }
   });
 
@@ -48,15 +58,8 @@ d3.json("details.json", function(error, data) {
       .attr("transform", function(d) { return "translate(" + -d.r + "," + -d.r + ")"; })
       .attr("width", function(d) { return d.r * 2; })
       .attr("height", function(d) { return d.r * 2; })
-      .attr("preserveAspectRatio", "xMidYMin");
-
-  /*
-  node.filter(function(d) { return !d.children && d.value > cutOff; })
-    .append("text")
-      .attr("dy", ".3em")
-      .style("text-anchor", "middle")
-      .text(function(d) { return d.className; });
-   */
+      .attr("preserveAspectRatio", "xMidYMin")
+      .attr("filter", function(d) { return d.exit ? "" : "url(#middle-filter)"; });
 
   var title = svg.append("g")
       .attr("transform", "translate(" + (diameter / 3) +", " + (diameter - 30) + ")");





More information about the tor-commits mailing list