Black Lives Matter. Please consider donating to Black Girls Code today.

Labels not shown in range slider

my code for the slider:
html.Div([dcc.RangeSlider(id=“day-range”, updatemode=‘mouseup’,
min=unix_time_hour.convert(df.datetime.min()),
max=unix_time_hour.convert(df.datetime.max()),

                                                  marks=unix_time_hour.get_marks_from_start_end(
                                                       df.datetime.min(),
                                                       (df.datetime.max())),

                                                  value=[unix_time_hour.convert(df.datetime.min()),
                                                         unix_time_hour.convert(df.datetime.max())],
                                                  pushable=1
                                                  ),
                                  ],
                                 ),
                        width={"size": 8, "offset": 2},

the generated marks is:
{26524800: ‘06/07’, 26526240: ‘06/08’, 26527680: ‘06/09’, 26529120: ‘06/10’, 26530560: ‘06/11’, 26532000: ‘06/12’}

any suggestion and comments are welcome.

Pengchu

1 Like

It’s a bug whereby the dictionary keys must be integers for the labels to show up. Just cast the keys to int() to remove the decimal, and the labels will appear.