Can't load plot widgets in web context

#1

I’ve gone ahead and written up a custom WidgetManager in order to mount and render ipywidgets directly on an empty front-end (i.e. no notebook/lab context, just a webpage). This works great using just vanilla ipywidgets. However, when I send code to the kernel that tries to render a plot (in this case, using plotly), I get a series of error messages in the console:

This is the altered widget code:

from ipywidgets import VBox
from IPython.display import display, HTML
import plotly.graph_objs as go

data = [go.Bar(
            x=['giraffes', 'orangutans', 'monkeys'],
            y=[20, 14, 23]
    )]
layout = {'yaxis': {'range': [0, 25]}}
fig = go.FigureWidget(data, layout)
display(VBox([fig]))

which I’ve confirmed works in both jupyter lab and jupyter notebook.

I’m wondering if the custom widget manager in the front-end is forgoing some setup process that the normal notebook/lab context provides. If anyone has any familiarity with this, I greatly appreciate some advice.

#2

Hi @nmearl,

plotlywidget would be an example of a custom widget as discussed in https://ipywidgets.readthedocs.io/en/stable/embedding.html#the-case-of-custom-widget-libraries. I’m not familiar enough with widget embedding to offer advice on whether you need to do anything to explicitly load custom widgets in your WidgetManager. You might have luck asking at https://gitter.im/jupyter-widgets/Lobby.

Good luck!
-Jon