Skip to content

Plotly relayout autorange fails with automargins. #3106

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

Closed
justnick21 opened this issue Oct 15, 2018 · 7 comments
Closed

Plotly relayout autorange fails with automargins. #3106

justnick21 opened this issue Oct 15, 2018 · 7 comments

Comments

@justnick21
Copy link

When fixLabelOverlaps is called (axes.js:1807) via:

Plotly.relayout('plotly', {
"xaxis.autorange": true,
"yaxis.autorange": true
});

tester = drawing.tester.node(); inside src/components/drawing/index.js.drawing.bBox fails because there is no tester node. The js-plotly-tester is on the page, just not referenced in the drawing object.

Can be fixed by adding if (!drawing.tester) drawing.makeTester() on the line above.

I saw some discussion about the performance of the measuring so I thought I would raise as a bug before making a PR.

@alexcjohnson
Copy link
Collaborator

Thanks @justnick21 - But I haven't managed to reproduce this error. Here's a try based on one of our existing automargin mocks: https://codepen.io/alexcjohnson/pen/wYPdBN?editors=1010
Can you make a codepen, or modify that one, to show the issue?

@justnick21
Copy link
Author

Sorry I am unable to reproduce this issue in a codepen. Not sure why the key is no longer on that object. Stack trace attached but without spending a lot of time reproducing this in a pen I am afraid I can't give any more details

TypeError: Cannot read property 'node' of undefined at Object.push../node_modules/plotly.js/src/components/drawing/index.js.drawing.bBox (index.js:926) at SVGGElement.<anonymous> (axes.js:1803) at plotly.js:21021 at d3_selection_each (plotly.js:21028) at Array.d3_selectionPrototype.each (plotly.js:21020) at fixLabelOverlaps (axes.js:1798) at Object.push../node_modules/plotly.js/src/lib/index.js.lib.syncOrAsync (index.js:401) at drawLabels (axes.js:1961) at Object.push../node_modules/plotly.js/src/plots/cartesian/axes.js.axes.doTicksSingle (axes.js:2132) at axes.js:1480 at Object.push../node_modules/plotly.js/src/lib/index.js.lib.syncOrAsync (index.js:401) at Object.push../node_modules/plotly.js/src/plots/cartesian/axes.js.axes.doTicks (axes.js:1477) at Object.push../node_modules/plotly.js/src/plot_api/subroutines.js.exports.doTicksRelayout (subroutines.js:480) at doTicks (plot_api.js:1638) at Object.push../node_modules/plotly.js/src/lib/index.js.lib.syncOrAsync (index.js:401) at Object.relayout (plot_api.js:1625) at Chart.js:62 at Array.forEach (<anonymous>)

@alexcjohnson
Copy link
Collaborator

OK thanks! I'll leave this report open for a while in hopes that we can figure out the root cause, but I don't think it's a good idea to address the symptom directly before that, as there are very likely to be other ways whatever this problem is can manifest itself.

@etpinard
Copy link
Contributor

Closing due to lack of reproducible example.

@justnick21 feel free to open another issue when/if you're able to reproduce this in a codepen.

@cognot
Copy link

cognot commented Apr 24, 2020

I have the exact same issue. Only happens if xaxis.autorange is set to true though. If I only set yaxis.autorange the issue goes away. And no, I have not been ble to reproduce it in a codepen.

This is with a simple scatter.

@federicomassa
Copy link

federicomassa commented Apr 27, 2021

Same here with v1.58.4. Tried to reproduce it on CodePen but couldn't!

If useful, I'll leave my CodePen here: https://codepen.io/federicomassa/pen/JjKXELq

@jxu
Copy link

jxu commented Jun 23, 2021

Still have this issue in 2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants