How to make plot tools work for plots displaying streamed data?

I’m experimenting with streaming plots and find the plot tools (resize, reset, etc.) to be mostly not doing what you’d expect, no matter which one. In general it seems as if the plot area would need to be told that the plot range changed, either when updating the displayed data and/or when the plot tools are clicked/used. Does anybody have hints on how to do that or where to find this information? Below I’ve put some very simple example I’ve found on Stackoverflow or somewhere.

Thanks!

import random
import time

from bokeh.plotting import *
from bokeh.models.renderers import GlyphRenderer

MAX_DATA = 20

x_data =
y_data =

output_server(“updateable_plot”)

p = figure(title=“Some plot”,
width=600, height=600,
tools=“pan,resize,reset,wheel_zoom,box_zoom,box_select,crosshair,hover”)

p.line(x_data, y_data,
color="#0000FF", line_width=3,
legend=‘value’)

show(p)

Set up the dynamic plotting

renderer1 = p.select(dict(type=GlyphRenderer))
ds1 = renderer1[0].data_source
while True:
time_ref = time.time() % 60
ds1.data[“x”] = x_data
ds1.data[“y”] = y_data
ds1._dirty = True
cursession().store_objects(ds1)

# Plotting only the last MAX_DATA samples
if len(x_data) > MAX_DATA:
    x_data.pop(0)
    y_data.pop(0)
x_data.append(time_ref)

y_data.append(random.random())
time.sleep(0.25)