src/pages/dashboard.py
def plot_snapshot_numbers(df, colors, date, country=None):
    """
    Function plots snapshots for worldwide and countries.

    :param df: DataFrame
    :param colors: list
    :param date: datetime object
    :param country: str
    :return: plotly.figure
    """
    with st.spinner("Rendering chart..."):
        colors = px.colors.qualitative.D3
        if country:
            df = df[df["Country_Region"] == country]
        fig = go.Figure()
        fig.add_trace(go.Bar(y=df[["Confirmed", "Deaths", "Recovered", "Active"]].columns.tolist(),
                             x=df[["Confirmed", "Deaths", "Recovered", "Active"]].sum().values,
                             text=df[["Confirmed", "Deaths", "Recovered", "Active"]].sum().values,
                             orientation='h',
                             marker=dict(color=[colors[1], colors[3], colors[2], colors[0]]),
                             ),
                      )
        fig.update_traces(opacity=0.7,
                          textposition=["inside", "outside", "inside", "inside"],
                          texttemplate='%{text:.3s}',
                          hovertemplate='Status: %{y} <br>Count: %{x:,.2f}',
                          marker_line_color='rgb(255, 255, 255)',
                          marker_line_width=2.5
                          )
        fig.update_layout(
            title="Total count",
            width=800,
            legend_title_text="Status",
            xaxis=dict(title="Count"),
            yaxis=dict(showgrid=False, showticklabels=True),
        )

    return fig

    Function plots snapshots for worldwide and countries.

    :param df: DataFrame
    :param colors: list
    :param date: datetime object
    :param country: str
    :return: plotly.figure
    
Function plots snapshots for worldwide and countries.
Function plots snapshots for worldwide and countries .
def plot_snapshot_numbers(df, colors, date, country=None):
    with st.spinner("Rendering chart..."):
        colors = px.colors.qualitative.D3
        if country:
            df = df[df["Country_Region"] == country]
        fig = go.Figure()
        fig.add_trace(go.Bar(y=df[["Confirmed", "Deaths", "Recovered", "Active"]].columns.tolist(),
                             x=df[["Confirmed", "Deaths", "Recovered", "Active"]].sum().values,
                             text=df[["Confirmed", "Deaths", "Recovered", "Active"]].sum().values,
                             orientation='h',
                             marker=dict(color=[colors[1], colors[3], colors[2], colors[0]]),
                             ),
                      )
        fig.update_traces(opacity=0.7,
                          textposition=["inside", "outside", "inside", "inside"],
                          texttemplate='%{text:.3s}',
                          hovertemplate='Status: %{y} <br>Count: %{x:,.2f}',
                          marker_line_color='rgb(255, 255, 255)',
                          marker_line_width=2.5
                          )
        fig.update_layout(
            title="Total count",
            width=800,
            legend_title_text="Status",
            xaxis=dict(title="Count"),
            yaxis=dict(showgrid=False, showticklabels=True),
        )
    return fig
def plot_snapshot_numbers ( df , colors , date , country = None ) : with st . spinner ( "Rendering chart..." ) : colors = px . colors . qualitative . D3 if country : df = df [ df [ "Country_Region" ] == country ] fig = go . Figure ( ) fig . add_trace ( go . Bar ( y = df [ [ "Confirmed" , "Deaths" , "Recovered" , "Active" ] ] . columns . tolist ( ) , x = df [ [ "Confirmed" , "Deaths" , "Recovered" , "Active" ] ] . sum ( ) . values , text = df [ [ "Confirmed" , "Deaths" , "Recovered" , "Active" ] ] . sum ( ) . values , orientation = 'h' , marker = dict ( color = [ colors [ 1 ] , colors [ 3 ] , colors [ 2 ] , colors [ 0 ] ] ) , ) , ) fig . update_traces ( opacity = 0.7 , textposition = [ "inside" , "outside" , "inside" , "inside" ] , texttemplate = '%{text:.3s}' , hovertemplate = 'Status: %{y} <br>Count: %{x:,.2f}' , marker_line_color = 'rgb(255, 255, 255)' , marker_line_width = 2.5 ) fig . update_layout ( title = "Total count" , width = 800 , legend_title_text = "Status" , xaxis = dict ( title = "Count" ) , yaxis = dict ( showgrid = False , showticklabels = True ) , ) return fig
Function plots snapshots for worldwide and countries.
Function plots snapshots for worldwide and countries .
"""
    Function plots snapshots for worldwide and countries.

    :param df: DataFrame
    :param colors: list
    :param date: datetime object
    :param country: str
    :return: plotly.figure
    """
None
df
None
colors
None
date
None
country
None