Update main.py
This commit is contained in:
		
							parent
							
								
									81c44f4a0b
								
							
						
					
					
						commit
						249d8f1703
					
				| @ -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( | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 marcgauch
						marcgauch