RangeSlider on_change

I’ve noticed that the RangeSlider range property is updated, while one drags the slider. That leads to a lot of data updates and slows down things. Is it possible to only have the RangeSlider range property be updated upon releasing the mouse button? Or is it possible to update it less frequently while dragging it? Otherwise I’ll have to specify the range with two text boxes instead. Thanks!

I can’t remember where I learned to do this, but the following will give you the update-on-mouse-release behavior:

from bokeh.layouts import column, widgetbox

from bokeh.models import CustomJS, ColumnDataSource, Slider

from bokeh.io import curdoc

source = ColumnDataSource(data=dict(value=))

def callback(attr, old, new):

Implement what you want to happen when the slider is changed here:

print slider.value

slider = Slider(start=0.1, end=4, value=1, step=.1, title=“Slider”, callback_policy=‘mouseup’)

slider.callback = CustomJS(args=dict(source=source), code=‘source.data = { value: [cb_obj.value] }’)

source.on_change(‘data’, callback)

layout = column(slider)

curdoc().add_root(widgetbox(slider))

curdoc().title = “Sliders”

···

On Wednesday, March 29, 2017 at 8:42:04 AM UTC-7, Tommy Carstensen wrote:

I’ve noticed that the RangeSlider range property is updated, while one drags the slider. That leads to a lot of data updates and slows down things. Is it possible to only have the RangeSlider range property be updated upon releasing the mouse button? Or is it possible to update it less frequently while dragging it? Otherwise I’ll have to specify the range with two text boxes instead. Thanks!

Thanks a lot nicain! It’s actually well documented:
http://bokeh.pydata.org/en/latest/docs/reference/models/widgets.inputs.html#bokeh.models.widgets.inputs.RangeSlider.callback_policy

There was an issue on GitHub about this in 2016:

https://github.com/bokeh/bokeh/issues/4540

Which refers this solution on StackOverflow:

http://stackoverflow.com/questions/38375961/throttling-in-bokeh-application

Totally unrelated. I just came across this great index page, which is not linked to from anywhere, but I found it via a Google search:

http://bokeh.pydata.org/en/latest/genindex.html

···

On Wed, 29 Mar 2017 at 18:05 nicain [email protected] wrote:

I can’t remember where I learned to do this, but the following will give you the update-on-mouse-release behavior:

from bokeh.layouts import column, widgetbox

from bokeh.models import CustomJS, ColumnDataSource, Slider

from bokeh.io import curdoc

source = ColumnDataSource(data=dict(value=))

def callback(attr, old, new):

Implement what you want to happen when the slider is changed here:

print slider.value

slider = Slider(start=0.1, end=4, value=1, step=.1, title=“Slider”, callback_policy=‘mouseup’)

slider.callback = CustomJS(args=dict(source=source), code=‘source.data = { value: [cb_obj.value] }’)

source.on_change(‘data’, callback)

layout = column(slider)

curdoc().add_root(widgetbox(slider))

curdoc().title = “Sliders”

On Wednesday, March 29, 2017 at 8:42:04 AM UTC-7, Tommy Carstensen wrote:

I’ve noticed that the RangeSlider range property is updated, while one drags the slider. That leads to a lot of data updates and slows down things. Is it possible to only have the RangeSlider range property be updated upon releasing the mouse button? Or is it possible to update it less frequently while dragging it? Otherwise I’ll have to specify the range with two text boxes instead. Thanks!

You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/nwkfeLbvgUg/unsubscribe.

To unsubscribe from this group and all its topics, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/80775795-a2e6-4df3-b1e9-cc902bbb0906%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

It would be simple enough to add a link to the Sphinx generated index. Please feel free to open a GitHub issue.

Thanks,

Bryan

···

On Mar 29, 2017, at 15:16, Tommy Carstensen <[email protected]> wrote:

Thanks a lot nicain! It's actually well documented:
http://bokeh.pydata.org/en/latest/docs/reference/models/widgets.inputs.html#bokeh.models.widgets.inputs.RangeSlider.callback_policy

There was an issue on GitHub about this in 2016:
https://github.com/bokeh/bokeh/issues/4540

Which refers this solution on StackOverflow:
http://stackoverflow.com/questions/38375961/throttling-in-bokeh-application

Totally unrelated. I just came across this great index page, which is not linked to from anywhere, but I found it via a Google search:
http://bokeh.pydata.org/en/latest/genindex.html

On Wed, 29 Mar 2017 at 18:05 nicain <[email protected]> wrote:
I can't remember where I learned to do this, but the following will give you the update-on-mouse-release behavior:

from bokeh.layouts import column, widgetbox
from bokeh.models import CustomJS, ColumnDataSource, Slider
from bokeh.io import curdoc

source = ColumnDataSource(data=dict(value=))

def callback(attr, old, new):
    
    # Implement what you want to happen when the slider is changed here:
    print slider.value

slider = Slider(start=0.1, end=4, value=1, step=.1, title="Slider", callback_policy='mouseup')
slider.callback = CustomJS(args=dict(source=source), code='source.data = { value: [cb_obj.value] }')

source.on_change('data', callback)

layout = column(slider)
curdoc().add_root(widgetbox(slider))
curdoc().title = "Sliders"

On Wednesday, March 29, 2017 at 8:42:04 AM UTC-7, Tommy Carstensen wrote:
I've noticed that the RangeSlider range property is updated, while one drags the slider. That leads to a lot of data updates and slows down things. Is it possible to only have the RangeSlider range property be updated upon releasing the mouse button? Or is it possible to update it less frequently while dragging it? Otherwise I'll have to specify the range with two text boxes instead. Thanks!

--
You received this message because you are subscribed to a topic in the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/nwkfeLbvgUg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/80775795-a2e6-4df3-b1e9-cc902bbb0906%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CACscrJ8m1FNmtCDpfHx-xXnHv%2BnDi%2BvKVDvgY-cSuo98y%3D7Y4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.