Task 5b done
This commit is contained in:
		
							parent
							
								
									aad677e9be
								
							
						
					
					
						commit
						f64cf5ed4d
					
				| @ -53,18 +53,19 @@ app.layout = html.Div( | |||||||
|     ], |     ], | ||||||
|     className="m-4", |     className="m-4", | ||||||
| ) | ) | ||||||
| @app.callback(Output("graph_1", "figure"), Input("color", "value")) | @app.callback(Output("graph_1", "figure"), Input("color", "value"), Input("range", "value")) | ||||||
| 
 | 
 | ||||||
| def update_graph_1(dropdown_value_color): | def update_graph_1(color, range): | ||||||
|     fig = px.histogram(df, x="y", color_discrete_sequence=[dropdown_value_color]) |     dff = df[(df['y'] > range[0]) & (df['y'] < range[1])] | ||||||
|  |     fig = px.histogram(dff, x="y", color_discrete_sequence=[color]) | ||||||
|     fig.update_layout() |     fig.update_layout() | ||||||
|     return fig |     return fig | ||||||
| 
 | 
 | ||||||
| @app.callback(Output("graph_2", "figure"), Input("range", "value")) | @app.callback(Output("graph_2", "figure"), Input("color", "value"), Input("range", "value")) | ||||||
| 
 | 
 | ||||||
| def update_graph_2(range): | def update_graph_2(color, range): | ||||||
|     dff = df[(df['y'] > range[0]) & (df['y'] < range[1])] |     dff = df[(df['y'] > range[0]) & (df['y'] < range[1])] | ||||||
|     fig = px.scatter(dff, x='x', y='y') |     fig = px.scatter(dff, x='x', y='y', color_discrete_sequence=[color]) | ||||||
|     fig.update_layout() |     fig.update_layout() | ||||||
|     return fig |     return fig | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Marc Gauch
						Marc Gauch