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

Plot time series for multiple traces with differing timestamps

Hi there,

I’d like to plot multiple time series data traces on one graph. Seems work beautifully when all the X axis time stamps match. When there is a slight variance however, I get the below. Note trace 1’s time start going backwards because it’s 2nd timestamp is a few seconds out from trace 0’s 2nd timestamp…

Check out this fiddle. I am attempting to plot time data for several data points who’s timestamps will almost always not match up. I it possible to do this with Plotly?


Thanks for writing in.

In your fiddle, the timestamps are in fact plotted as categories - which are displayed on the x-axis in the order found in the data traces.

plotly.js does not automatically to convert all strings to dates. That is, only YYYY-MM-DD HH:MM:SS strings are automatically converted to dates. See example:

So to get the desired results, you’ll need to convert your timestamps to dates before sending to Plotly.plot. Forked from your fiddle, here how:

Fantastic, thanks for clearing that up and updating the fiddle!

Hi, can you please help me out here:

I have only timestamp values and I did try getTime() method, but no luck!
I just updated the fiddle according to my use case. Any help would definitely be appreciated.
Thanx and regards