Open cczhu opened 4 years ago
My current workaround is to create a hidden div trigger that only renders the plots after the user clicks on the Map tab for the first time.
Thanks @cczhu - the problem isn't specifically with mapbox, in fact the error you're seeing appears to be coming from the colorbar. Here's the same problem in pure plotly.js with a scatter plot and a colorbar https://codepen.io/alexcjohnson/pen/QWyymxY
But the root cause of the issue is that we're not correctly inferring the size of the graph - which is extremely difficult to do for a hidden element given all the options available through CSS and other items that might be on the page influencing it. Normally this isn't a problem, as we redraw the graph when it becomes visible - but after throwing an error it seems like the plot is in an inconsistent state and can't recover by redrawing.
I think we want to solve this at the plotly.js level via https://github.com/plotly/plotly.js/issues/4155
I'm building a webapp that has multiple tabs, some of which include Plotly
go.Scattermapbox
andgo.Choroplethmapbox
elements. Tab visibilty is controlled by a callback usingdisplay
set to'block'
or'none'
. I'm getting a Javascript error if I move the Mapbox plots to a tab which is not displayed on app startup.My current environment (Python 3.6.9 under the Windows Subsystem for Linux version of Ubuntu 18.04 LTS) includes
My browser is Chrome 83.0.4103.61.
This is a minimum working example of my code that reproduces the error:
When the default value of
dcc.Tabs
is set tovalue='map'
, the app works as expected. When it's set tovalue='text'
, the map is not loaded, and the debugger returns the following JS error:I've had no problems setting
display
to none for other types of Plotly plots, so figured this has to do with being unable to hide the Mapbox layer?