-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Bar chart: draw the outline, even if the height is zero. #3797
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
Comments
Thanks for writing in.
Can I ask why that's the desired behavior in your use case? |
This makes sense to me from a continuity standpoint - tiny positive and tiny negative look identical, but in between at exactly zero there’s a gap? If you’ve added a border to your bars you’re asking users to implicitly remove the border in evaluating bar size, so why should zero be an exception? Also re: hover - makes sense to include the lines, though this gets tricky if there’s overlap like stacking. |
Thanks. Consider, for example, a bar chart showing temperature vs date. I need a way to distinguish 0 ("today, the temperature was 0 degrees") from null (today was a weekend and I didn't record the temperature). I think that Plotly correctly handles nulls by not plotting the point at all, nor does it give a hover. But it's imperfect for zeros: a zero-height bar is treated more like a null-bar than a zero-valued bubble.
(I also show the word "zero" as text, with textposition=outside; this is an option which is already available). |
Thanks for the info @RichardNeill I agree |
It's great that the bar now appears (as expected, a zero-height area, but with a thin non-zero border). However, it's still not possible to see the tooltip - because the hover only works on the main area of a bar, and not over its border. (This is true for non-zero bars too). So it it possible to enable the hover tooltip when the mouse goes over a bar's border? Thanks |
For a bar of zero height, if the line width is specified, we should be able to see the bar border, even though we don't see the bar.
In this example:
https://codepen.io/RichardNeill/pen/EJRqmN
B is a normal bar, with 10px border, as it should be.
C is a bar with height = null. It is, correctly, completely invisible.
But A is a bar with height = 0. It should actually appear as a 20px high rectangle (the border should still be displayed), even though the bar area itself isn't. Try setting the value to 0.0001
and you'll see what I expect. In addition, the hover tooltip is (wrongly) suppressed - it doesn't appear in "show closest data on hover" mode.
The text was updated successfully, but these errors were encountered: