-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Animations/Frames in Python API #584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
cb4552c
b4c3953
54c1386
d19c6ca
efa390e
eb57218
5482b53
b2b8451
a156503
d173cbb
d17a222
49bdc97
4fbdc99
dbb386f
bd2132b
26c3714
0c7bb1c
4acc146
c195e78
6f12ba8
253228f
405e71d
c1727d8
fca8fed
587dfa5
495b015
dd20177
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,12 +118,17 @@ class Grid(MutableSequence): | |
py.plot([trace], filename='graph from grid') | ||
``` | ||
""" | ||
def __init__(self, columns_or_json): | ||
def __init__(self, columns_or_json, grid_id=None): | ||
""" | ||
Initialize a grid with an iterable of `plotly.grid_objs.Column` | ||
objects or a json/dict describing a grid. See second usage example | ||
below for the necessary structure of the dict. | ||
|
||
:param (str|bool) grid_id: should not be accessible to users. Default | ||
is 'None' but if a grid is retrieved via `py.get_grid()` then the | ||
retrieved grid response will contain the grid_id which will be | ||
necessary to set `self.id` and `self._columns.id` below. | ||
|
||
Example from iterable of columns: | ||
``` | ||
column_1 = Column([1, 2, 3], 'time') | ||
|
@@ -141,9 +146,19 @@ def __init__(self, columns_or_json): | |
grid = Grid(grid_json) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💥 🎎 :) |
||
``` | ||
""" | ||
|
||
# TODO: verify that columns are actually columns | ||
if isinstance(columns_or_json, dict): | ||
# check that grid_id is entered | ||
if grid_id is None: | ||
raise exceptions.PlotlyError( | ||
"If you are manually converting a raw json/dict grid " | ||
"into a Grid instance, you must ensure that make " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🐐 |
||
"'grid_id' is set to your file ID. This looks like " | ||
"'username:187'." | ||
) | ||
# TODO: verify that grid_id is a correct fid if a string | ||
self.id = grid_id | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency, can we call this |
||
|
||
# check if 'cols' is a root key | ||
if 'cols' not in columns_or_json: | ||
raise exceptions.PlotlyError( | ||
|
@@ -182,7 +197,8 @@ def __init__(self, columns_or_json): | |
|
||
# fill in uids | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎎 |
||
for column in self: | ||
column.id = columns_or_json['cols'][column.name]['uid'] | ||
column.id = self.id + ':' + columns_or_json['cols'][column.name]['uid'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🐄 we typically use |
||
|
||
else: | ||
column_names = [column.name for column in columns_or_json] | ||
duplicate_name = utils.get_first_duplicate(column_names) | ||
|
@@ -193,8 +209,6 @@ def __init__(self, columns_or_json): | |
self._columns = list(columns_or_json) | ||
self.id = '' | ||
|
||
#self._fid = '' | ||
|
||
def __repr__(self): | ||
return self._columns.__repr__() | ||
|
||
|
@@ -241,7 +255,7 @@ def get_column(self, column_name): | |
if column.name == column_name: | ||
return column | ||
|
||
def get_uid(self, column_name): | ||
def get_fid_uid(self, column_name): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is it called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, users are supposed to use this. And it does return the |
||
""" | ||
Return uid of given column name in the grid by column name. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency, can we call this
fid
?