Pyviz panel or ipywidgets javascript linking

Hi there,

I recently discovered the pyviz panel library which offers nice possibilities for dashboarding. I was just wondering what is the simplest way to link a slider value with a figure property on the javascript level? I know it is possible to invoke callbacks in python or implement a slider or buttons directly in plotly but this is not what I want to achieve.

For example, in the Panel documentation you can find the following using Bokeh (docs):

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')

pn.Column(width_slider, p)

Similarly to ipywidgets there is the possibility to link to js objects by their values or other properties. Since the plotly FigureWidget is in essense an ipywidget there should be a simple way to do it I guess, but I could’nt find any documentation on it.

Hope some people can help here.




Sorry to bother @Emmanuelle but do you have any insight on this?

Hey @Alexboiboi I’m not a panel expert sorry, I use Dash instead (which also has javascript callbacks). I would recommend to take a look at the documentation (or source code if required) of the jslink method to see to which property/event of a graph it is listening, and to see whether this property already exists in the plotly.js API. If it doesn’t exist you would need to write a wrapper library around plotly.js with exposes this event panel is listening to.

ok, thanks. I’ll check that if I find the time^^