Background: I have a group of datasets showing population data for various age groups: [0, 1, 5, 10, 15, 20… 75, 80] where the number refers to the lower bound of the age group and the next number the upper bound, so 0 means 0<=x<1, 1 means 1<=x<5 and from there on every number means the next 5 years, except for the 80 which means 80<=x.
Task: I need to have a slider where the user can select between these numbers. If all the numbers would be multiples of 5, I could use
step, but 0 and 1 are different. If the users could choose anything (like 7), I could just use
step=1, and then show them the closest, but I have to force them to pick a valid value.
My best idea so far is to index the groups from 0, and then use PrintfTickFormatter to display the real value (so if 3 is selected, 10 should be displayed) AND to do that at the same time when dealing with the picked value.
But this feels like a suboptimal hack where the saved and displayed values are and should be the same, I’m just doing a two-way conversion every time between them. Also, this will force a uniform distance between the ticks which may or may not be desired. (For me it will depend on the available space in the end: if it would be a wide slider, a non-uniform distribution would be better. If it would be a short one then uniform distribution actually would be more useful.)