Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def callback_graph_analysis(
labels = [": ".join(i) for i in product(label_ufunc, label_periods)]
labels += ["Maximum Rainfall Events"]

children = pylayoutfunc.create_tabcard_graph_layout(all_graphs, labels)
children = pylayoutfunc.create_tabcard_graph_layout(all_graphs, labels, active_tab='Maximum Rainfall Events')

return children

Expand Down
20 changes: 16 additions & 4 deletions pylayoutfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ def create_table_summary(


def create_tabcard_table_layout(
tables: list, tab_names: list = None, disabled: list = None
tables: list,
tab_names: list = None,
disabled: list = None,
active_tab: str = None,
):

disabled = [False] * len(tables) if disabled is None else disabled
Expand All @@ -88,14 +91,20 @@ def create_tabcard_table_layout(
dbc.Card(dbc.CardBody([table]), class_name="my-3"),
label=tab_name,
disabled=active,
tab_id=tab_name,
)
tab.append(_tab)

return dbc.Tabs(tab)
active_tab = tab_names[0] if active_tab is None else active_tab

return dbc.Tabs(tab, active_tab=active_tab)


def create_tabcard_graph_layout(
graphs: list[dcc.Graph], tab_names: list = None, disabled: list = None
graphs: list[dcc.Graph],
tab_names: list = None,
disabled: list = None,
active_tab: str = None,
):

disabled = [False] * len(graphs) if disabled is None else disabled
Expand All @@ -107,10 +116,13 @@ def create_tabcard_graph_layout(
dbc.Card(dbc.CardBody([graph]), class_name="my-3"),
label=tab_name,
disabled=active,
tab_id=tab_name,
)
tab.append(_tab)

return dbc.Tabs(tab)
active_tab = tab_names[0] if active_tab is None else active_tab

return dbc.Tabs(tab, active_tab=active_tab)


def create_HTML_alert(alert: dbc.Alert, className: str = "my-2"):
Expand Down