-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tooltip text not working when text is 0 (number) #2660
Comments
I think this will fix it:
|
Thanks @stillesjo ! Interestingly we have a comment implying that we had addressed exactly this issue, so we'll have to look at it. plotly.js/src/traces/scatter/fill_hover_text.js Lines 38 to 41 in dfb56d3
@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: mode: 'lines+markers+text',
textposition: 'top right' |
Okay, one more try:
|
@dalle Looks likely that's the culprit - any chance you'd like to make a PR combining those two diffs with a test covering both parts? Perhaps based on:
|
@alexcjohnson Creating a new hover label test seems easy, but I could not understand how to test for the marker. |
Ah great, that's the harder test!
Once you've made a plot that has text on the markers (which is done in the
to check that the correct number of text markers are created - in the codesandbox example above, the |
@alexcjohnson Did I create the PR correctly? |
* treat zero as valid fixes plotly#2660 * PR suggestions: toBe instead of toEqual
Example 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.
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.
The text was updated successfully, but these errors were encountered: