Skip to content

Commit 81998ac

Browse files
committed
Fix 6328 - Hovering over Sankey node highlights all full traces
1 parent 33dc2de commit 81998ac

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

src/traces/sankey/plot.js

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,25 @@ function nodeNonHoveredStyle(sankeyNode, d, sankey) {
6262
}
6363

6464
function linkHoveredStyle(d, sankey, visitNodes, sankeyLink) {
65-
var label = sankeyLink.datum().link.label;
66-
6765
sankeyLink.style('fill-opacity', function(l) {
6866
if(!l.link.concentrationscale) {
6967
return 0.4;
7068
}
7169
});
7270

73-
if(label) {
74-
ownTrace(sankey, d)
75-
.selectAll('.' + cn.sankeyLink)
76-
.filter(function(l) {return l.link.label === label;})
77-
.style('fill-opacity', function(l) {
78-
if(!l.link.concentrationscale) {
79-
return 0.4;
80-
}
81-
});
82-
}
71+
sankeyLink.each((curLink => {
72+
var label = curLink.link.label;
73+
if(label) {
74+
ownTrace(sankey, d)
75+
.selectAll('.' + cn.sankeyLink)
76+
.filter(function(l) {return l.link.label === label;})
77+
.style('fill-opacity', function(l) {
78+
if(!l.link.concentrationscale) {
79+
return 0.4;
80+
}
81+
});
82+
}
83+
}))
8384

8485
if(visitNodes) {
8586
ownTrace(sankey, d)
@@ -90,15 +91,17 @@ function linkHoveredStyle(d, sankey, visitNodes, sankeyLink) {
9091
}
9192

9293
function linkNonHoveredStyle(d, sankey, visitNodes, sankeyLink) {
93-
var label = sankeyLink.datum().link.label;
94-
9594
sankeyLink.style('fill-opacity', function(d) {return d.tinyColorAlpha;});
96-
if(label) {
97-
ownTrace(sankey, d)
98-
.selectAll('.' + cn.sankeyLink)
99-
.filter(function(l) {return l.link.label === label;})
100-
.style('fill-opacity', function(d) {return d.tinyColorAlpha;});
101-
}
95+
96+
sankeyLink.each(curLink => {
97+
var label = curLink.link.label;
98+
if(label) {
99+
ownTrace(sankey, d)
100+
.selectAll('.' + cn.sankeyLink)
101+
.filter(function(l) {return l.link.label === label;})
102+
.style('fill-opacity', function(d) {return d.tinyColorAlpha;});
103+
}
104+
})
102105

103106
if(visitNodes) {
104107
ownTrace(sankey, d)

0 commit comments

Comments
 (0)