Skip to content

Commit

Permalink
Do not make Vega width/height responsive if fixed value is set (#5940)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Nov 29, 2023
1 parent cc9400a commit 4720d6b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions panel/pane/vega.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ def _get_type(spec, version):
else:
return getattr(spec, 'type', 'interval')

def _get_dimensions(spec):
def _get_dimensions(spec, props):
dimensions = {}
responsive_height = spec.get('height') == 'container'
responsive_width = spec.get('width') == 'container'
responsive_height = spec.get('height') == 'container' and props.get('height') is None
responsive_width = spec.get('width') == 'container' and props.get('width') is None
if responsive_height and responsive_width:
dimensions['sizing_mode'] = 'stretch_both'
elif responsive_width:
Expand Down Expand Up @@ -264,7 +264,7 @@ def _get_properties(self, doc, sources={}):
data = props['data']
if data is not None:
sources = self._get_sources(data, sources)
dimensions = _get_dimensions(data) if data else {}
dimensions = _get_dimensions(data, props) if data else {}
props['data'] = data
props['data_sources'] = sources
props['events'] = list(self._selections)
Expand Down

0 comments on commit 4720d6b

Please sign in to comment.