Skip to content

relayout throws error when updating axis using object syntax #1501

Closed
@bpostlethwaite

Description

@bpostlethwaite

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions