Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Preserving the zoom of choropleth in Dash

$
0
0

Is there a way to preserve zoom state of a choropleth between callbacks?

I am currently updating the choropleth via a callback function that generates a new figure and returning it to gcc.Graph. Replacing a whole figure should be easier than updating individual elements in an existing figure’s data and layout.

I tried to do the following:

  1. Track relayoutData when user zooms using State callback that’s linked to gcc.Graph.
  2. Generate a new choropleth.
  3. Change layout properties of new choropleth according to relayoutData.
  4. Return new choropleth with updated layout to gcc.Graph

I used fig['layout'].update(relayoutData) to change the layout peroperties, but it didn’t work because of error
‘mapbox._derived’ is not a valid property for plotly.graph_objs.Layout

Any thoughts?

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles