Skip to content

Commit 2c07b12

Browse files
committed
rename box_1 to box_a, etc
1 parent f898892 commit 2c07b12

File tree

1 file changed

+40
-39
lines changed

1 file changed

+40
-39
lines changed

plotly/dashboard_objs/dashboard_objs.py

+40-39
Original file line numberDiff line numberDiff line change
@@ -165,33 +165,33 @@ class Dashboard(dict):
165165
```
166166
import plotly.dashboard_objs as dashboard
167167
168-
box_1 = {
168+
box_a = {
169169
'type': 'box',
170170
'boxType': 'plot',
171171
'fileId': 'username:some#',
172-
'title': 'box 1'
172+
'title': 'box a'
173173
}
174174
175-
box_2 = {
175+
box_b = {
176176
'type': 'box',
177177
'boxType': 'plot',
178178
'fileId': 'username:some#',
179-
'title': 'box 2'
179+
'title': 'box b'
180180
}
181181
182-
box_3 = {
182+
box_c = {
183183
'type': 'box',
184184
'boxType': 'plot',
185185
'fileId': 'username:some#',
186-
'title': 'box 3'
186+
'title': 'box c'
187187
}
188188
189189
my_dboard = dashboard.Dashboard()
190-
my_dboard.insert(box_1)
190+
my_dboard.insert(box_a)
191191
# my_dboard.get_preview()
192-
my_dboard.insert(box_2, 'above', 1)
192+
my_dboard.insert(box_b, 'above', 1)
193193
# my_dboard.get_preview()
194-
my_dboard.insert(box_3, 'left', 2)
194+
my_dboard.insert(box_c, 'left', 2)
195195
# my_dboard.get_preview()
196196
my_dboard.swap(1, 2)
197197
# my_dboard.get_preview()
@@ -203,18 +203,18 @@ class Dashboard(dict):
203203
```
204204
import plotly.dashboard_objs as dashboard
205205
206-
box_1 = {
206+
box_a = {
207207
'type': 'box',
208208
'boxType': 'plot',
209209
'fileId': 'username:some#',
210-
'title': 'box 1'
210+
'title': 'box a'
211211
}
212212
213213
my_dboard = dashboard.Dashboard()
214-
my_dboard.insert(box_1)
215-
my_dboard.insert(box_1, 'below', 1)
216-
my_dboard.insert(box_1, 'below', 1)
217-
my_dboard.insert(box_1, 'below', 3)
214+
my_dboard.insert(box_a)
215+
my_dboard.insert(box_a, 'below', 1)
216+
my_dboard.insert(box_a, 'below', 1)
217+
my_dboard.insert(box_a, 'below', 3)
218218
# my_dboard.get_preview()
219219
```
220220
"""
@@ -443,8 +443,10 @@ def insert(self, box, side='above', box_id=None, fill_percent=50):
443443
:param (str) side: specifies where your new box is going to be placed
444444
relative to the given 'box_id'. Valid values are 'above', 'below',
445445
'left', and 'right'.
446-
:param (int) box_id: the box id which is used as the reference box for
447-
the insertion of the box.
446+
:param (int) box_id: the box id which is used as a reference for the
447+
insertion of the new box. Box ids are memoryless numbers that are
448+
generated on-the-fly and assigned to boxes in the layout each time
449+
.get_preview() is run.
448450
:param (float) fill_percent: specifies the percentage of the container
449451
box from the given 'side' that the new box occupies. For example
450452
if you apply the method\n
@@ -457,19 +459,19 @@ def insert(self, box, side='above', box_id=None, fill_percent=50):
457459
```
458460
import plotly.dashboard_objs as dashboard
459461
460-
box_1 = {
462+
box_a = {
461463
'type': 'box',
462464
'boxType': 'plot',
463465
'fileId': 'username:some#',
464-
'title': 'box 1'
466+
'title': 'box a'
465467
}
466468
467469
my_dboard = dashboard.Dashboard()
468-
my_dboard.insert(box_1)
469-
my_dboard.insert(box_1, 'left', 1)
470-
my_dboard.insert(box_1, 'below', 2)
471-
my_dboard.insert(box_1, 'right', 3)
472-
my_dboard.insert(box_1, 'above', 4, fill_percent=20)
470+
my_dboard.insert(box_a)
471+
my_dboard.insert(box_a, 'left', 1)
472+
my_dboard.insert(box_a, 'below', 2)
473+
my_dboard.insert(box_a, 'right', 3)
474+
my_dboard.insert(box_a, 'above', 4, fill_percent=20)
473475
474476
my_dboard.get_preview()
475477
```
@@ -540,17 +542,16 @@ def remove(self, box_id):
540542
```
541543
import plotly.dashboard_objs as dashboard
542544
543-
box_1 = {
545+
box_a = {
544546
'type': 'box',
545547
'boxType': 'plot',
546548
'fileId': 'username:some#',
547-
'title': 'box 1'
549+
'title': 'box a'
548550
}
549551
550552
my_dboard = dashboard.Dashboard()
551-
my_dboard.insert(box_1)
553+
my_dboard.insert(box_a)
552554
my_dboard.remove(1)
553-
554555
my_dboard.get_preview()
555556
```
556557
"""
@@ -581,23 +582,23 @@ def swap(self, box_id_1, box_id_2):
581582
```
582583
import plotly.dashboard_objs as dashboard
583584
584-
box_1 = {
585+
box_a = {
585586
'type': 'box',
586587
'boxType': 'plot',
587588
'fileId': 'username:first#',
588-
'title': 'first box'
589+
'title': 'box a'
589590
}
590591
591-
box_2 = {
592+
box_b = {
592593
'type': 'box',
593594
'boxType': 'plot',
594595
'fileId': 'username:second#',
595-
'title': 'second box'
596+
'title': 'box b'
596597
}
597598
598599
my_dboard = dashboard.Dashboard()
599-
my_dboard.insert(box_1)
600-
my_dboard.insert(box_2, 'above', 1)
600+
my_dboard.insert(box_a)
601+
my_dboard.insert(box_b, 'above', 1)
601602
602603
# check box at box id 1
603604
box_at_1 = my_dboard.get_box(1)
@@ -610,13 +611,13 @@ def swap(self, box_id_1, box_id_2):
610611
```
611612
"""
612613
box_ids_to_path = self._compute_box_ids()
613-
box_1 = self.get_box(box_id_1)
614-
box_2 = self.get_box(box_id_2)
614+
box_a = self.get_box(box_id_1)
615+
box_b = self.get_box(box_id_2)
615616

616-
box_1_path = box_ids_to_path[box_id_1]
617-
box_2_path = box_ids_to_path[box_id_2]
617+
box_a_path = box_ids_to_path[box_id_1]
618+
box_b_path = box_ids_to_path[box_id_2]
618619

619-
for pairs in [(box_1_path, box_2), (box_2_path, box_1)]:
620+
for pairs in [(box_a_path, box_b), (box_b_path, box_a)]:
620621
loc_in_dashboard = self['layout']
621622
for first_second in pairs[0][:-1]:
622623
loc_in_dashboard = loc_in_dashboard[first_second]

0 commit comments

Comments
 (0)