Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Dash DAQ slider cannot set default value to zero when min is negative

I am trying to use the daq slider for value between -100% to +100% with a default set at 0. However, when I do that, it will display the minimum value instead.
Here is the code:

import dash
from dash.dependencies import Input, Output
import dash_html_components as html
import dash_core_components as dcc
import dash_daq as daq


external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

app.layout = html.Div([
    daq.Slider(
        id = 'my-daq-slider',
        min=-100,
        max=100,
        value=0,
        handleLabel={"showCurrentValue": True,"label": "%"},
        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)

And here is a screenshot of the result:
Screenshot%20from%202019-06-14%2016-51-30
My work around now is to set the value=0.1 instead, but this is not ideal. Are there any fix to this. I am using version 0.1.0 of DAQ. Thanks in advance for any help.

Hi @chainster_mike,

As users of Plotly Dash, we shared the same experience with you and took initiative to report the issue to the DAQ team @ Dash DAQ slider cannot set default value to zero when min is negative · Issue #161 · plotly/dash-daq · GitHub. To our surprise, with your discovery on the issue since 2019y until now, the issue still exist and nobody seems to look into your comment here.

One thing to share with you is that the proper channel to report issue is in the Github instead of Plotly Community. You might want to consider reporting issue in Github for speedy support from DAQ team.

In case you are looking for solution over similar issue, we have found another by replacing daq with dcc:

import dash
from dash import html
from dash import dcc

app = dash.Dash(__name__)

app.layout = html.Div([
    dcc.Slider(
        id = 'my-dcc-slider',
        min=-100,
        max=100,
        value=0, # Working
        step=1
    ),
    html.Div(id='slider-output')
], style={'padding':100})

@app.callback(
    dash.dependencies.Output('slider-output', 'children'),
    [dash.dependencies.Input('my-dcc-slider', 'value')])
def update_output(value):
    return 'The slider is currently at {}.'.format(value)


if __name__ == '__main__':
    app.run_server(debug=True)