Skip to content

relayout throws error when updating axis using object syntax #1501

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
bpostlethwaite opened this issue Mar 20, 2017 · 2 comments
Closed

relayout throws error when updating axis using object syntax #1501

bpostlethwaite opened this issue Mar 20, 2017 · 2 comments
Labels
bug something broken

Comments

@bpostlethwaite
Copy link
Member

A call to relayout using object relayout syntax that looks something like:

layoutUpdate = {"xaxis2.domain[1]":0.7575000000000001,"xaxis3":
 {"anchor":"y2","domain":[0.7925,0.95]}}
Plotly.relayout(graphDiv, layoutUpdate)

will throw

uncaught TypeError: Cannot read property 'type' of undefined
    at convertCoords (convert_coords.js:30)
    at _relayout (plot_api.js:1975)
    at Object.relayout (plot_api.js:1721)
    at HTMLAnchorElement.<anonymous> (index.js:3580)
    at HTMLAnchorElement.dispatch (toolpanel-dependencies-bundle.js:2003)
    at HTMLAnchorElement.u (toolpanel-dependencies-bundle.js:1927)

when called on a normal single axis plot.

It appears to be thrown in the relayout code during some Annotation coord call. Perhaps because xaxis2 doesn't exist?

Note that using plotly.js's infamous dot syntax

layoutUpdate = {"xaxis2.anchor":"y2","xaxis2.domain":[0.6,0.95],"yaxis2.anchor":"x2","yaxis2.domain":[0.6,0.95]}
Plotly.relayout(graphDiv, layoutUpdate)

seems to work correctly.

I am updating code that uses object syntax to use dot notation as a workaround.

This one is probably for @alexcjohnson :)

@bpostlethwaite bpostlethwaite added the bug something broken label Mar 20, 2017
@etpinard
Copy link
Contributor

I think I fixed that one in #1494

@bpostlethwaite
Copy link
Member Author

yep looks like it. I'm going to close it - feel free to open it up and double check if you are feeling suspicious.

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

No branches or pull requests

2 participants