From f6869de6ef65474a6822e76518000e70b8154f58 Mon Sep 17 00:00:00 2001 From: jonasvdd Date: Thu, 9 Nov 2023 08:08:39 +0100 Subject: [PATCH] :airplane: :belgium: fix for #259 --- .../figure_resampler/figure_resampler.py | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/plotly_resampler/figure_resampler/figure_resampler.py b/plotly_resampler/figure_resampler/figure_resampler.py index da06318e..35f84a05 100644 --- a/plotly_resampler/figure_resampler/figure_resampler.py +++ b/plotly_resampler/figure_resampler/figure_resampler.py @@ -521,6 +521,8 @@ def show_dash( ), f"mode must be one of {available_modes}" graph_properties = {} if graph_properties is None else graph_properties assert "config" not in graph_properties # There is a param for config + if self["layout"]["autosize"] == True and self["layout"]["height"] == None: + graph_properties.setdefault("style", {}).update({"height": "100%"}) # 0. Check if the traces need to be updated when there is a xrange set # This will be the case when the users has set a xrange (via the `update_layout` @@ -569,17 +571,18 @@ def show_dash( else: # jupyter dash uses a normal Dash app as figure app = dash.Dash("local_app", **app_init_kwargs) - + # fmt: off div = dash.html.Div( - [ - dash.dcc.Graph( - id="resample-figure", figure=self, config=config, **graph_properties - ), - TraceUpdater( - id="trace-updater", gdID="resample-figure", sequentialUpdate=False - ), - ] + style={ + "display": "flex", "flex-flow": "column", + "height": "95vh", "width": "100%", + }, + children=[ + dash.dcc.Graph(id="resample-figure", figure=self, config=config, **graph_properties), + TraceUpdater(id="trace-updater", gdID="resample-figure", sequentialUpdate=False), + ], ) + # # fmt: on if self._create_overview: overview_config = config.copy() if config is not None else {} overview_config["displayModeBar"] = False