def update_hello(value): if value: df = make_country_df(value) else: df = make_global_df() fig = px.line( df, x="date", y=["confirmed", "deaths", "recovered"], template="plotly_dark", labels={ "value": "Cases", "variable": "Condition", "date": "Date" }, hover_data={ "value": ":,", "variable": False, "date": False }, ) fig.update_xaxes(rangeslider_visible=True) fig["data"][0]["line"]["color"] = "#e74c3c" fig["data"][1]["line"]["color"] = "#8e44ad" fig["data"][2]["line"]["color"] = "#27ae60" return fig
def update_hello(value): if value: df = make_country_df(value) else: df = make_global_df() fig = px.line( df, x="date", y=["confirmed", "deaths", "recovered"], template="plotly_dark", labels={ "value": "Cases", "variable": "Condition", "date": "Date" }, hover_data={ "value": ":,", "variable": False, "date": False }, ) fig.update_xaxes( rangeslider_visible=True, rangeselector=dict(buttons=list([ dict(count=1, label="1m", step="month", stepmode="backward"), dict(count=6, label="6m", step="month", stepmode="backward"), dict(count=1, label="YTD", step="year", stepmode="todate"), dict(count=1, label="1y", step="year", stepmode="backward"), dict(step="all"), ])), ) fig["data"][0]["line"]["color"] = "#e74c3c" fig["data"][1]["line"]["color"] = "#8e44ad" fig["data"][2]["line"]["color"] = "#27ae60" return fig
def update_hello(value): if value: df = make_country_df(value) else: df = make_global_df() fig = px.line(df, x="date", y=["confirmed", "deaths", "recovered"], template="plotly_dark", labels={ "value": "Cases", "variable": "Condition", "value": "Date", }, hover_data={ "value": ":,", "variable": False, "date": False, }) fig.update_xaxes(rangeslider_visible=True) fig["data"][0]["line"]["color"] = "pink" return fig ## for only development #if __name__ == '__main__': # app.run_server(debug=True)
def update_line_graph(value): if value: df = make_country_df(value) else: df = make_global_df() fig = px.line( df, x="index", y=["confirmed", "deaths", "recovered"], template="plotly_dark", labels={ "value": "Cases", "variable": "Condition", "index": "Date" }, hover_data={ "value": ":,", "variable": False, "index": False }, color_discrete_map={ "confirmed": "#e74c3c", "deaths": "#8e44ad", "recovered": "#27ae60", }, ) fig.update_xaxes(rangeslider_visible=True) return fig
def update_hello(value): if value is None: df = make_global_df() else: df = make_country_df(value) lines_graph = make_lines(df) lines_graph.update_xaxes(rangeslider_visible=True) lines_graph["data"][0]["line"]["color"] = "#e74c3c" lines_graph["data"][1]["line"]["color"] = "#8e44ad" lines_graph["data"][2]["line"]["color"] = "#27ae60" return lines_graph
def interactive_graph(value): if value: df = make_country_df(value) else: df = make_global_df() fig = px.line( df, x="date", y=["confirmed", "deaths", "recovered"], template="plotly_dark", labels={ "value": "Cases", "variable": "Condition", "date": "Date" }, hover_data={ "value": ":,", "variable": False }, ) return fig