Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Time-series scatter plotting help

Hi!

I’m following the dash wind streaming example to stream data from a MySQL database.
Data is added to the database every 5 seconds and queried respectively.
I used the Interval component to query and a hidden div to store.
I read the jsonified data in a callback function into a dataframe called df.

I generate a trace using the following:

trace_sensor_1 = Scatter(
    x=df.loc[df['sensor_id'] == 1]['timestamp'],
    y=df.loc[df['sensor_id'] == 1]['sensor_reading'],
    mode='markers+lines',
    name='Sensor 1',

However, the scatter plot that this generates (attached) jumps all over the place. Is this due to the mode I’m using?

How do I make this a proper time series scatter plot?

My guess is that you need to sort the data / dataframe before plotting it.

Yes that was it! Thank you for the help. Really loving this framework!

1 Like

I have almost similar problem. My question is: how to include sort the data within DASH code??
Thanks