Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 87cf398

Browse files
committed
move docstring to __init__ for help(plotly.dashboard_objs)
1 parent a3aefb2 commit 87cf398

File tree

2 files changed

+71
-62
lines changed

2 files changed

+71
-62
lines changed

plotly/dashboard_objs/__init__.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,72 @@
1+
"""
2+
dashboard_objs
3+
==========
4+
5+
A module for creating and manipulating dashboard content. You can create
6+
a Dashboard object, insert boxes, swap boxes, remove a box and get an HTML
7+
preview of the Dashboard.
8+
9+
The current workflow for making and manipulating dashboard follows:
10+
1) Create a Dashboard
11+
2) Modify the Dashboard (insert, swap, remove, etc)
12+
3) Preview the Dashboard (run `.get_preview()`)
13+
4) Repeat steps 2) and 3) as long as desired
14+
15+
The basic box object that your insert into a dashboard is just a `dict`.
16+
The minimal dict for a box is:
17+
18+
```
19+
{
20+
'type': 'box',
21+
'boxType': 'plot'
22+
}
23+
```
24+
25+
where 'fileId' can be set to the 'username:#' of your plot. The other
26+
parameters
27+
a box takes are `shareKey` (default is None) and `title` (default is '').
28+
29+
You will need to use the `.get_preview()` method quite regularly as this will
30+
return an HTML representation of the dashboard in which the boxes in the HTML
31+
are labelled with on-the-fly-generated numbers which change after each
32+
modification to the dashboard.
33+
34+
Example: Create a simple Dashboard object
35+
```
36+
import plotly.dashboard_objs as dashboard
37+
38+
box_1 = {
39+
'type': 'box',
40+
'boxType': 'plot',
41+
'fileId': 'username:some#',
42+
'title': 'box 1'
43+
}
44+
45+
box_2 = {
46+
'type': 'box',
47+
'boxType': 'plot',
48+
'fileId': 'username:some#',
49+
'title': 'box 2'
50+
}
51+
52+
box_3 = {
53+
'type': 'box',
54+
'boxType': 'plot',
55+
'fileId': 'username:some#',
56+
'title': 'box 3'
57+
}
58+
59+
my_dboard = dashboard.Dashboard()
60+
my_dboard.insert(box_1)
61+
# my_dboard.get_preview()
62+
my_dboard.insert(box_2, 'above', 1)
63+
# my_dboard.get_preview()
64+
my_dboard.insert(box_3, 'left', 2)
65+
# my_dboard.get_preview()
66+
my_dboard.swap(1, 2)
67+
# my_dboard.get_preview()
68+
my_dboard.remove(1)
69+
# my_dboard.get_preview()
70+
```
71+
"""
172
from . dashboard_objs import Dashboard

plotly/dashboard_objs/dashboard_objs.py

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,68 +5,6 @@
55
A module for creating and manipulating dashboard content. You can create
66
a Dashboard object, insert boxes, swap boxes, remove a box and get an HTML
77
preview of the Dashboard.
8-
9-
The current workflow for making and manipulating dashboard follows:
10-
1) Create a Dashboard
11-
2) Modify the Dashboard (insert, swap, remove, etc)
12-
3) Preview the Dashboard (run `.get_preview()`)
13-
4) Repeat steps 2) and 3) as long as desired
14-
15-
The basic box object that your insert into a dashboard is just a `dict`.
16-
The minimal dict for a box is:
17-
18-
```
19-
{
20-
'type': 'box',
21-
'boxType': 'plot'
22-
}
23-
```
24-
25-
where 'fileId' can be set to the 'username:#' of your plot. The other
26-
parameters
27-
a box takes are `shareKey` (default is None) and `title` (default is '').
28-
29-
You will need to use the `.get_preview()` method quite regularly as this will
30-
return an HTML representation of the dashboard in which the boxes in the HTML
31-
are labelled with on-the-fly-generated numbers which change after each
32-
modification to the dashboard.
33-
34-
Example: Create a simple Dashboard object
35-
```
36-
import plotly.dashboard_objs as dashboard
37-
38-
box_1 = {
39-
'type': 'box',
40-
'boxType': 'plot',
41-
'fileId': 'username:some#',
42-
'title': 'box 1'
43-
}
44-
45-
box_2 = {
46-
'type': 'box',
47-
'boxType': 'plot',
48-
'fileId': 'username:some#',
49-
'title': 'box 2'
50-
}
51-
52-
box_3 = {
53-
'type': 'box',
54-
'boxType': 'plot',
55-
'fileId': 'username:some#',
56-
'title': 'box 3'
57-
}
58-
59-
my_dboard = dashboard.Dashboard()
60-
my_dboard.insert(box_1)
61-
# my_dboard.get_preview()
62-
my_dboard.insert(box_2, 'above', 1)
63-
# my_dboard.get_preview()
64-
my_dboard.insert(box_3, 'left', 2)
65-
# my_dboard.get_preview()
66-
my_dboard.swap(1, 2)
67-
# my_dboard.get_preview()
68-
my_dboard.remove(1)
69-
# my_dboard.get_preview()
708
```
719
"""
7210

0 commit comments

Comments
 (0)