Skip to content

Commit d97c0de

Browse files
committed
add get_attributes method to Graph.
1 parent d6a00d7 commit d97c0de

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

plotly/widgets/graph_widget.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,3 +605,27 @@ def reorder_traces(self, current_indices, new_indices=None):
605605
if new_indices is not None:
606606
message['newIndices'] = new_indices
607607
self._handle_outgoing_message(message)
608+
609+
def get_attributes(self, attributes=None, ignore_defaults=False):
610+
"""
611+
Get attributes of the Graph.
612+
613+
When `attributes` is specified, a dictionary of values is returned with
614+
the requested attributes as keys.
615+
616+
When `attributes` is None, the entire graph object is returned.
617+
618+
:param (str|str[]|None) attributes: Return listed attributes or entire
619+
graph.
620+
:param (bool) ignore_defaults: If False, find default arguments if user
621+
didn't define the values. If True,
622+
return undefined if user didn't define
623+
the values.
624+
"""
625+
message = {
626+
'task': 'getAttributes',
627+
'ignoreDefaults': ignore_defaults
628+
}
629+
if attributes is not None:
630+
message['attributes'] = attributes
631+
self._handle_outgoing_message(message)

0 commit comments

Comments
 (0)