Skip to content
Advertisement

Dash RangeSlider automatically rounds marks

I am using the RangeSlider in Python Dash. This slider is supposed to allow users to select a range of dates to display, somewhere between the minimum and maximum years in the dataset. The issue that I am having is that each mark shows as 2k due to it being automatically rounded. The years range between 1784 and 2020, with a step of 10 each time. How do I get the marks to show as the actual dates and not just 2k? This is what I have below.

JavaScript

Advertisement

Answer

You can use attribute marks to style the ticks of the sliders as follows:

JavaScript

The full code:

JavaScript

Output enter image description here

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement