Tooltip text not working when text is 0 (number)
See original GitHub issueExample that displays the error
I want to be able to get a value from the text property in the data object. I noticed that if the value is the number 0 it won’t be displayed in the plot.
text: [0, 0, 0, 0, 0],
hoverinfo: "x+text+name",
The code above will make the tooltip only show x and name. The text property won’t be visible.
All other values except 0 will render properly, as can be seen in the code example linked above. Also if all the numbers are strings they will be shown correctly.
I guess that there is a null-check somewhere that treats 0 as false and therefore won’t add it to the tooltip.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Text disappears when I add the tooltip class - html
Press the Run code snippet in the answer. This is working. If you're not seeing the tooltip, it must be something else in...
Read more >Tooltips · Bootstrap v5.0
Tooltips with zero-length titles are never displayed. Specify container: 'body' to avoid rendering problems in more complex components (like our input groups, ...
Read more >Tooltip
A simple text popup tip. When To Use. The tip is shown on mouse enter, and is hidden on mouse leave. The Tooltip...
Read more >How to customize tooltips
Emphasize text with HTML; Create a mini-table; Add extra information about certain regions; Add two numbers together; Change the number ...
Read more >Tooltips | Charts
The previous examples have all used tooltips with plain text content, but the real power ... Note: this does not work with the...
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
@alexcjohnson Did I create the PR correctly?
Thanks @stillesjo ! Interestingly we have a comment implying that we had addressed exactly this issue, so we’ll have to look at it. https://github.com/plotly/plotly.js/blob/dfb56d3a7b99ecf979365ed9b9c2c40747cdd915/src/traces/scatter/fill_hover_text.js#L38-L41 @dalle thanks, that would fix a related bug - display of the text alongside the markers. Add this to each of the traces in @stillesjo’s example:
and you’ll see the zeros get left out there too: