dash-daq
dash-daq copied to clipboard
Dash DAQ slider cannot set default value to zero when min is negative
Hi,
I've encountered the same issue with chainster_mike @ https://community.plotly.com/t/dash-daq-slider-cannot-set-default-value-to-zero-when-min-is-negative/24578. It has been discovered since 2019y but nobody seems to be responding to him.
Expected behavior: When value=0, the slider value should be in the middle. When value=-1, the slider value is in the middle. When value=1, the slider value is in the middle.
Observed behavior: When value=0, the slider value is located at the most left (BUG). When value=-1, the slider value is in the middle. When value=1, the slider value is in the middle.
Workaround by chainster_mike is to set the value to 0.1. IMHO, this issue should be fixed by Dash DAQ.
Below is our minimal code to reproduce the issue:
import dash
from dash import html
import dash_daq as daq
app = dash.Dash(__name__)
app.layout = html.Div([
daq.Slider(
id = 'my-daq-slider',
min=-100,
max=100,
value=0, #Issue
step=1
),
html.Div(id='slider-output')
], style={'padding':100})
@app.callback(
dash.dependencies.Output('slider-output', 'children'),
[dash.dependencies.Input('my-daq-slider', 'value')])
def update_output(value):
return 'The slider is currently at {}.'.format(value)
if __name__ == '__main__':
app.run_server(debug=True)
Environment:
Python 3.9
dash==2.0.0
dash-daq==0.5.0
dash-html-components==2.0.0
Since the issue exists in DAQ for quite sometime, we don't believe it is specific to porting from DAQ 1.0 to DAQ 2.0.
Also, we hope someone would prioritize this issue as it has been there for quite a long time.