Skip to content
Permalink
Browse files

Merge 4a2526e into 7838e66

  • Loading branch information
ajduberstein committed Sep 19, 2019
2 parents 7838e66 + 4a2526e commit 81897216917c76f13ed88b2ce521fb4595e3333c
@@ -28,7 +28,7 @@ Requires a Mapbox API token to display a basemap, see notes below.
`map_style` : `str`, default `"mapbox://styles/mapbox/dark-v9"`
URI for Mapbox basemap style

`mapbox_key` : `str`, default None
`mapbox_key` : `str`, default `None`
Read on initialization from the MAPBOX_API_KEY environment variable. Defaults to None if not set.
If not using a basemap, you can set this value to `None`.
See https://docs.mapbox.com/help/how-mapbox-works/access-tokens/#mapbox-account-dashboard
@@ -37,6 +37,12 @@ Requires a Mapbox API token to display a basemap, see notes below.
Initial camera angle relative to the map, defaults to a fully zoomed out 0, 0-centered map with 0 pitch and bearing
To compute a viewport from data, see `pydeck.data\_utils.compute\_viewport`

`height` : int, default `500`
Height of visualization, in pixels

`width` : int, default `750`
Width of visualization, in pixels

## pydeck.Deck.show

```python
@@ -88,12 +94,14 @@ not render.
`notebook_display` : `bool`, default `True`
Attempts to display the HTML output in an iframe if True. Only works in a Jupyter notebook.

`iframe_width` : `int`, default `500`
`iframe_width` : `int`, default `None`
Height of Jupyter notebook iframe in pixels, if rendered in a Jupyter notebook.

`iframe_height` : `int`, default `500`
`iframe_height` : `int`, default `None`
Width of Jupyter notebook iframe in pixels, if rendered in a Jupyter notebook.



#### Returns
`str` : A string path to the HTML file

@@ -18,7 +18,7 @@ def __init__(
map_style='mapbox://styles/mapbox/dark-v9',
mapbox_key=None,
initial_view_state=ViewState(),
width=500,
width="100%",
height=500,
):
"""Constructor for a Deck object, similar to the `Deck`_ class from deck.gl
@@ -41,7 +41,7 @@ def __init__(
See https://docs.mapbox.com/help/how-mapbox-works/access-tokens/#mapbox-account-dashboard
height : int, default 500
Height of visualization, in pixels
width : int, default 500
width : int, default "100%"
Width of visualization, in pixels
@@ -23,8 +23,8 @@ class DeckGLWidget(widgets.DOMWidget):
API key for Mapbox map tiles
height : int
Height of Jupyter notebook cell, in pixels
width : int
Width of Jupyter notebook cell, in pixels
width : int or str, default "100%"
Width of Jupyter notebook cell, in pixels, or CSS width
selected_data : :obj:`list` of :obj:`int`
Data passed from Jupyter widget frontend back to Python backend
"""
@@ -37,5 +37,5 @@ class DeckGLWidget(widgets.DOMWidget):
mapbox_key = Unicode('', allow_none=True).tag(sync=True)
json_input = Unicode('').tag(sync=True)
height = Int(500).tag(sync=True)
width = Int(500).tag(sync=True)
width = Any('100%').tag(sync=True)
selected_data = Any().tag(sync=True)
@@ -21,7 +21,7 @@ export class DeckGLModel extends DOMWidgetModel {
json_input: null,
mapbox_key: null,
selected_data: null,
width: 500,
width: '100%',
height: 500
};
}
@@ -71,7 +71,9 @@ export class DeckGLView extends DOMWidgetView {

if (!this.jsonDeck) {
containerDiv.style.height = `${this.model.get('height')}px`;
containerDiv.style.width = `${this.model.get('width')}px`;
containerDiv.style.width = Number.isFinite(this.model.get('width'))
? `${this.model.get('width')}px`
: this.model.get('width');
containerDiv.style.position = 'relative';
this.el.appendChild(containerDiv);

@@ -23,7 +23,7 @@ test('jupyter-widget should be createable', t => {
if (model) {
t.deepEquals(model.get('json_input'), null, 'json_input should be null');
t.equal(model.get('mapbox_key'), null, 'mapbox_key should be null');
t.equal(model.get('width'), 500, 'default width should be specified');
t.equal(model.get('width'), '100%', 'default width should be specified');
t.equal(model.get('height'), 500, 'default height should be specified');
} else {
t.comment('AMD module import is skipped in dist mode');
@@ -40,7 +40,7 @@ test('jupyter-widget should be creatable with a value', t => {
if (model) {
t.equal(model.get('json_input'), state.json_input, 'json_input should be pre-configured');
t.equal(model.get('mapbox_key'), state.mapbox_key, 'mapbox_key should be pre-configured');
t.equal(model.get('width'), 500, 'width should be the default');
t.equal(model.get('width'), '100%', 'width should be the default');
t.equal(model.get('height'), 500, 'height should be the default');
} else {
t.comment('AMD module import is skipped in dist mode');

0 comments on commit 8189721

Please sign in to comment.
You can’t perform that action at this time.