-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Choropleth maps don't reset accurately when layout.geo.scope is changed #3831
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
Comments
Thanks very much for the report! Something must be up with plotly.js/src/plots/geo/geo.js Lines 515 to 540 in 03b7e09
where we should probably clear the thing on update call involving |
@etpinard, I'm not sure how far along you are in this, but I spent some time inspecting I've also been trying to level up my js, so I wouldn't mind submitting a PR if this hasn't made it down your pipeline yet. Let me know. plotly.js/src/plots/geo/geo.js Line 76 in 03b7e09
|
@mbkupfer We'll have a fix for this bug merged before we release 1.48.0 Here's your codepen demo using a "fixed" bundle: https://codepen.io/etpinard/pen/XwXqrN?editors=1010 Thanks again for using (and potentially contributing to 😏 ) plotly.js! |
Awesome, thanks for fixing this so quickly! Thanks for making plotly such a great library. |
No problem! Thanks for the very clear bug report! |
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 usingPlotly.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.
The text was updated successfully, but these errors were encountered: