@@ -128,3 +128,49 @@ def relayout(self, layout):
128128 def hover (self , hover_obj ):
129129 message = {'hover' : hover_obj , 'graphId' : self ._graphId }
130130 self ._handle_outgoing_message (message )
131+
132+ def add_traces (self , traces , new_indices = None ):
133+ """
134+ Add new data traces to a graph.
135+
136+ If `new_indices` isn't specified, they are simply appended.
137+
138+ :param (list[dict]) traces: The list of trace dicts
139+ :param (list[int]|None|optional) new_indices: The final indices the
140+ added traces should occupy.
141+
142+ """
143+ body = {'traces' : traces }
144+ if new_indices is not None :
145+ body ['newIndices' ] = new_indices
146+ message = {'addTraces' : body }
147+ self ._handle_outgoing_message (message )
148+
149+ def delete_traces (self , indices ):
150+ """
151+ Delete data traces from a graph.
152+
153+ :param (list[int]) indices: The indices of the traces to be removed
154+
155+ """
156+ message = {'deleteTraces' : {'indices' : indices }}
157+ self ._handle_outgoing_message (message )
158+
159+ def move_traces (self , current_indices , new_indices = None ):
160+ """
161+ Move data traces around in a graph.
162+
163+ If new_indices isn't specified, the traces at the locations specified
164+ in current_indices are moved to the end of the data array.
165+
166+ :param (list[int]) current_indices: The initial indices the traces to
167+ be moved occupy.
168+ :param (list[int]|None|optional) new_indices: The final indices the
169+ traces to be moved will occupy.
170+
171+ """
172+ body = {'currentIndices' : current_indices }
173+ if new_indices is not None :
174+ body ['newIndices' ] = new_indices
175+ message = {'moveTraces' : body }
176+ self ._handle_outgoing_message (message )
0 commit comments