iRusher28
Posts: 3
Joined: Thu Nov 11, 2021 1:30 pm

Multiple series with timestamps not lined up

Hello,

I am not a pro using Highcharts but I have already been using it to display personnal sensors data and always ended up finding the solutions I was looking for.

I am currently creating a Web App gathering some of my thermometers data, and am trying to graph them on an unique yAxis like following :

Image

You can see that all of the series don't line up to the end. Yet, if you look at the database where I get these datas, all the last timestamps are not distant from more than 60 seconds each :

Image

Also, you can see on the first image's tooltip that the last point at 15.5 degrees doest not have the same timestamp as it is in the database (It is the MAC address ending with 6D).

The series are built like arrays of arrays : [[timestamp1, temperature1], [timestamp2, temperature2], ... , [timestampN, temperatureN]] and the xAxis is setted up to type : 'datetime'.

Also, as the publish rate of my sensors may not be exactly always the same, some series have more data points than others :

https://i.ibb.co/QvQMmGC/COUNTS.png

But anyway, I just would them all to sync on the xAxis instead of be placed by number of points on what seems to be the "xAxis of the longest serie".

Thanks a lot for reading, and by advance, thanks for the help !
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Multiple series with timestamps not lined up

Hello iRusher28,

Welcome to our forum and thanks for contacting us with your question!

In our API docs you can read that Highcharts expect data in timestamp format expressed in milliseconds since Jan 1st 1970:
https://api.highcharts.com/class-refere ... dateFormat
It looks like you pass timestamp in seconds instead of milliseconds . Could you try to adjust your data for example by multiplying it by 1000 so that you have milliseconds? I think it could potentially solve your problem.

Let me know if that helped.
Regards!
Mateusz Bernacik
Highcharts Developer
iRusher28
Posts: 3
Joined: Thu Nov 11, 2021 1:30 pm

Re: Multiple series with timestamps not lined up

Hello mateusz.b,

Thanks for helping, unfortunately, the timestamps in the data base are effectively in seconds, but I pass them into milliseconds as I give them to the charts, as you can see on the tooltip. So I fear that this is not the problem that I'm facing...

Thanks anyway ! I'm still looking for an answer and will update this topic if I resolve the issue !
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Multiple series with timestamps not lined up

Hi iRusher28,

Wrong date format was the most probable cause. If that is not the case I need you to provide me with reproduction of that issue in a form of a live demo. You can start here: https://jsfiddle.net/BlackLabel/g96kt8jo/

Regards!
Mateusz Bernacik
Highcharts Developer
iRusher28
Posts: 3
Joined: Thu Nov 11, 2021 1:30 pm

Re: Multiple series with timestamps not lined up

Hi mateusz.b,

Thanks again for helping. Here is the live demo of my code : https://jsfiddle.net/zdjtvb5q/

I just figured my problem out while trying to explain my code aha.

In fact I used always the same sensor's timestamp series to create the chart input data.

Thanks a lot ! :D
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Multiple series with timestamps not lined up

Hello iRusher28,

Great to hear you have figured it out. In case of any further question feel free to ask them!

Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Usage”