highlight connected nodes

This commit is contained in:
Nils Schneider 2012-06-03 15:28:34 +02:00
parent 6b58c4f4a5
commit ea529b374e
2 changed files with 12 additions and 1 deletions

View file

@ -21,3 +21,7 @@ line.link {
#chart {
background-image: url(gplaypattern.png);
}
.node.highlight ellipse {
fill: #FFF0B3;
}

View file

@ -67,7 +67,14 @@ d3.json("nodes.json", function(json) {
 function fade(opacity) {
        return function(d) {
            node.style("stroke-opacity", function(o) {
                thisOpacity = isConnected(d, o) ? 1 : opacity;
var connected = isConnected(d, o);
if (connected && opacity != 1)
d3.select(this).classed("highlight", true);
else
d3.select(this).classed("highlight", false);
                thisOpacity = connected ? 1 : opacity;
                this.setAttribute('fill-opacity', thisOpacity);
                return thisOpacity;
            });