-
Notifications
You must be signed in to change notification settings - Fork 949
range slider which can be moved around? #2249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is what I mean: |
Actually this one looks much closer to ipywidgets: |
The slider currently in use is a jQuery slider. I do not think that supports moving the entire range in one operation. For an earlier discussion about replacing the slider, see here: #630 As a tanget, it should be entirely possible to make an external widgets extension that implements an alternative slider UI, but that will not work with the default interact without some monkey patching. |
I would find such an addition to |
Apparently, |
I've made some kind of workaround, which is not quite working, but maybe someone can help improving it? This would be good enough for my purposes, and here is a code example: import ipywidgets as ipw
sl = ipw.IntRangeSlider()
setattr(sl, "lock", False)
def update(change):
if not change["owner"].lock:
diff = change["new"][0] - change["old"][0]
if abs(diff) > 0:
change["owner"].lock = True
sl1.value = (change["new"][0], change["new"][1] + diff)
change["owner"].lock = False
sl.observe(update, names="value")
sl Now the issue I have is that when i move the left handle too fast, the right handle doesn't quite keep up with the pace, and my range either grows or shrinks, whether i'm moving the left handle towards the left or the right, respectively. I have also tried a slightly different approach by assigning a delta property to the slider and then updating the right bound using the stored delta rather than a on-the-fly delta that may have changed while the left handle was moving before the right handle had time to update, but that seems to suffer from the same problem: import ipywidgets as ipw
sl = ipw.IntRangeSlider()
setattr(sl, "lock", False)
setattr(sl, "delta", sl.value[1] - sl.value[0])
def update(change):
if not change["owner"].lock:
diff = change["new"][1] - change["old"][1]
if abs(diff) > 0:
change["owner"].delta = change["new"][1] - change["old"][0]
else:
change["owner"].lock = True
change["owner"].value = (change["new"][0], change["new"][0] + change["owner"].delta)
change["owner"].lock = False
sl.observe(update, names="value")
sl Maybe it's the way i'm using the |
I was also trying to find a way to do this by linking on the client side with I also cannot find a way to |
Here is another example of a range slider that can be dragged: http://docs.bokeh.org/en/latest/docs/user_guide/interaction/widgets.html#rangeslider |
Hasn't this been fixed in #2712 ? |
I'm using this example of data range slider:
https://stackoverflow.com/a/50506926/2230844
But I would like to add the scrolling capability for the slider itself, i.e. move the range right/left without changing its window size. Is this possible?
The text was updated successfully, but these errors were encountered: