bokeh / rbokeh

R interface to Bokeh http://hafen.github.io/rbokeh/
Other
313 stars 67 forks source link

show datetime in local time zone #215

Open FatFeng opened 7 years ago

FatFeng commented 7 years ago

It looks like the rbokeh always plots the datetime in the UTC time zone. Could it be modified so that it can show in a local time zone as well?

For example: x <- seq(as.POSIXct("2011-1-1 08:00", tz='Asia/Hong_Kong'), as.POSIXct("2011-1-10 08:30", tz='Asia/Hong_Kong'), len=1000) y <- 1:1000 * 0.1 + rnorm(1000, sd=2)

The datetimes of the last 10 points are > print(tail(x, 10)) # show last time points [1] "2011-01-10 06:32:58 HKT" "2011-01-10 06:45:58 HKT" "2011-01-10 06:58:58 HKT" "2011-01-10 07:11:58 HKT" [5] "2011-01-10 07:24:59 HKT" "2011-01-10 07:37:59 HKT" "2011-01-10 07:50:59 HKT" "2011-01-10 08:03:59 HKT" [9] "2011-01-10 08:16:59 HKT" "2011-01-10 08:30:00 HKT"

We can see that all of them are on 2011-01-10, however, once we plot them, we will see > figure() %>% rbokeh::ly_lines(tail(x, 10), tail(y, 10)) image It looks like the x-axis tickers are shown in the UTC time zone instead of the Asia/Hong_Kong time zone.