The following chart is static, but since i'll push data every second on my Flask app, i would like to know how to make it dynamic. I tried to search for example but the only ones i found were meant for Javascript, not Python.
Would it be possible to update this chart in real time with Python? Any advice?
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)