I’m working on the wind-streaming example, i edited so that data is fetched from a MongoDB database instead of SQLite. Now i would like to have time on my X axis instead of a range, so that as soon as it updates, i can see what was the value at X time. Is there a way to accomplish that? I’m assuming i need to use the datetime module but i don’t know how to go forward from here
def gen_wind_speed(interval):
client = MongoClient(port=27017)
db = client.one
mycol = client['tst']
df = pd.DataFrame(list(db.tst.find({})))
trace = Scatter(
y=df['num'],
line=Line(
color='#42C4F7'
),
)
layout = Layout(
height=450,
xaxis=dict(
range=[0, 90],
showgrid=False,
showline=False,
zeroline=False,
fixedrange=True,
title='Time Elapsed (sec)'
),
margin=Margin(
t=45,
l=50,
r=50
)
)
return Figure(data=[trace], layout=layout)