Skip zeroline when negative sizes are present on positive base and vice versa#4714
Conversation
- no zero line sometimes needed with positive base and negative value - add test
| if(bar.hasB) pts.push(base); | ||
|
|
||
| if(!bar.hasB || !(bar.b > 0 && bar.s > 0)) { | ||
| if(!bar.hasB || !(bar.b > 0 && bar.b + bar.s > 0)) { |
There was a problem hiding this comment.
Per #4701 (comment) I'm really curious if there's anything wrong with just:
if (!bar.hasB || !bar.b)
or maybe even
if (!bar.b)
depending on what these values are.
If you negate all base and size values - so all top and bottom values are <0 - we should also not draw the axis to zero. And if there are already values on both sides of zero, the tozero: true flag is irrelevant.
Also: there's similar logic down in normalizeBars ~line 700 that probably needs updating as well.
There was a problem hiding this comment.
For now added logic & tests to handle negative case similar to the positive.
There was a problem hiding this comment.
Per #4701 (comment) I'm really curious if there's anything wrong with just:
if (!bar.hasB || !bar.b)
or maybe even
if (!bar.b)
depending on what these values are.
That would change bar_attrs_overlay & bar_attrs_group baselines.
Fixes #4701 for
barandwaterfall.@plotly/plotly_js