plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash

Home Page:https://plotly.com/javascript/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Display tooltips on zero value bars

moxboxwa opened this issue · comments

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!

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

@archmoj it's v2.11.1