Skip to content

Commit bd2132b

Browse files
committed
accounted for orders with jump discontinuities
1 parent dbb386f commit bd2132b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

plotly/grid_objs/grid_objs.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,16 @@ def __init__(self, columns_or_json):
160160
"Each column name of your dictionary must have "
161161
"'data', 'order' and 'uid' as keys."
162162
)
163-
# order columns in a list before putting inside the grid
163+
# collect and sort all orders in case orders do not start
164+
# at zero or there are jump discontinuities between them
165+
all_orders = []
164166
ordered_columns = []
165-
for order in range(len(columns_or_json['cols'])):
167+
for column_name in columns_or_json['cols'].keys():
168+
all_orders.append(columns_or_json['cols'][column_name]['order'])
169+
all_orders.sort()
170+
171+
# put columns in order in a list
172+
for order in all_orders:
166173
for column_name in columns_or_json['cols'].keys():
167174
if columns_or_json['cols'][column_name]['order'] == order:
168175
break

0 commit comments

Comments
 (0)