Skip to content

Commit

Permalink
Changes for compatibility with Vega5 and altair 4 (#892)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Dec 19, 2019
1 parent 6c1d370 commit c1a9184
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions panel/models/vega.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ class VegaPlot(LayoutDOM):
"""

__javascript__ = ["https://cdn.jsdelivr.net/npm/vega@5",
'https://cdn.jsdelivr.net/npm/vega-lite@3',
'https://cdn.jsdelivr.net/npm/vega-lite@4',
'https://cdn.jsdelivr.net/npm/vega-embed@6']

__js_require__ = {
'baseUrl': 'https://cdn.jsdelivr.net/npm/',
'paths': {
"vega-embed": "vega-embed@6/build/vega-embed.min",
"vega-lite": "vega-lite@3/build/vega-lite.min",
"vega-lite": "vega-lite@4/build/vega-lite.min",
"vega": "vega@5/build/vega.min"
},
'exports': {'vega-embed': 'vegaEmbed', 'vega': 'vega', 'vega-lite': 'vl'}
Expand Down
18 changes: 12 additions & 6 deletions panel/pane/vega.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,19 @@ def _get_dimensions(cls, json, props):
if json is None:
return

view = {}
if 'width' in json:
view['width'] = json['width']
if 'height' in json:
view['height'] = json['height']
if 'config' in json and 'view' in json['config']:
view = json['config']['view']
size_config = json['config']['view']
else:
size_config = json

view = {}
for w in ('width', 'continuousWidth'):
if w in size_config:
view['width'] = size_config[w]
for h in ('height', 'continuousHeight'):
if h in size_config:
view['height'] = size_config[h]

for p in ('width', 'height'):
if p not in view:
continue
Expand Down

0 comments on commit c1a9184

Please sign in to comment.