-
-
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
610248b
fix issue 4701
archmoj 69f4027
add failing test for negatives
archmoj 46fcf8f
handle all negatives
archmoj ce2d66c
test with base crossing zero
archmoj cb43197
add test for stack bars
archmoj 158a59c
simplify tozero logic and correct two baselines
archmoj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"xaxis": "x", | ||
"yaxis": "y", | ||
"type": "bar", | ||
"orientation": "h", | ||
"y": [ | ||
"A", | ||
"B", | ||
"C" | ||
], | ||
"x": [ | ||
1, | ||
-1, | ||
1 | ||
], | ||
"text": [ | ||
"+1", | ||
"-1", | ||
"+1" | ||
], | ||
"textposition": "inside", | ||
"insidetextanchor": "middle", | ||
"base": 10 | ||
}, | ||
{ | ||
"xaxis": "x2", | ||
"yaxis": "y2", | ||
"type": "bar", | ||
"x": [ | ||
"E", | ||
"F", | ||
"G" | ||
], | ||
"y": [ | ||
1, | ||
-1, | ||
1 | ||
], | ||
"text": [ | ||
"+1", | ||
"-1", | ||
"+1" | ||
], | ||
"textposition": "inside", | ||
"insidetextanchor": "middle", | ||
"base": 10 | ||
}, | ||
{ | ||
"xaxis": "x3", | ||
"yaxis": "y3", | ||
"type": "waterfall", | ||
"x": [ | ||
"E", | ||
"F", | ||
"G" | ||
], | ||
"y": [ | ||
1, | ||
-2, | ||
1 | ||
], | ||
"text": [ | ||
"+1", | ||
"-2", | ||
"+1" | ||
], | ||
"textposition": "inside", | ||
"insidetextanchor": "middle", | ||
"base": 10 | ||
}, | ||
{ | ||
"xaxis": "x4", | ||
"yaxis": "y4", | ||
"type": "waterfall", | ||
"orientation": "h", | ||
"y": [ | ||
"A", | ||
"B", | ||
"C" | ||
], | ||
"x": [ | ||
1, | ||
-2, | ||
1 | ||
], | ||
"text": [ | ||
"+1", | ||
"-2", | ||
"+1" | ||
], | ||
"textposition": "inside", | ||
"insidetextanchor": "middle", | ||
"base": 10 | ||
} | ||
], | ||
"layout": { | ||
"width": 400, | ||
"height": 400, | ||
"template": { | ||
"layout": { | ||
"showlegend": false, | ||
"title": { | ||
"text": "non-zero autorange with<br>base and negative size" | ||
}, | ||
"xaxis": { | ||
"domain": [ | ||
0, | ||
0.45 | ||
] | ||
}, | ||
"yaxis": { | ||
"domain": [ | ||
0, | ||
0.45 | ||
] | ||
}, | ||
"xaxis2": { | ||
"anchor": "y2", | ||
"domain": [ | ||
0.55, | ||
1 | ||
] | ||
}, | ||
"yaxis2": { | ||
"anchor": "x2", | ||
"domain": [ | ||
0.55, | ||
1 | ||
] | ||
}, | ||
"xaxis3": { | ||
"anchor": "y3", | ||
"domain": [ | ||
0, | ||
0.45 | ||
] | ||
}, | ||
"yaxis3": { | ||
"anchor": "x3", | ||
"domain": [ | ||
0.55, | ||
1 | ||
] | ||
}, | ||
"xaxis4": { | ||
"anchor": "y4", | ||
"domain": [ | ||
0.55, | ||
1 | ||
] | ||
}, | ||
"yaxis4": { | ||
"anchor": "x4", | ||
"domain": [ | ||
0, | ||
0.45 | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
That would change
bar_attrs_overlay
&bar_attrs_group
baselines.