This repository was archived by the owner on Jun 3, 2024. It is now read-only.
This repository was archived by the owner on Jun 3, 2024. It is now read-only.
Graph dimension problem with dcc.Loading — regression (?) in DCC 1.9.1 #831
Closed
Description
Given a certain layout (I've tried to trim down to a minimal example as best I can), dcc.Loading
causes its dcc.Graph
children to not obey their set heights in CSS.
In the below examples, I expect the Graph to be constrained within the purple boundary.
With the code below, with Dash 1.11.0 and Dash Core Components 1.9.1:
With Dash 1.11.0 and Dash Core Components 1.9.0 (or simply Dash <= 1.10.0):
Unfortunately, there was one rule I had to put in an /assets/style.css
, I left a comment in the app.
app.py
import dash
import dash_html_components as html
import dash_core_components as dcc
app = dash.Dash(__name__)
app.layout = html.Div(
children=[
# this outer div is necessary to reproduce
html.Div(
dcc.Loading(
# This must load CSS from an external file
# in /assets via the className
# style={"height": "100%"} won't have the same effect
className="loading-container",
children=dcc.Graph(
style={"height": "100%"},
figure={
'data': [{
'x': [1, 2, 3, 4],
'y': [4, 1, 6, 9],
'line': {'shape': 'spline'}
}]
}
),
),
)
],
style={
# these rules are necessary to reproduce
"display": "flex",
"maxHeight": "30vh",
# the below two rules are for visual demo purposes
"padding": "15px",
"background": "purple"
},
)
if __name__ == "__main__":
app.run_server(debug=True)
style.css
.loading-container {
height: 100%;
}