0

Please take a look at my jsFiddle:

https://jsfiddle.net/MrSnrub/8ugu3pta/5/

Set the start date to January 9, 2012. If we look at the imported JSON feed for GOOG stock (which can be found here: https://www.highcharts.com/samples/data/jsonp.php?filename=goog-c.json), we see the following values for that range:

/* Jan 2012 */
[1325548800000,332.37], // 2012-01-03 
[1325635200000,333.81], // 2012-01-04
[1325721600000,329.18], // 2012-01-05
[1325808000000,324.68], // 2012-01-06
[1326067200000,310.92], // 2012-01-09
[1326153600000,311.26], // 2012-01-10
[1326240000000,312.67], // 2012-01-11
[1326326400000,314.51], // 2012-01-12
[1326412800000,312.18], // 2012-01-13

However, my Highcharts graph says the GOOG value at 1/9/2012 is 324.68. I am fetching the seriesProcessedYData like so:

  var series_processed_y_data =
    e.target.series[i].processedYData;

  var series_min_y_data =
    series_processed_y_data[0].toFixed(2);

I am fetching the zeroth value of the array. Why is it still one day ahead, and how do I fix it?

MrSnrub
  • 435
  • 4
  • 14
  • 1
    Apparently processedYData includes one point before the visible points (also, one point after) - so start from series_processed_y_data[i+1 / 1]. The point's value is displayed correctly if you look at the text above your chart. https://jsfiddle.net/8ugu3pta/7/ – morganfree Jan 10 '17 at 17:08
  • I'm sorry, I don't understand. In the jsFiddle you posted the text above the chart displays a date of January 5, 2012, and the value it displays is $324.68, which is incorrect. The value for January 5, 2012 should be $329.18. – MrSnrub Jan 10 '17 at 19:30
  • It happens because it displays your local time. You can see time offset (e.g. GMT -0500) next to the date. A solid answer from [here](http://stackoverflow.com/questions/9756120/how-do-i-get-a-utc-timestamp-in-javascript) might give you some insight into that time difference. – morganfree Jan 11 '17 at 12:38

0 Answers0