0
votes

I am comparing temperatures today with the same day last year. I am retrieving the data from a database (via json) and each series has different times (and timestamps). Today's series has datapoints every 10 minutes, last year has data points at 00 and 50 minutes past the hour.

I cannot get both series to plot accurately on the x axis.

I have played about with the pointInterval for last years data to try to get it right but it only ends up looking approximately right.

pointInterval: 3600 * 1000 / 2.05

Is there a way to accurately plot points in both series against the x axis?

Please see jsfiddle

1
Thank you, however that makes the series lines the same length on the chart but the values do not line up. I need the values in both series to be accurately placed with regard to the x axis.Leonard Bassoon
Map string values to timestamp - see example jsfiddle.net/sp04qg3wmorganfree
Thank you. That gets the result I'm after. I don't fully understand the first bit well enough to adapt and use though, below, can you explain please? const pointStart = 1489968600000; const mapper = point => { const time = point[0].split(':'); const hours = Number(time[0]) * 60 * 60 * 1000; const minutes = Number(time[1]) * 60 * 1000; return [hours + minutes, point[1]]; }Leonard Bassoon

1 Answers

0
votes

I've managed it. I needed to remove the pointStart and pointInterval from each series, change the year of the 'last year' series to reflect this year and then change to tooltip to show only the hour and minute.