Auto-range y when dragging the canvas

I’ve read most topic about the question I mentioned on the title, but I still don’t know how to do it.(most case is too complicated or the version is too old)

Like this post, the above figure is what I want.

Is there any simple example about this?
Take the following code for a example,how to add this function?

from bokeh.plotting import figure, show

x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]

p = figure(title="Simple line example", x_axis_label="x", y_axis_label="y", tools=("xpan"))

p.line(x, y, legend_label="Temp.", line_width=2)

show(p)

Thanks in advance!