@@ -165,33 +165,33 @@ class Dashboard(dict):
165
165
```
166
166
import plotly.dashboard_objs as dashboard
167
167
168
- box_1 = {
168
+ box_a = {
169
169
'type': 'box',
170
170
'boxType': 'plot',
171
171
'fileId': 'username:some#',
172
- 'title': 'box 1 '
172
+ 'title': 'box a '
173
173
}
174
174
175
- box_2 = {
175
+ box_b = {
176
176
'type': 'box',
177
177
'boxType': 'plot',
178
178
'fileId': 'username:some#',
179
- 'title': 'box 2 '
179
+ 'title': 'box b '
180
180
}
181
181
182
- box_3 = {
182
+ box_c = {
183
183
'type': 'box',
184
184
'boxType': 'plot',
185
185
'fileId': 'username:some#',
186
- 'title': 'box 3 '
186
+ 'title': 'box c '
187
187
}
188
188
189
189
my_dboard = dashboard.Dashboard()
190
- my_dboard.insert(box_1 )
190
+ my_dboard.insert(box_a )
191
191
# my_dboard.get_preview()
192
- my_dboard.insert(box_2 , 'above', 1)
192
+ my_dboard.insert(box_b , 'above', 1)
193
193
# my_dboard.get_preview()
194
- my_dboard.insert(box_3 , 'left', 2)
194
+ my_dboard.insert(box_c , 'left', 2)
195
195
# my_dboard.get_preview()
196
196
my_dboard.swap(1, 2)
197
197
# my_dboard.get_preview()
@@ -203,18 +203,18 @@ class Dashboard(dict):
203
203
```
204
204
import plotly.dashboard_objs as dashboard
205
205
206
- box_1 = {
206
+ box_a = {
207
207
'type': 'box',
208
208
'boxType': 'plot',
209
209
'fileId': 'username:some#',
210
- 'title': 'box 1 '
210
+ 'title': 'box a '
211
211
}
212
212
213
213
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)
218
218
# my_dboard.get_preview()
219
219
```
220
220
"""
@@ -443,8 +443,10 @@ def insert(self, box, side='above', box_id=None, fill_percent=50):
443
443
:param (str) side: specifies where your new box is going to be placed
444
444
relative to the given 'box_id'. Valid values are 'above', 'below',
445
445
'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.
448
450
:param (float) fill_percent: specifies the percentage of the container
449
451
box from the given 'side' that the new box occupies. For example
450
452
if you apply the method\n
@@ -457,19 +459,19 @@ def insert(self, box, side='above', box_id=None, fill_percent=50):
457
459
```
458
460
import plotly.dashboard_objs as dashboard
459
461
460
- box_1 = {
462
+ box_a = {
461
463
'type': 'box',
462
464
'boxType': 'plot',
463
465
'fileId': 'username:some#',
464
- 'title': 'box 1 '
466
+ 'title': 'box a '
465
467
}
466
468
467
469
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)
473
475
474
476
my_dboard.get_preview()
475
477
```
@@ -540,17 +542,16 @@ def remove(self, box_id):
540
542
```
541
543
import plotly.dashboard_objs as dashboard
542
544
543
- box_1 = {
545
+ box_a = {
544
546
'type': 'box',
545
547
'boxType': 'plot',
546
548
'fileId': 'username:some#',
547
- 'title': 'box 1 '
549
+ 'title': 'box a '
548
550
}
549
551
550
552
my_dboard = dashboard.Dashboard()
551
- my_dboard.insert(box_1 )
553
+ my_dboard.insert(box_a )
552
554
my_dboard.remove(1)
553
-
554
555
my_dboard.get_preview()
555
556
```
556
557
"""
@@ -581,23 +582,23 @@ def swap(self, box_id_1, box_id_2):
581
582
```
582
583
import plotly.dashboard_objs as dashboard
583
584
584
- box_1 = {
585
+ box_a = {
585
586
'type': 'box',
586
587
'boxType': 'plot',
587
588
'fileId': 'username:first#',
588
- 'title': 'first box'
589
+ 'title': 'box a '
589
590
}
590
591
591
- box_2 = {
592
+ box_b = {
592
593
'type': 'box',
593
594
'boxType': 'plot',
594
595
'fileId': 'username:second#',
595
- 'title': 'second box'
596
+ 'title': 'box b '
596
597
}
597
598
598
599
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)
601
602
602
603
# check box at box id 1
603
604
box_at_1 = my_dboard.get_box(1)
@@ -610,13 +611,13 @@ def swap(self, box_id_1, box_id_2):
610
611
```
611
612
"""
612
613
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 )
615
616
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 ]
618
619
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 )]:
620
621
loc_in_dashboard = self ['layout' ]
621
622
for first_second in pairs [0 ][:- 1 ]:
622
623
loc_in_dashboard = loc_in_dashboard [first_second ]
0 commit comments