'Update variable using Dash slider
I have a program that uses variables as part of calculations that are applied to dataframes to create a forecast. I'm now trying to display the results in a Dash dashboard and I want users to be able to change the values of the variables using sliders in the dashboard. The chart and slider are showing as I want them to but when I move the slider up and down it doesn't make any change to the chart so I think it's the function definition I'm struggling with.
app = JupyterDash('EmissionIntensity')
app.layout = html.Div(children=[dcc.Graph(id='NB_lineFig',figure=NB_lineFig),dcc.Slider(id='value_slider',min=(elec_COP/2),max=(elec_COP*2),value=elec_COP,step=0.4,vertical=False)])
@app.callback(Output(component_id='NB_lineFig',component_property='figure'),Input(component_id='value_slider',component_property='value'))
def useSlider(elec_COP_slider):
NB_AbsCO2TonnesCopy = NB_AbsCO2Tonnes.copy(deep=True)
elec_COP_slider = NB_AbsCO2TonnesCopy * elec_COP_slider
return elec_COP_slider
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
