Changing time zone in Highchart

Viewed 888

I am plotting a chart using highcharter function. You can notice the timestamp starts from June 29th. But i when plot it , the graph shows data plotting from June 28,18.30. How do i change this time zone??

> head(d)
                   timestamps  x1  x2  x3  x4  x5  x6  x7  x8  x9 x10  x11     x12
    47948 2017-06-29 00:00:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 48.5 1210.87
    47949 2017-06-29 00:01:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 49.2 1213.91
    47950 2017-06-29 00:02:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 49.0 1213.59
    47951 2017-06-29 00:03:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 50.0 1214.28
    47952 2017-06-29 00:04:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 50.0 1212.13
    47953 2017-06-29 00:05:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 49.8 1216.06

PIC

library(highcharter)
highchart() %>% 
  hc_title(text = "A nice chart") %>% 
  hc_add_series_times_values(d$timestamps, 
                             d$x12, name = "x12")

Any help is appreciated. Thank you.

1 Answers

This is how I managed to deactivate UTC in highcharter.

hcGopts <- getOption("highcharter.global")
hcGopts$useUTC <- FALSE
options(highcharter.global = hcGopts)

The global options are not directly accessible from R. From JavaScript, it would be like this:

Highcharts.setOptions({
    global: {
        useUTC: false
    }
});
Related