Setting hoverlabel bordercolor to transparent causes text to also be transparent
See original GitHub issueA trace set with bordercolor: transparent (or actually any colour) causes font color on hoverlabels to also be transparent (or that colour). As a user this is unexpected behaviour for setting just a bordercolor.
var trace1 = {
x: [1, 2, 3, 4],
y: [16, 5, 11, 9],
type: 'scatter',
hoverlabel: {
bordercolor: "transparent",
}
};
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
plotly hoverlabel color transparency - Stack Overflow
I have found (in plotly python), that if you pass hovermode = "x unified" in layout , then if you set bgcolor to...
Read more >Solved: Re: Changing Text Box Border Color to transparent
I am aware that there is a mandatory field option in Adobe BUT I cannot seem to find any settings to turn off...
Read more >Python Figure Reference: layout.annotations - Plotly
Sets the background color of the hover label. By default uses the annotation's `bgcolor` made opaque, or white if it was transparent. bordercolor....
Read more >Colors and Shading
For 3D surface graphs, automatic mode will cause the graph to be colored by height. ... These methods get/set the transparent border color...
Read more >How to Set Border Opacity with CSS - W3docs
You can set the border opacity using a RGBA color as a value for the CSS border ... the CSS opacity property makes...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t think that’s the fix. I would do:
https://github.com/plotly/plotly.js/blob/9772ef6dd5ec5417ab50dd378aaa536a8c845336/src/components/fx/hover.js#L90-L97
description should be changed to defaults to contrasting colour, same as borderColor description. This appears to be an intentional decision, but I can’t figure out why one would want it to behave that way. I would suggest instead making both font colour and border colour both independently default to a contrast colour, rather than contrastColor defaulting to borderColor if set and re-used on fontColor.
remove borderColor as part of the default for contrastColor, here: https://github.com/plotly/plotly.js/blob/9772ef6dd5ec5417ab50dd378aaa536a8c845336/src/components/fx/hover.js#L899
no change, just relevant that contrastColor is used on font (which is defaulting to borderColor if set): https://github.com/plotly/plotly.js/blob/9772ef6dd5ec5417ab50dd378aaa536a8c845336/src/components/fx/hover.js#L954
add d.borderColor to here d.borderColor || contrastColor, here: https://github.com/plotly/plotly.js/blob/9772ef6dd5ec5417ab50dd378aaa536a8c845336/src/components/fx/hover.js#L983
That way they are independent of each other, and both default to contrastColor if neither, or one, is set… I think, didn’t fully read this.
That behaviour would be more inline with what I would expect.
Thanks @EsdrasXavier - FWIW that code is here in the source:
https://github.com/plotly/plotly.js/blob/9772ef6dd5ec5417ab50dd378aaa536a8c845336/src/components/fx/calc.js#L37-L44