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
Map does not initially render in correct size #155
Comments
Hi @nchelaru, I have observed the same with other plotly_express chart types use in Dash. I don't have an explanation for it but what worked best for me was to have the Hope this can help. |
@DrGFreeman Thank you so much for your reply, and apologies for my late reply! I think that my callback does return the entire @app.callback(
Output('map-container', "children"),
[Input('datatable-interactivity', "derived_virtual_data"),
Input('datatable-interactivity', "derived_virtual_selected_rows")])
def update_graphs(rows, derived_virtual_selected_rows):
if derived_virtual_selected_rows is None:
derived_virtual_selected_rows = []
dff = merged_df if rows is None else pd.DataFrame(rows)
grouped = dff.groupby(['ZipCode', 'OrderDate', 'Latitude', 'Longitude', 'Location', 'City', 'State', 'Year'])['TotalAmount'].sum().reset_index()
grouped = grouped[grouped['TotalAmount'] > 0]
grouped['Log(TotalRevenue)'] = np.log(grouped['TotalAmount'])
return [
dcc.Graph(
figure=map(grouped),
style={'width':'55vw', 'height':'inherit'}
)
] dbc.Col(dbc.Card([
dbc.CardHeader("Geographic distribution of sales territories",
style={'backgroundColor':'#F3AE4E', 'color':'white', 'fontWeight':'bold'}),
dbc.CardBody(
id='map-container'
),
], className='h-100', color="light", outline=True), width=7) This app single-page, but with multiple tabs. Curiously, if the tab that contains this map is the first one to be loaded, the map renders in the correct size. This is not a serious problem, but a strange one. |
Hello!
I am creating a Dash app that includes a map made using the following code:
The map is embeded in the Dash app like so:
The strange thing is that on start-up of the app, the map almost always shows up in a smaller size.
When I click on the animation button, the map then pops into the right size.
Is there a way to correct this?
Thank you very much!
The text was updated successfully, but these errors were encountered: