question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom scales for sliders

See original GitHub issue

Often when using sliders to manipulate some algorithm parameters it is useful to have logarithmic scale, instead of linear. Now I guess the only way is to manually apply the transformation in the handler, e.g. have the slider from -3 to 3 and in handler write value = 10**value. One thing is that it’s not really convenient (code defining the real slider range becomes split into two parts in entirely different places), and another is that the slider label of course shows the “raw” value, not the real one used in computations.

I think there is a relatively easy solution - add two function arguments for FloatSlider to convert back and forth between the slider raw value and the real one (in my example they would be lambda x: 10**x and lambda x: log10(x), and/or maybe a boolean argument log for convenience, as probably logarithmic scale is needed way more often than other custom ones.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rafaqzcommented, Nov 24, 2017

Bump on this issue. Setting a slider to be log-scaled over its range is a common need - I guess it should be as common as a log scale on a plot.

It’s much cleaner having a log setting on the slider than transforming the return values with a separate function. Say you have 30 sliders for otherwise indistinguishable variables that are built programatically and displayed in order - but some need log scaling and others do not. Setting a ‘log’ flag on slider creation would make this really easy, while coding it manually, not so much. Lambdas might be overkill, as log and linear modes will cover 99.9% of use. Log should also be simple to implement.

0reactions
sebasgutscommented, Jan 23, 2018

I will give this a shot

Read more comments on GitHub >

github_iconTop Results From Across the Web

Slide Scale - Etsy
Check out our slide scale selection for the very best in unique or custom, handmade pieces from our shops.
Read more >
Customized Pain Scale Rulers 0-100mm w/Slider
Customized MED-05-100 VAS Pain Scale Rulers made of combination white PVC and clear HIPS have 0-100 mm scales ... They come with a...
Read more >
Create a Slider Scale Survey Easily - Jotform
Create custom slider scale surveys to gather feedback, evaluations, and more. Drag and drop to add slider scales to your surveys and let...
Read more >
Custom Scale Slider in React Native | by Kiran Shinde
Custom Scale Slider in React Native ; min: start for the slider; max: end for the slider; step: Increment interval; snapped: slide at...
Read more >
How to Use a Slider Scale in Surveys: A Mini-Guide
#4. Discrete slider scales. Discrete sliding scales allow you to choose pre-defined values marked along the scale. Example of a discrete slider ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found