No hover for dynamically added plots

I have a hover hover = HoverTool(tooltips=[('', "$name"), ('', "($x, $y)")])
but he don’t show plot name and hir coordinates, when i add plots this way.

import random
import numpy as np

from bokeh.layouts import column, row
from bokeh.plotting import curdoc, figure
from bokeh.models import  ColumnDataSource, Button, HoverTool

POINTS = 100
PLOT_WIDTH = 1000
PLOT_HEIGHT = 570

signal_src = {}
hover = HoverTool(tooltips=[('', "$name"), ('', "($x, $y)")])
signal_figure = figure(plot_height=PLOT_HEIGHT, plot_width=PLOT_WIDTH,
                       tools=[hover, "pan,box_zoom,wheel_zoom,save,reset"],
                       x_axis_label='Time', y_axis_label='Amp')

def add_callback():
    some_digit = random.randrange(10, 300, step=1)
    name = f'signal{some_digit}'
    signal_src[name] = ColumnDataSource({'x': np.arange(POINTS),
                                         'y': some_digit * np.arange(POINTS)})
    color = random.choice(('blue', 'red', 'black',
                           'green', 'yellow', 'orange',
                           'pink', 'navy'))
    signal_figure.line(x='x', y='y', source=signal_src[name],
                       color=color, name=name)

add_btn = Button(label="Add", button_type="default")
add_btn.on_click(add_callback)

curdoc().add_root(row(signal_figure, add_btn))

Hover tools default to displaying for all renderers present at the time the plot is first displayed. It looks like the tool is not currently responsive to later updates to its renderers property, either (the renderers list is cached, evidently). You will have to open an issue on GitHub to discuss how this use case might be supported.

In the mean time the only workaround I can think to suggest offhand is to add all the lines up front, an instead use the button to toggle their visibilty.

Ok, i made a pool for a signals.

signal_figure.line(x='x', y='y', source=ColumnDataSource({'x':[], 'y':[]}),
                              legend_label=name_, name=name_, color=color_)

But how i can change the data of figure ? It doesn’t work.

signal_figure.renderers[pool_count].data_source = signal_src[name].data

Test code.

from bokeh.layouts import column, row
from bokeh.plotting import curdoc, figure
from bokeh.models import  ColumnDataSource, Button, HoverTool

POINTS = 100
PLOT_WIDTH = 1000
PLOT_HEIGHT = 570
POOL_LEN = 6
pool_count = 0

signal_src = {}
hover = HoverTool(tooltips=[('', "$name"), ('', "($x, $y)")])
signal_figure = figure(plot_height=PLOT_HEIGHT, plot_width=PLOT_WIDTH,
                       tools=[hover, "pan,box_zoom,wheel_zoom,save,reset"],
                       x_axis_label='Time', y_axis_label='Amp')
for i in range(POOL_LEN):
    color_ = ('blue', 'red', 'brown', 'green', 'yellow', 'orange')[i]
    name_ = f'stage_{i}'
    signal_figure.line(x='x', y='y', source=ColumnDataSource({'x':[], 'y':[]}),
                              legend_label=name_, name=name_, color=color_)
    signal_figure.legend.location = "top_left"
    signal_figure.legend.click_policy="hide"

def add_callback():
    some_digit = random.randrange(10, 300, step=1)
    name = f'signal{some_digit}'
    signal_src[name] = ColumnDataSource({'x': np.arange(POINTS),
                                         'y': some_digit * np.arange(POINTS)})
    # It doesn't work.
    global pool_count
    signal_figure.renderers[pool_count].data_source = signal_src[name].data
    pool_count += 1

add_btn = Button(label="Add", button_type="default")
add_btn.on_click(add_callback)

curdoc().add_root(row(signal_figure, add_btn))