@@ -156,13 +156,11 @@ def _get_sources_for_trace(json, data, parent_path=''):
156
156
def _update_figure (self ):
157
157
import plotly .graph_objs as go
158
158
159
- if (self .object is None or type (self .object ) is not go .Figure or
159
+ if (self .object is None or type (self .object ) not in ( go .Figure , go . FigureWidget ) or
160
160
self .object is self ._figure or not self .link_figure ):
161
161
return
162
162
163
163
# Monkey patch the message stubs used by FigureWidget.
164
- # We only patch `Figure` objects (not subclasses like FigureWidget) so
165
- # we don't interfere with subclasses that override these methods.
166
164
fig = self .object
167
165
fig ._send_addTraces_msg = lambda * _ , ** __ : self ._update_from_figure ('add' )
168
166
fig ._send_deleteTraces_msg = lambda * _ , ** __ : self ._update_from_figure ('delete' )
@@ -335,6 +333,7 @@ def _process_event(self, event):
335
333
self .param .trigger (pname )
336
334
else :
337
335
self .param .update (** {pname : data })
336
+
338
337
if data is None or not hasattr (self .object , '_handler_js2py_pointsCallback' ):
339
338
return
340
339
@@ -392,7 +391,7 @@ def _process_event(self, event):
392
391
if has_z and 'z' in point_obj :
393
392
points_object ['zs' ].append (point_obj ['z' ])
394
393
395
- self .object ._handler_js2py_pointsCallback (
394
+ self ._figure ._handler_js2py_pointsCallback (
396
395
{
397
396
"new" : dict (
398
397
event_type = f'plotly_{ etype } ' ,
0 commit comments