Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion graphistry/layout/ring/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,23 @@ def unique() -> List[Any]:

#print('axis', axis)

if play_ms != 0:
play_value = play_ms
elif 'play' in g._url_params:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong - if 0 is set, we should respect it

I can imagine changing the type signature to : Optional[int] = 0, and having None mean "honor url param if already set, otherwise default to 0", but that feels unnecessarily complicated

try:
play_value = int(g._url_params['play'])
except (ValueError, TypeError):
play_value = 0
else:
play_value = 0

g2 = (
g
.nodes(lambda g: g._nodes.assign(x=x, y=y, r=r))
.encode_axis(axis_out)
.bind(point_x='x', point_y='y')
.settings(url_params={
'play': play_ms,
'play': play_value,
'lockedR': True,
'bg': '%23E2E2E2' # Light grey due to labels being fixed to dark
})
Expand Down
12 changes: 11 additions & 1 deletion graphistry/layout/ring/continuous.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,23 @@ def ring_continuous(

#print('axis', axis)

if play_ms != 0:
play_value = play_ms
elif 'play' in g._url_params:
try:
play_value = int(g._url_params['play'])
except (ValueError, TypeError):
play_value = 0
else:
play_value = 0

g2 = (
g
.nodes(lambda g: g._nodes.assign(x=x, y=y, r=r))
.encode_axis(axis_out)
.bind(point_x='x', point_y='y')
.settings(url_params={
'play': play_ms,
'play': play_value,
'lockedR': True,
'bg': '%23E2E2E2' # Light grey due to labels being fixed to dark
})
Expand Down
Loading