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(