Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/components/fx/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -713,9 +713,12 @@ function createHoverText(hoverData, opts, gd) {
s.attr('data-notex', 1);
});

var commonBgColor = commonLabelOpts.bgcolor || Color.defaultLine;
var commonStroke = commonLabelOpts.bordercolor || Color.contrast(commonBgColor);

lpath.style({
fill: commonLabelOpts.bgcolor || Color.defaultLine,
stroke: commonLabelOpts.bordercolor || Color.background,
fill: commonBgColor,
stroke: commonStroke
});

ltext.text(t0)
Expand Down
8 changes: 4 additions & 4 deletions test/jasmine/tests/hover_label_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1918,7 +1918,7 @@ describe('Test hover label custom styling:', function() {
text: [20, 'Arial', 'rgb(255, 0, 0)']
});
assertCommonLabel({
path: ['rgb(255, 255, 255)', 'rgb(255, 255, 255)'],
path: ['rgb(255, 255, 255)', 'rgb(68, 68, 68)'],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had the perfect test... locking down the wrong behavior 🤓

text: [13, 'Arial', 'rgb(255, 255, 255)']
});
})
Expand All @@ -1930,7 +1930,7 @@ describe('Test hover label custom styling:', function() {
text: [20, 'Arial', 'rgb(0, 128, 0)']
});
assertCommonLabel({
path: ['rgb(255, 255, 255)', 'rgb(255, 255, 255)'],
path: ['rgb(255, 255, 255)', 'rgb(68, 68, 68)'],
text: [13, 'Arial', 'rgb(255, 255, 255)']
});
})
Expand All @@ -1942,7 +1942,7 @@ describe('Test hover label custom styling:', function() {
text: [20, 'Arial', 'rgb(0, 0, 255)']
});
assertCommonLabel({
path: ['rgb(255, 255, 255)', 'rgb(255, 255, 255)'],
path: ['rgb(255, 255, 255)', 'rgb(68, 68, 68)'],
text: [13, 'Arial', 'rgb(255, 255, 255)']
});

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

assertPtLabel(null);
assertCommonLabel({
path: ['rgb(255, 255, 255)', 'rgb(255, 255, 255)'],
path: ['rgb(255, 255, 255)', 'rgb(68, 68, 68)'],
text: [13, 'Arial', 'rgb(255, 255, 255)']
});

Expand Down