Search code examples
pythonplotly-dashdashboard

Range Slider Labels are not showing (marks)


    data = [[30, 100], [31, 200], [32, 80], [33, 90], [34, 25], [35, 125],[36, 130],[37, 159],
           [38, 60]]
    df = pd.DataFrame(data, columns = ['week', 'orders'])

    html.Div([
    html.H3('Week Range'),
    dcc.RangeSlider(
        id='slider',
        min=df["week"].min(),
        max=df["week"].max(),
        value=[30, 38],
        step=None,
        marks={int(i):int(i) for i in list(df["week"].unique())}
    )])

After a lot of search i could not find why this RangeSlider labels are not showing, check the attached image we will find that the two ends of the slider have 3 and 8 which i think that this is the left number of the first week = 30 "3" and the last number of the last week = 38 "8"

enter image description here


Solution

  •     data = [[30, 100], [31, 200], [32, 80], [33, 90], [34, 25], [35, 125],[36, 130],[37, 159],
           [38, 60]]
    df = pd.DataFrame(data, columns = ['week', 'orders'])
    
    html.Div([
    html.H3('Week Range'),
    dcc.RangeSlider(
        id='slider',
        min=df["week"].min(),
        max=df["week"].max(),
        value=[30, 38],
        step=None,
        marks={int(i):str(i) for i in list(df["week"].unique())}
    )]),html.Br(),
    

    the problem that the second graph div was just below the RangeSlider which made the almost the display label area not showing so a break line will 100% solve the issue