Monday, June 20, 2022

How to make a simple animated chart in plotly with Python ( and pywebio)

data = [[1, 11], [2, 12], [3, 8], [4,14],[5,15]]

print(len(data))
whole = [ ]
for t in range(1,len(data)) :
print(t, data[t])
for k in range(0,t+1):
#print( [k] + data[k] )
whole.append( [t] + data[k] )

# Create the pandas DataFrame
df = pd.DataFrame(whole, columns=['INDX', 'N', 'Intergrated'])

fig = go.Figure( px.line(df, x='N', y='Intergrated', animation_frame='INDX') )

html = fig.to_html(include_plotlyjs="require", full_html=False)
put_html(html)




So if you want to make a simple animated chart.