Skip to content

Commit 74d7e00

Browse files
authored
Merge pull request #2589 from plotly/light-common-hoverlabel
Better fallback border color for axis common hover labels
2 parents b89d101 + f6ec7f2 commit 74d7e00

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/components/fx/hover.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,9 +713,12 @@ function createHoverText(hoverData, opts, gd) {
713713
s.attr('data-notex', 1);
714714
});
715715

716+
var commonBgColor = commonLabelOpts.bgcolor || Color.defaultLine;
717+
var commonStroke = commonLabelOpts.bordercolor || Color.contrast(commonBgColor);
718+
716719
lpath.style({
717-
fill: commonLabelOpts.bgcolor || Color.defaultLine,
718-
stroke: commonLabelOpts.bordercolor || Color.background,
720+
fill: commonBgColor,
721+
stroke: commonStroke
719722
});
720723

721724
ltext.text(t0)

test/jasmine/tests/hover_label_test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,7 @@ describe('Test hover label custom styling:', function() {
19181918
text: [20, 'Arial', 'rgb(255, 0, 0)']
19191919
});
19201920
assertCommonLabel({
1921-
path: ['rgb(255, 255, 255)', 'rgb(255, 255, 255)'],
1921+
path: ['rgb(255, 255, 255)', 'rgb(68, 68, 68)'],
19221922
text: [13, 'Arial', 'rgb(255, 255, 255)']
19231923
});
19241924
})
@@ -1930,7 +1930,7 @@ describe('Test hover label custom styling:', function() {
19301930
text: [20, 'Arial', 'rgb(0, 128, 0)']
19311931
});
19321932
assertCommonLabel({
1933-
path: ['rgb(255, 255, 255)', 'rgb(255, 255, 255)'],
1933+
path: ['rgb(255, 255, 255)', 'rgb(68, 68, 68)'],
19341934
text: [13, 'Arial', 'rgb(255, 255, 255)']
19351935
});
19361936
})
@@ -1942,7 +1942,7 @@ describe('Test hover label custom styling:', function() {
19421942
text: [20, 'Arial', 'rgb(0, 0, 255)']
19431943
});
19441944
assertCommonLabel({
1945-
path: ['rgb(255, 255, 255)', 'rgb(255, 255, 255)'],
1945+
path: ['rgb(255, 255, 255)', 'rgb(68, 68, 68)'],
19461946
text: [13, 'Arial', 'rgb(255, 255, 255)']
19471947
});
19481948

@@ -1969,7 +1969,7 @@ describe('Test hover label custom styling:', function() {
19691969

19701970
assertPtLabel(null);
19711971
assertCommonLabel({
1972-
path: ['rgb(255, 255, 255)', 'rgb(255, 255, 255)'],
1972+
path: ['rgb(255, 255, 255)', 'rgb(68, 68, 68)'],
19731973
text: [13, 'Arial', 'rgb(255, 255, 255)']
19741974
});
19751975

0 commit comments

Comments
 (0)