Skip to content

Commit fe50b6f

Browse files
committed
add hover label setting to hoverData during cleanPoint
- to that there (as opposed to in trace module hoverPoints) to have to repeat this logic across all trace modules - note that PR #1573 already added the relevant `createHoverText` logic
1 parent 258f1c7 commit fe50b6f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/plots/cartesian/graph_interact.js

+16
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,9 @@ fx.getClosest = function(cd, distfn, pointData) {
672672
};
673673

674674
function cleanPoint(d, hovermode) {
675+
var trace = d.trace || {};
676+
var cd = d.cd[d.index] || {};
677+
675678
d.posref = hovermode === 'y' ? (d.x0 + d.x1) / 2 : (d.y0 + d.y1) / 2;
676679

677680
// then constrain all the positions to be on the plot
@@ -749,6 +752,19 @@ function cleanPoint(d, hovermode) {
749752
if(infomode.indexOf('name') === -1) d.name = undefined;
750753
}
751754

755+
function fill(key, calcKey, traceKey) {
756+
if(cd[calcKey]) return d[key] = cd[calcKey];
757+
758+
var traceVal = Lib.nestedProperty(trace, traceKey).get();
759+
if(traceVal) return d[key] = traceVal;
760+
}
761+
762+
fill('color', 'hbg', 'hoverlabel.bgcolor');
763+
fill('borderColor', 'hbc', 'hoverlabel.bordercolor');
764+
fill('fontFamily', 'htf', 'hoverlabel.font.family');
765+
fill('fontSize', 'hts', 'hoverlabel.font.size');
766+
fill('fontColor', 'htc', 'hoverlabel.font.color');
767+
752768
return d;
753769
}
754770

0 commit comments

Comments
 (0)