Closed
Description
Thank you so much for helping improve the quality of Dash!
We do our best to catch bugs during the release process, but we rely on your help to find the ones that slip through.
Describe your context
Please provide us your environment so we can easily reproduce the issue.
- replace the result of
pip list | grep dash
below
dash 1.17.0
dash-core-components 1.13.0
dash-html-components 1.1.1
dash-renderer 1.18.3
dash-table 4.11.0
-
if frontend related, tell us your Browser, Version and OS
- OS: Ubuntu 20.04.1 LTS
- Browser Firefox
- Version 84.0.2
Describe the bug
If the first value of x is an empty string (""), the waterfall chart shrinks when refresh.
Expected behavior
Same width when refresh.
Screenshots
If applicable, add screenshots or screen recording to help explain your problem.
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.graph_objects as go
data1 = [1, 2, -2, -3, 2]
data2 = [-3, -1, 2, 3, 1]
app = dash.Dash(__name__)
app.layout = html.Div(children=[
html.Div(children=[
dcc.RadioItems(id="data_choice",
options=[{"label": "data 1", "value": 1}, {"label": "data 2", "value": 2}],
value=1
),
dcc.Graph(id="waterfall")
])
])
@app.callback(
Output("waterfall", "figure"),
Input("data_choice", "value")
)
def waterfall_graph(value):
if value == 1:
y = data1
else:
y = data2
fig_waterfall = go.Figure(data=go.Waterfall(
name=f"Essai",
orientation='v',
x=["", "Deux", "Trois", "Quatre", "Cinq"],
y=y,
measure=["relative"]*5,
))
return fig_waterfall
if __name__ == '__main__':
app.run_server(debug=True)
Metadata
Metadata
Assignees
Labels
No labels