highlight connected nodes

alfred-data
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 { #chart {
background-image: url(gplaypattern.png); 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) {  function fade(opacity) {
        return function(d) {         return function(d) {
            node.style("stroke-opacity", function(o) {             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);                 this.setAttribute('fill-opacity', thisOpacity);
                return thisOpacity;                 return thisOpacity;
            });             });