@@ -119,17 +119,21 @@ def on_zoom(self, callback, remove=False):
119119 self ._handle_registration ('zoom' , callback , remove )
120120
121121 def restyle (self , data , traces = None ):
122- message = {'restyle' : data , 'graphId' : self ._graphId }
122+ message = {'task' : ' restyle' , 'update ' : data , 'graphId' : self ._graphId }
123123 if traces :
124124 message ['traces' ] = traces
125125 self ._handle_outgoing_message (message )
126126
127127 def relayout (self , layout ):
128- message = {'relayout' : layout , 'graphId' : self ._graphId }
128+ message = {
129+ 'task' : 'relayout' , 'update' : layout , 'graphId' : self ._graphId
130+ }
129131 self ._handle_outgoing_message (message )
130132
131133 def hover (self , hover_obj ):
132- message = {'hover' : hover_obj , 'graphId' : self ._graphId }
134+ message = {
135+ 'task' : 'hover' , 'event' : hover_obj , 'graphId' : self ._graphId
136+ }
133137 self ._handle_outgoing_message (message )
134138
135139 def add_traces (self , traces , new_indices = None ):
@@ -143,10 +147,11 @@ def add_traces(self, traces, new_indices=None):
143147 added traces should occupy.
144148
145149 """
146- body = {'traces' : traces }
150+ message = {
151+ 'task' : 'addTraces' , 'traces' : traces , 'graphId' : self ._graphId
152+ }
147153 if new_indices is not None :
148- body ['newIndices' ] = new_indices
149- message = {'addTraces' : body }
154+ message ['newIndices' ] = new_indices
150155 self ._handle_outgoing_message (message )
151156
152157 def delete_traces (self , indices ):
@@ -156,7 +161,11 @@ def delete_traces(self, indices):
156161 :param (list[int]) indices: The indices of the traces to be removed
157162
158163 """
159- message = {'deleteTraces' : {'indices' : indices }}
164+ message = {
165+ 'task' : 'deleteTraces' ,
166+ 'indices' : indices ,
167+ 'graphId' : self ._graphId
168+ }
160169 self ._handle_outgoing_message (message )
161170
162171 def move_traces (self , current_indices , new_indices = None ):
@@ -172,8 +181,11 @@ def move_traces(self, current_indices, new_indices=None):
172181 traces to be moved will occupy.
173182
174183 """
175- body = {'currentIndices' : current_indices }
184+ message = {
185+ 'task' : 'moveTraces' ,
186+ 'currentIndices' : current_indices ,
187+ 'graphId' : self ._graphId
188+ }
176189 if new_indices is not None :
177- body ['newIndices' ] = new_indices
178- message = {'moveTraces' : body }
190+ message ['newIndices' ] = new_indices
179191 self ._handle_outgoing_message (message )
0 commit comments