From 249d8f17036d1b1c85c5293cc70480d1251d299c Mon Sep 17 00:00:00 2001 From: marcgauch <34353267+marcgauch@users.noreply.github.com> Date: Sat, 3 Jun 2023 16:15:40 +0200 Subject: [PATCH] Update main.py --- dashboard8/main.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dashboard8/main.py b/dashboard8/main.py index 9e420ab..b9a47d5 100644 --- a/dashboard8/main.py +++ b/dashboard8/main.py @@ -188,6 +188,7 @@ app.layout = html.Div( ) ] ), + dbc.Row([html.Div(id="html_table")]), ], style={"margin": "10px 25px 25px 25px"}, ) @@ -240,6 +241,7 @@ def update_graph_2(min_value): @app.callback( Output("graph_3", "figure"), Output("graph_4", "figure"), + Output("html_table", "children"), Input("graph_5", "relayoutData"), ) def update_graph_3_and_4(selected_data): @@ -280,8 +282,17 @@ def update_graph_3_and_4(selected_data): xaxis_title="cluster", title_font_size=25, ) + # dritter return wert: die generierte Tabelle + return fig3, fig4, generate_table(group_counts) - return fig3, fig4 + +def generate_table(dataframe): + table = [html.Tr([html.Th("Cluster"), html.Th("Value")])] + + # https://stackoverflow.com/a/16476974 + for index, row in dataframe.iterrows(): + table.append(html.Tr([html.Td(index), html.Td(row["X"])])) + return dbc.Table(table, bordered=True) @app.callback(