Skip to content
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

Fix reverse autorange on cartesian axes with breaks #4639

Merged
merged 3 commits into from
Mar 13, 2020

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Mar 13, 2020

A follow up of remaining work #4614 related to autorange: 'reversed' cases on axes with breaks
as well as some simplification for l2p & p2l functions.

@plotly/plotly_js

- ensure account for lBreaks sign
- improve and simplify l2p and p2l functions on axis with breaks
- reduce extra logic to handle y-axis
@archmoj archmoj added bug something broken status: reviewable labels Mar 13, 2020
@archmoj archmoj added this to the v1.53.0 milestone Mar 13, 2020

if(ax._breaks.length) {
for(i = 0; i < ax._breaks.length; i++) {
brk = ax._breaks[i];
ax._lBreaks += (brk.max - brk.min);
ax._lBreaks += brk.max - brk.min;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

One small recommendation: I think it would be best to keep ax._lBreaks positive-definite. So many below this loop we could have

ax._lBreaks = Math.abs(ax._lBreaks)

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried that at one point. However, allowing negative helped handling reversed cases much easier. For now I added a comment in front of _lBreaks description.

Copy link
Contributor

Choose a reason for hiding this comment

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

For now I added a comment in front of _lBreaks description.

That's great!

@etpinard
Copy link
Contributor

💃 - thanks very much @archmoj long live plotly.js!

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.

2 participants