Skip to content

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

Open

Description

@viper7882

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.

Activity

  1. added a commit that references this issue on Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions