FIXED: DRY
This commit is contained in:
		
							parent
							
								
									2faaa900a3
								
							
						
					
					
						commit
						aad677e9be
					
				@ -12,6 +12,8 @@ app = Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
df = pd.DataFrame({'y': np.random.normal(loc=0, scale=10, size=1000),
 | 
					df = pd.DataFrame({'y': np.random.normal(loc=0, scale=10, size=1000),
 | 
				
			||||||
                   'x': np.random.normal(loc=10, scale=2, size=1000)})
 | 
					                   'x': np.random.normal(loc=10, scale=2, size=1000)})
 | 
				
			||||||
 | 
					df_min = math.floor(df["y"].min())
 | 
				
			||||||
 | 
					df_max = math.ceil(df["y"].max())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
app.layout = html.Div(
 | 
					app.layout = html.Div(
 | 
				
			||||||
    [
 | 
					    [
 | 
				
			||||||
@ -32,9 +34,9 @@ app.layout = html.Div(
 | 
				
			|||||||
                dbc.Col(
 | 
					                dbc.Col(
 | 
				
			||||||
                    [
 | 
					                    [
 | 
				
			||||||
                        dcc.RangeSlider(
 | 
					                        dcc.RangeSlider(
 | 
				
			||||||
                            min=math.floor(df["y"].min()),
 | 
					                            min=df_min,
 | 
				
			||||||
                            max=math.ceil(df["y"].max()),
 | 
					                            max=df_max,
 | 
				
			||||||
                            value=[math.floor(df["y"].min()), math.ceil(df["y"].max())],
 | 
					                            value=[df_min, df_max],
 | 
				
			||||||
                            id="range",
 | 
					                            id="range",
 | 
				
			||||||
                        )
 | 
					                        )
 | 
				
			||||||
                    ],
 | 
					                    ],
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user