Ejemplo n.º 1
0
def update_graph(*args):
    triggered_name = dash.callback_context.triggered[0]['prop_id'].split('.')[0]
    triggered_value = dash.callback_context.triggered[0]['value']
    if not dash.callback_context.triggered:
        triggered_name = 'state-selected'
        triggered_value = "Delhi"

    if triggered_name == 'state-selected':
        df = state_data_daily(triggered_value)
        return make_graph(df, triggered_value), dbc.Col(get_card_layout(df[-1:]), align="center")
    else:
        df = district_data_daily(triggered_value)
        return make_graph(df, triggered_value), dbc.Col(get_card_layout(df[-1:]), align="center")
Ejemplo n.º 2
0
                no_gutters=False),
        html.Br(),
        dbc.Row([
            make_card(df, "Recovered", "success"),
            dbc.Col([make_card(df, "Deceased", "light")],
                    style=dict(marginLeft="10px"))
        ],
                justify="center",
                no_gutters=False),
        html.Br()
    ]


cards = dbc.Col(get_card_layout(get_data()[-1:]), align="center")

cards_lower = dbc.Col(get_card_layout(state_data_daily("Delhi")[-1:]),
                      id="lower_card",
                      align="center")

# carddeck = dbc.CardDeck([confirmed, active, recovered, death], style={"width": "50rem"})

# cards = dbc.Row([
#     carddeck
#     ], justify="center")

# cards = dbc.Row([
#     dbc.Col(confirmed, width={"size": 1.5, "order": 1}),
#     dbc.Col(active, width={"size": 1.5, "order": 2,}),
#     dbc.Col(recovered, width={"size": 1.5, "order": 3,}),
#     dbc.Col(death, width={"size": 1.5, "order": 4})
# ], justify="center", no_gutters=False)
Ejemplo n.º 3
0
    html.Br(),
    dbc.Row([make_card(df, "Recovered", "success"), dbc.Col([make_card(df, "Deceased", "light")], style=dict(marginLeft="10px"))],
        justify="center",
        no_gutters=False),
    html.Br()
    ],  align="center")
    # dbc.Col([
    #     dbc.Row([],
    #         justify="center",
    #         no_gutters=False), html.Br(),
    #     dbc.Row([],
    #         justify="center",
    #         no_gutters=False)])
    #     ], style=dict(marginLeft="10px"))

df_1 = state_data_daily("Delhi")[-1:]
cards_lower = dbc.Col([
    dbc.Row([make_card(df_1, "Confirmed", "info"), dbc.Col([make_card(df_1, "Active", "danger")],  style=dict(marginLeft="10px"))],
        justify="center",
        no_gutters=False), 
    html.Br(),
        # dbc.Row([],
        #     justify="center",
        #     no_gutters=False)], style={"width": "150px"}),
    dbc.Row([make_card(df_1, "Recovered", "success"), dbc.Col([make_card(df_1, "Deceased", "light")], style=dict(marginLeft="10px"))],
            justify="center",
            no_gutters=False), 
        #     html.Br(),
        # dbc.Row([],
        #     justify="center",
        #     no_gutters=False)], style={"width": "150px"})
Ejemplo n.º 4
0
                        paper_bgcolor='rgba(0,0,0,0)',
                        plot_bgcolor='rgba(0,0,0,0)',
                        dragmode=False,
                        hovermode="x",
                        height=500,
                        width=800,
                        titlefont=dict(color='#FFFFFF')))
    return fig


def get_graph():
    pass


lower_graph = dcc.Graph(id='lower_graph',
                        figure=make_graph(state_data_daily("Delhi"), "Delhi"),
                        config={
                            "displayModeBar": False,
                            "showTips": False
                        })

df = get_data()
total_graph = dcc.Graph(
    id='total_graph',
    # figure = make_graph(get_data(), "India"),
    figure=go.Figure(data=[
        get_graph_data(df, 'Confirmed', '#3498DB'),
        get_graph_data(df, 'Active', '#E74C3C'),
        get_graph_data(df, 'Recovered', '#00bc8c'),
        get_graph_data(df, 'Deceased', '#adb5bd'),
    ],