-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Skip zeroline when negative sizes are present on positive base and vice versa #4714
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
Conversation
- no zero line sometimes needed with positive base and negative value - add test
src/traces/bar/cross_trace_calc.js
Outdated
@@ -512,7 +512,7 @@ function setBaseAndTop(sa, sieve) { | |||
pts.push(top); | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now added logic & tests to handle negative case similar to the positive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃 very nice!
Fixes #4701 for
bar
andwaterfall
.@plotly/plotly_js