Skip to content

Commit 3007ac2

Browse files
committed
hover: return the d3 selection instead of its .node
1 parent f7348dd commit 3007ac2

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/components/fx/hover.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ exports.multiHovers = function multiHovers(hoverItems, opts) {
230230

231231
alignHoverText(hoverLabel, fullOpts.rotateLabels);
232232

233-
return hoverLabel.node();
233+
return hoverLabel;
234234
};
235235

236236
// The actual implementation is here:

src/traces/sankey/plot.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ module.exports = function plot(gd, calcData) {
162162
// For each related links, create a hoverItem
163163
for(var i = 0; i < d.flow.links.length; i++) {
164164
var link = d.flow.links[i];
165-
obj = link;
165+
link.fullData = link.trace;
166+
obj = d.link.trace.link;
166167
var hoverCenterX;
167168
var hoverCenterY;
168169
if(link.circular) {
@@ -198,16 +199,19 @@ module.exports = function plot(gd, calcData) {
198199
});
199200
}
200201

201-
var tooltip = Fx.multiHovers(hoverItems, {
202+
var tooltips = Fx.multiHovers(hoverItems, {
202203
container: fullLayout._hoverlayer.node(),
203204
outerContainer: fullLayout._paper.node(),
204205
gd: gd
205206
});
206207

207-
if(!d.link.concentrationscale) {
208-
makeTranslucent(tooltip, 0.65);
209-
}
210-
makeTextContrasty(tooltip);
208+
tooltips.each(function() {
209+
var tooltip = this;
210+
if(!d.link.concentrationscale) {
211+
makeTranslucent(tooltip, 0.65);
212+
}
213+
makeTextContrasty(tooltip);
214+
});
211215
};
212216

213217
var linkUnhover = function(element, d, sankey) {

0 commit comments

Comments
 (0)