Skip to content

Choropleth maps don't reset accurately when layout.geo.scope is changed #3831

Closed
@mbkupfer

Description

@mbkupfer

First and foremost, I thought I would mention that this issue is only occurring with Plotly.react as I was able to implement a correct alternative by using Plotly.newPlot but unfortunately means that I won't be able to use react-plotly for this component.

With that out of the way, the bug occurs when the layout scope is changed and either 1. a double click event is triggered or 2. reset is pressed in the mode bar. When the plot is changed through the dropdown though, there is no issue. All examples below can be reproduced in this code pen.

In cases where scope is not 'usa', the reset changed the lon/lat values to whatever the initial plot's geo scope was set at. This is very pronounced when switching from 'world' to 'north america', thus I chose that for the example, but this occurs in any situation. If the initial plot is set to 'north america', then it would be the reverse.

In cases where the plot is changed to 'usa' though, the js actually throws an error! The error is:
TypeError: centerPx is null.

So this is actually two errors, but they both seem to have the same root cause.

Let me know if I can provide any more clarity.

Metadata

Metadata

Assignees

Labels

bugsomething broken

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions