I embedd a chart into my Flask webapp, i would like this chart to be dynamic but it’s static at the moment.
def index():
rng = pd.date_range('1/1/2011', periods=7500, freq='H')
ts = pd.Series(np.random.randn(len(rng)), index=rng)
graphs = [
dict(
data=[
dict(
x=[1, 2, 3],
y= arr,
type='scatter'
),
],
layout=dict(
title='first graph'
)
)
]
ids = ['graph-{}'.format(i) for i, _ in enumerate(graphs)]
graphJSON = json.dumps(graphs, cls=plotly.utils.PlotlyJSONEncoder)
return render_template('index.html',
ids=ids,
graphJSON=graphJSON)
On Y i set arr
, which is an array of numbers where a random number is being pushed every second, but the chart in not updating. How can i accomplish that?