highlight connected nodes
This commit is contained in:
parent
6b58c4f4a5
commit
ea529b374e
|
@ -21,3 +21,7 @@ line.link {
|
|||
#chart {
|
||||
background-image: url(gplaypattern.png);
|
||||
}
|
||||
|
||||
.node.highlight ellipse {
|
||||
fill: #FFF0B3;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue