Skip to content

Set the maximum width of categorical bars & boxes to category unit - case of categoryarray#5732

Merged
archmoj merged 4 commits into
masterfrom
fix5731-category-bar-width
Jun 17, 2021
Merged

Set the maximum width of categorical bars & boxes to category unit - case of categoryarray#5732
archmoj merged 4 commits into
masterfrom
fix5731-category-bar-width

Conversation

@archmoj
Copy link
Copy Markdown
Contributor

@archmoj archmoj commented Jun 15, 2021

Fixes #5731.

@plotly/plotly_js

@archmoj archmoj added bug something broken status: reviewable labels Jun 15, 2021
@archmoj archmoj added this to the NEXT milestone Jun 15, 2021
@nicolaskruchten
Copy link
Copy Markdown
Contributor

Behaviour looks good.

@archmoj archmoj requested a review from alexcjohnson June 16, 2021 16:48
@nicolaskruchten
Copy link
Copy Markdown
Contributor

Interestingly, box and violin don't seem to suffer from this problem even on master ... normal?

@archmoj
Copy link
Copy Markdown
Contributor Author

archmoj commented Jun 16, 2021

Interestingly, box and violin don't seem to suffer from this problem even on master ... normal?

Positive. Thanks for checking.

Comment thread src/traces/bar/sieve.js Outdated

var type = (opts.posAxis || {}).type;
if(type === 'category' || type === 'multicategory') {
this.minDiff = Math.min(1, this.minDiff);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a great solution, and simpler than the previous logic. My only question is whether there's actually a benefit of doing Math.min vs just minDiff = 1 in the (multi)category case? There's no way to specify input data that will result in non-integer positions here, is there?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Set to one in 6e6bfa6.

Comment thread src/traces/box/cross_trace_calc.js Outdated
Copy link
Copy Markdown
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Co-authored-by: Alex Johnson <johnson.alex.c@gmail.com>
@archmoj archmoj merged commit ebf971e into master Jun 17, 2021
@archmoj archmoj deleted the fix5731-category-bar-width branch June 17, 2021 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug something broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bar widths and categoryarray

3 participants