Hi guys
I have used a call back function to switch between two types of maps in my covid 19 dashboard , on my local host it was working well but once I deployed the app it stopped working ,
this is call back function :
@app.callback(
Output(“graph”, “figure”),
Input(“selection”, “value”))
def display_animated_graph(selection):
if selection==‘Trajectory of Pandemic’:
df_country=df.groupby(['Countrycode','Country','date']).sum().reset_index()
fig = px.choropleth(df_country, locations="Countrycode", color = "total_cases",
hover_name= "Country",animation_frame=date,
hover_data = df[['total_cases','new_cases','total_deaths']],
color_continuous_scale=px.colors.sequential.Plasma)
fig.update_layout(transition={'duration':1000},paper_bgcolor='#000000',geo=dict(bgcolor= '#000000'),margin=dict(l=0,r=0,t=0,b=0))
fig.update_traces(marker_line_color='rgba(255,255,255,0)', selector=dict(type='choroplethmapbox'))
fig.layout.template='plotly_dark'
else:
df_country=df.groupby(['Countrycode','Country']).sum().reset_index()
yesterdays_date=df['date'].max()
fig = px.choropleth(df_country, locations="Countrycode", color = "total_cases",
hover_name= "Country",
hover_data = ['total_cases','new_cases','total_deaths'],
projection="orthographic",
color_continuous_scale=px.colors.sequential.OrRd_r)
fig.update_layout(paper_bgcolor='#000000',geo=dict(bgcolor= '#000000'),
title=f"Cumulative Cases since the start of pandemic untill {yesterdays_date}")
fig.layout.template='plotly_dark'
return fig
if name==‘main’:
app.run_server(debug=True, port=8000)
the app is available here https://bahageel-corona-covid19-dashboard.onrender.com/
and view my code visit my repo here and help me address this problem
GitHub - Datascientist88/Dash_Dashboard_COVID19_NO_ONE
just what is wrong what my call back function in order to rectify it and learn from my mistake
thanks lovely community