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

Skip to content

Commit c660506

Browse files
authored
Merge pull request plotly#705 from plotly/ver-bump
update-CHANGELOG and ver # for dashboards
2 parents 8611134 + 568700f commit c660506

File tree

4 files changed

+80
-66
lines changed

4 files changed

+80
-66
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## [Unreleased]
6+
7+
## [2.0.3] - 2017-03-06
68
## Added
7-
- dashboards can now be created using the API and uploaded to Plotly. Use `import plotly.dashboard_objs` to be create a dashboard a `Dashboard` object. You can learn more about `Dashboard` objects by running `help(plotly.dashboard_objs.Dashboard)` and `help(plotly.plotly.plotly.dashboard_ops)` for uploading and retrieving dashboards from the cloud.
9+
- Dashboards can now be created using the API and uploaded to Plotly. Use `import plotly.dashboard_objs` to create a `Dashboard` object. You can learn more about `Dashboard` objects by running `help(plotly.dashboard_objs)` and `help(plotly.plotly.plotly.dashboard_ops)` for uploading and retrieving dashboards from the cloud.
810

911

1012
## [2.0.2] - 2017-02-20

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: 5 additions & 64 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

@@ -384,6 +322,9 @@ def get_preview(self):
384322
pprint.pprint(self)
385323
return
386324

325+
elif self['layout'] is None:
326+
return IPython.display.HTML(dashboard_html)
327+
387328
x = 0
388329
y = 0
389330
box_w = MASTER_WIDTH
@@ -577,7 +518,7 @@ def remove(self, box_id):
577518
raise exceptions.PlotlyError(ID_NOT_VALID_MESSAGE)
578519

579520
path = box_ids_to_path[box_id]
580-
if path != ['first']:
521+
if path != ('first',):
581522
container_for_box_id = self._path_to_box(path[:-1])
582523
if path[-1] == 'first':
583524
adjacent_path = 'second'
@@ -587,7 +528,7 @@ def remove(self, box_id):
587528

588529
self._insert(adjacent_box, path[:-1])
589530
else:
590-
self['layout'] = _empty_box()
531+
self['layout'] = None
591532

592533
self._set_container_sizes()
593534

plotly/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.0.2'
1+
__version__ = '2.0.3'

0 commit comments

Comments
 (0)