Esempio n. 1
0
def stats_tab_content(state):
    df = stats_table(state)

    font_size_heading = ".4vh"
    font_size_body = ".9vw"
    table = dash_table.DataTable(
        data=df.to_dict("records"),
        columns=[
            {
                "name": "State/County",
                "id": "State/County",
            },
            {
                "name": "Confirmed",
                "id": "Confirmed",
                "type": "numeric",
                "format": Format(group=","),
            },
            {
                "name": "Deaths",
                "id": "Deaths",
                "type": "numeric",
                "format": Format(group=","),
            },
        ],
        editable=False,
        sort_action="native",
        sort_mode="multi",
        column_selectable="single",
        style_as_list_view=True,
        fixed_rows={"headers": True},
        fill_width=False,
        style_table={
            # # 'overflowX': 'scroll',
            # 'minWidth': '0',
            "width": "100%",
            "height": "100vh",
        },
        style_header={
            # "font-size": font_size_heading,
            "backgroundColor": color_bg,
            "border": color_bg,
            "fontWeight": "bold",
            "font": "Lato, sans-serif",
            # "padding": "1.5vh",
            "height": "2vw",
        },
        style_cell={
            "font-size": font_size_body,
            "font-family": "Lato, sans-serif",
            "border-bottom": "0.01rem solid #313841",
            "backgroundColor": "#010915",
            "color": "#FEFEFE",
            "height": "2.75vw",
        },
        style_cell_conditional=[
            {
                "if": {
                    "column_id": "State/County",
                },
                # "minWidth": "6.8rem",
                # "width": "6.8rem",
                # "maxWidth": "6.8rem",
                "minWidth": "4vw",
                "width": "4vw",
                "maxWidth": "4vw",
            },
            {
                "if": {
                    "column_id": "Confirmed",
                },
                "color": "#F4B000",
                # "minWidth": "4.2rem",
                # "width": "4.2rem",
                # "maxWidth": "4.2rem",
                "minWidth": "3vw",
                "width": "3vw",
                "maxWidth": "3vw",
            },
            {
                "if": {
                    "column_id": "Deaths",
                },
                "color": "#E55465",
                # "minWidth": "4.2rem",
                # "width": "4.2rem",
                # "maxWidth": "4.2rem",
                "minWidth": "3vw",
                "width": "3vw",
                "maxWidth": "3vw",
            },
        ],
    )
    return table
Esempio n. 2
0
def mobile_stats_tab_content(state):
    df = stats_table(state)

    table = dash_table.DataTable(
        data=df.to_dict("records"),
        columns=[
            {
                "name": "State/County",
                "id": "State/County",
            },
            {
                "name": "Confirmed",
                "id": "Confirmed",
                "type": "numeric",
                "format": Format(group=","),
            },
            {
                "name": "Deaths",
                "id": "Deaths",
                "type": "numeric",
                "format": Format(group=","),
            },
        ],
        editable=False,
        sort_action="native",
        sort_mode="multi",
        column_selectable="single",
        style_as_list_view=True,
        fixed_rows={"headers": True},
        fill_width=False,
        style_table={
            "width": "100%",
        },
        style_header={
            "font-size": "0.65rem",
            "backgroundColor": "#010915",
            "border": "#010915",
            "fontWeight": "bold",
            "font": "Lato, sans-serif",
        },
        style_cell={
            "font-size": "0.65rem",
            "font-family": "Roboto, sans-serif",
            "border-bottom": "0.01rem solid #313841",
            "backgroundColor": "#010915",
            "color": "#FFFFFF",
            "height": "2.5rem",
        },
        style_cell_conditional=[
            {
                "if": {
                    "column_id": "State/County",
                },
                "minWidth": "4vw",
                "width": "4vw",
                "maxWidth": "4vw",
            },
            {
                "if": {
                    "column_id": "Confirmed",
                },
                "color": "#F4B000",
                "minWidth": "3vw",
                "width": "3vw",
                "maxWidth": "3vw",
            },
            {
                "if": {
                    "column_id": "Deaths",
                },
                "color": "#E55465",
                "minWidth": "3vw",
                "width": "3vw",
                "maxWidth": "3vw",
            },
        ],
    )
    return table