Black Lives Matter. Please consider donating to Black Girls Code today.

How to Live update a graph in dash only using Input and Output

can any one help me with live updating of a graph. I have tried it with events it works but Events is not working in the latest dash version which i am supposed to work with

my data :

Items Sold
25
69
78
23
28
25
25
85
36
25
23
56
25
56
65
64
90
89
85
77
10
13
14
15
16
17
18
19
20
21
22
23
24

My code:
plt1 = df[‘Items Sold’]
page_layout = html.Div([
html.Div(
[
html.H4(“Items Sold”),
dcc.Graph(id=‘Items Sold’, animate=True),
dcc.Interval(
id=‘Items Sold_interval’,
interval=1 * 1000
),
],
style={‘height’: ‘48vh’, “width”: “50%”, ‘backgroundColor’: ‘#3aaab2’, ‘display’: ‘inline-block’}
)

])
@app.callback(Output(‘Items Sold_id’, ‘figure’),
events=[event(‘Items Sold_interval’, ‘interval’)])
def update_graph_scatter():
X.append(X[-1] + X[0])
data = plotly.graph_objs.Scatter(
x=list(X),
y=list(plt1),
name=‘Scatter’,
mode=‘lines+markers’
)

return dict(data=[data], layout=go.Layout(xaxis=dict(range=[min(X), max(X)]),
                                          yaxis=dict(range=[min(plt1), max(plt1)]), ))

if name == ‘main’:
app.run_server(host=‘127.0.0.1’, port=8888, debug=True)