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