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

More auto-margin fixes (some of them temporary) #4216

Merged
merged 5 commits into from
Sep 25, 2019

Conversation

etpinard
Copy link
Contributor

This PR closes #4028 - which presents two ways of getting infinite redraw loops with axis.automargin turned on.

Example 1:
before: https://codepen.io/alanjmac/pen/oraKpR (try reducing the window width, squashing the graph)
after: https://codepen.io/etpinard/pen/OJLqVZK

Example 2:
before: https://codepen.io/wbrgss/pen/LYPryKO (open the console in Chrome, you should see Uncaught RangeError: Maximum call stack size exceeded)
after: https://codepen.io/etpinard/pen/xxKBGzW

Shoutout to @wbrgss for this example!


In brief,

  • f506306 is a small axis auto-margin fix
  • 7a8eedf essentially implements the

Do not go back and forth between computed "auto" tick angle during the same Plots.doAutoMargin cycle

solution listed in #2704 (comment)

  • 631014a goes one step further to stay safe by capping the number of redraw calls Plots.doAutoMargin can trigger. This should remove all potential infinite redraw loops from our code. I'm hoping that this solution will be temporary and that by fixing our automargin pipeline problems (see Automargin pipeline #2704 (comment) for more on that), we'll be able to revert it.
  • 58fd632 adds a mock that currently fails to render (as it leads to an infinite loop) and which also locks the f506306 fix

@archmoj this one should go in 1.50.0 - looking for a quick review. Thanks!!

... this enables an axis to push the margin on
    both side of its span
 N.B. during auto-margin redraw, if the axis fixed its label overlaps
 by rotating 90 degrees, do not attempt to re-fix its label overlaps
 as this can lead to infinite redraw loops!

 Moreover, use ax._prevTickAngles for retrieve "lastAngle".
 Previous ax._tickAngles was used, but this one gets clear early
 Axes.drawOne, so it didn't really do anything.
... that Plots.doAutoMargin can trigger.
@etpinard etpinard added bug something broken status: reviewable labels Sep 24, 2019
@etpinard etpinard added this to the v1.50.0 milestone Sep 24, 2019
Copy link
Contributor

@archmoj archmoj left a comment

Choose a reason for hiding this comment

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

Fantastic PR.
💃

src/plots/cartesian/axes.js Show resolved Hide resolved
@archmoj
Copy link
Contributor

archmoj commented Sep 25, 2019

@etpinard
💃 when last test passed on the CI.
Thanks.

@etpinard
Copy link
Contributor Author

Thanks very much for the review @archmoj !

@etpinard etpinard merged commit 1dee68b into master Sep 25, 2019
@etpinard etpinard deleted the automargin-max-number-of-redraws branch September 25, 2019 14:37
@etpinard etpinard mentioned this pull request Sep 25, 2019
@fabiangehring
Copy link

Great thanks! Exactly what we are looking for. Any changes to get this released soon?

@etpinard
Copy link
Contributor Author

etpinard commented Oct 4, 2019

Any changes to get this released soon?

Next Monday. Sorry for the wait.

petii added a commit to tulip/plotly.js that referenced this pull request Apr 27, 2022
…ary) plotly#4216"

Commits:
 - do not try to re-fix axis label overlaps when current autoangle:=90 7a8eedf
 - Add (large) upper bound on the number of redraw calls 631014a
petii added a commit to tulip/plotly.js that referenced this pull request Apr 28, 2022
…ary) plotly#4216"

Commits:
 - do not try to re-fix axis label overlaps when current autoangle:=90 7a8eedf
 - Add (large) upper bound on the number of redraw calls 631014a
petii added a commit to tulip/plotly.js that referenced this pull request Apr 28, 2022
…ary) plotly#4216"

Commits:
 - do not try to re-fix axis label overlaps when current autoangle:=90 1fc0223 (upstream 7a8eedf)
 - Add (large) upper bound on the number of redraw calls 83f1a36 (upstream 631014a)
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.

Automargin call stack size exceeded exception when resizing window
3 participants