question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting hoverlabel bordercolor to transparent causes text to also be transparent

See original GitHub issue

A 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",
  }
};

screen shot 2018-09-28 at 2 42 23 pm

https://codepen.io/dsmmcken/pen/GYRVrK

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
dsmmckencommented, Oct 2, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found