I am trying to render a line graph on callback where I need to have traces , update layout and xaxes as well. Its an easy win in plotly, I am facing challenges in dash. Below is the code :
dcc.Graph(
id=‘linegraph’,
figure = px.line(pmp, x=‘DATE’, y=value)
# Use date string to set xaxis range
figure.update_layout(title_text=“X axis title here”) ##### Getting error here
figure.update_xaxes(rangeslider_visible=True)
# # Add trace for washer breakdown
b1 = pd.to_datetime(‘2019-08-02 06:00:00’)
b2 = pd.to_datetime(‘2019-07-14 03:00:00’)
b3 = pd.to_datetime(‘2019-11-01 16:00:00’)
b4 = pd.to_datetime(‘2019-11-08 15:00:00’)
y_max = pmp[var].max()
figure.add_trace(go.Bar(x=[b1,b2,b3,b4],y=[y_max,y_max,y_max,y_max],width=100,name=‘Wing breakdown’,
marker_color=‘crimson’,marker_line_width=0))
)
Can anyone tell me on how to display above graph in dash ?