RangeTool with Widget Update

I would like to add a DataTable to the RangeTool example:

When a user moves the plot range, the subset of data should update a datatable.

Something like:

def update_stats():

start = range_rool._property_values[‘x_range’].start

end = range_rool._property_values[‘x_range’].end

slice = pd.Series().ix[start:end] # this would reference the initial data

src.data = { ‘mean’: new.mean()}

I dont see any examples on this and trying the following has not worked:

range_rool.on_change(‘x_range’, lambda attr, old, new: update_stats)

range_rool.on_event(ButtonClick, update_stats ) ## need to add input param to update fcn.

Any help would be great.

Don’t know if you had an answer. But this helped me

···

Am Montag, 25. Juni 2018 12:24:49 UTC-5 schrieb Ben Scully:

I would like to add a DataTable to the RangeTool example:

https://bokeh.pydata.org/en/latest/docs/gallery/range_tool.html

When a user moves the plot range, the subset of data should update a datatable.

Something like:

def update_stats():

start = range_rool._property_values[‘x_range’].start

end = range_rool._property_values[‘x_range’].end

slice = pd.Series().ix[start:end] # this would reference the initial data

src.data = { ‘mean’: new.mean()}

I dont see any examples on this and trying the following has not worked:

range_rool.on_change(‘x_range’, lambda attr, old, new: update_stats)

range_rool.on_event(ButtonClick, update_stats ) ## need to add input param to update fcn.

Any help would be great.