I was going through the examples for panel links. I noticed that all the examples use a final pn.Row()
or pn.Column()
call. When I try to display the widgets and the graphs in different pn.Row/Column()
calls, then the linking doesn’t work.
To make it more clear:
from bokeh.plotting import figure
p = figure(width=300, height=300)
xs = np.linspace(0, 10)
r = p.line(xs, np.sin(xs))
width_slider = pn.widgets.FloatSlider(name='Line Width', start=0.1, end=10)
width_slider.jslink(r.glyph, value='line_width')
# this is the original example and linking does work
pn.Column(width_slider, p)
# linking here doesn't work
pn.Column(width_slider)
pn.Column(p)
# This does work too, because I guess that the outer pn.Row() call allows the linking to happen
pn.Row(
pn.Column(width_slider),
pn.Column(p),
)
The question is: Is it possible to get jslinks to work when the widgets are rendered independently?
To give a bit more context. I have a dashboard with some widgets. I click on a button and I create an hv.DynamicMap
. The map gets created on the fly. Is it possible to link the map to some of the existing widgets?