
I am running a bokeh server app which uses a streaming dataset. Lets use a simple example
from bokeh.plotting import figure, curdoc
from bokeh.driving import linear
import random
p = figure(plot_width=400, plot_height=400)
r = p.line(, , color=“firebrick”, line_width=2)
ds = r.data_source
@linear()
def update(step):
ds.data[‘x’].append(step)
ds.data[‘y’].append(random.randint(0,100))
ds.trigger(‘data’, ds.data, ds.data)
curdoc().add_root(p)
Add a periodic callback to be run every 500 milliseconds
curdoc().add_periodic_callback(update, 500)
``
I would like to stop the streaming and plotting after a certain point (when x =10). How do I do that? I tried using remove_periodic_callback(update) but it does not work from within the callback function.
