I’m currently developing a Bokeh application which uses a Flask server. There is a line plot which the data source is an AjaxDataSource, and I would like to recompute it depending on the figure x range extents (zoom and reset tools are enabled on the figure). I have figured out how to set up the line AjaxDataSource by reviewing an existing reference (bokeh/ajax_source.py at branch-3.0 · bokeh/bokeh · GitHub) .
By following this example (not exactly the same, as it seems to be for an IPython Notebook), I am able to at least see (print) the current x_range start and end values - JavaScript callbacks — Bokeh 2.4.2 Documentation.
jscode = """
var data = source.get('data')
var start = cb_obj.get('start');
var end = cb_obj.get('end');
data['start'] = start;
data['end'] = end;
source.trigger('change');
"""
curr_fig.x_range.callback = CustomJS(
args=dict(source=current_x_limits), code=jscode)
is there any way to connect the dots here - can I somehow use an Ajax post call in the CustomJS? How would one go about doing this?
Is there a different way to tackle this problem?
I would like to be able to reference the possibly changed current_x_limits and do something to the main AjaxDataSource - recompute it depending on those limits.
On Wednesday, August 31, 2016 at 8:27:38 AM UTC-4, [email protected] wrote:
I’m currently developing a Bokeh application which uses a Flask server. There is a line plot which the data source is an AjaxDataSource, and I would like to recompute it depending on the figure x range extents (zoom and reset tools are enabled on the figure). I have figured out how to set up the line AjaxDataSource by reviewing an existing reference (https://github.com/bokeh/bokeh/blob/master/examples/howto/ajax_source.py) .
jscode = """
var data = source.get('data')
var start = cb_obj.get('start');
var end = cb_obj.get('end');
data['start'] = start;
data['end'] = end;
source.trigger('change');
is there any way to connect the dots here - can I somehow use an Ajax post call in the CustomJS? How would one go about doing this?
Is there a different way to tackle this problem?
I would like to be able to reference the possibly changed current_x_limits and do something to the main AjaxDataSource - recompute it depending on those limits.