plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
16.92k stars 1.86k forks source link

Display tooltips on zero value bars #6988

Open moxboxwa opened 5 months ago

moxboxwa commented 5 months ago

This is a follow-up to #3797 .

I am using ggplotly in R, not using plotly directly, so I'm not including a reproducible example, but I think the issue is straightforward.

The tooltip (using the "text" specified in the ggplot command) does not appear in barplots when the bar height is equal to 0. The issue cited above notes the same thing in the last comment, posted after that issue had been resolved/closed.

If the tooltip only included the value of the bar height, this would not be a problem. But we often use the tooltip to display multiple values. In my specific case, the bar height shows year-to-year percentage change for each state, and the tooltip includes both the pct chg and the raw number for the current year. The raw number provides useful interpretive context because there is a wide range of raw values, and small values lead to more variable/extreme pct changes. For the states with pct chg=0, no tooltip is shown, so we lose the information on raw number that would help provide context. Screenshot below for example.

image

Thanks!

archmoj commented 5 months ago

Do you know which version of plotly.js is used there? You may see it by hovering over the Plotly icon on the modebar.

moxboxwa commented 5 months ago

@archmoj it's v2.11.1