Dygraphs 比 R 中的数据早一个月显示

Dygraphs shows one month earlier than data in R

我在 R 中有一个 xts 对象,日期从 2018-09-012020-08-01。我使用 dyRangeSelectordateWindow()2019-01-012020-08-01 并且上个月(八月)没有出现。我看到 this 个问题,但没有用。

我的代码:

library(dygraphs)
library(xts)

PIM_graf_1  <- dygraph(data, width = 800, height = 400)
PIM_graf_1  <- dySeries(PIM_graf_1, "PIM_sa", label = "PIM Geral", color = "#3689e6", strokeWidth = 3)
PIM_graf_1  <- dySeries(PIM_graf_1, "Ind_trans_sa", label = "Transformação", color = "#667885", strokeWidth = 3)
PIM_graf_1  <- dySeries(PIM_graf_1, "Ind_Ext_sa", label = "Extrativa", color = "#d48e15", strokeWidth = 3)
PIM_graf_1  <- dyOptions(PIM_graf_1, gridLineColor = "white", gridLineWidth = 0.2, useDataTimezone = TRUE)
PIM_graf_1  <- dyLegend( PIM_graf_1, show = "always", hideOnMouseOut = TRUE, width = 622)
PIM_graf_1  <- dyRangeSelector(PIM_graf_1,  height = 30, fillColor = "#abacae", dateWindow = c("2019-01-01", "2020-09-01"))

我的dput:

structure(c(86.7, 87.2, 87.6, 88.2, 87.3, 87.8, 86.7, 87, 87.4, 
                     86.8, 85.6, 86.7, 87.3, 88.3, 87, 86.4, 87.3, 88.1, 79.9, 64.3, 
                     69.9, 76.7, 83.1, 85.8, 85.8, 85.8, 85.9, 86.2, 85.8, 87.1, 86.4, 
                     87.8, 87.1, 86, 85, 85.8, 86.6, 87.9, 86.5, 86, 87.6, 87.6, 78.6, 
                     60.2, 68.1, 75.2, 82.2, 85.1, 99.2, 102, 101.6, 103, 103.6, 87.6, 
                     86.8, 78.4, 86.5, 87, 92.8, 98.5, 96.5, 94.2, 91.9, 90.5, 88.2, 
                     88, 86.5, 86.1, 81.8, 86.1, 94, 96.4), class = c("xts", "zoo"
                     ), index = structure(c(1535760000, 1538352000, 1541030400, 1543622400, 
                                            1546300800, 1548979200, 1551398400, 1554076800, 1556668800, 1559347200, 
                                            1561939200, 1564617600, 1567296000, 1569888000, 1572566400, 1575158400, 
                                            1577836800, 1580515200, 1583020800, 1585699200, 1588291200, 1590969600, 
                                            1593561600, 1596240000), tzone = "UTC", tclass = "Date"), .Dim = c(24L, 
                                                                                                               3L), .Dimnames = list(NULL, c("PIM_sa", "Ind_trans_sa", "Ind_Ext_sa"
                                                                                                               )))

我可以看到 8 月的数据,但在图例中只显示到 7 月。我究竟做错了什么?

滚动到视图面板的右侧。如果将光标移动到它们,它会显示最新值。

生成图表的代码:

library(dygraphs)
library(xts)

data <- structure(c(86.7, 87.2, 87.6, 88.2, 87.3, 87.8, 86.7, 87, 87.4, 
                    86.8, 85.6, 86.7, 87.3, 88.3, 87, 86.4, 87.3, 88.1, 79.9, 64.3, 
                    69.9, 76.7, 83.1, 85.8, 85.8, 85.8, 85.9, 86.2, 85.8, 87.1, 86.4, 
                    87.8, 87.1, 86, 85, 85.8, 86.6, 87.9, 86.5, 86, 87.6, 87.6, 78.6, 
                    60.2, 68.1, 75.2, 82.2, 85.1, 99.2, 102, 101.6, 103, 103.6, 87.6, 
                    86.8, 78.4, 86.5, 87, 92.8, 98.5, 96.5, 94.2, 91.9, 90.5, 88.2, 
                    88, 86.5, 86.1, 81.8, 86.1, 94, 96.4), class = c("xts", "zoo"
                    ), index = structure(c(1535760000, 1538352000, 1541030400, 1543622400, 
                                           1546300800, 1548979200, 1551398400, 1554076800, 1556668800, 1559347200, 
                                           1561939200, 1564617600, 1567296000, 1569888000, 1572566400, 1575158400, 
                                           1577836800, 1580515200, 1583020800, 1585699200, 1588291200, 1590969600, 
                                           1593561600, 1596240000), tzone = "UTC", tclass = "Date"), .Dim = c(24L, 
                                                                                                              3L),
                  .Dimnames = list(NULL, c("PIM_sa", "Ind_trans_sa", "Ind_Ext_sa")))
                                                                                                                                            


PIM_graf_1  <- dygraph(data, width = 800, height = 400)
PIM_graf_1  <- dySeries(PIM_graf_1, "PIM_sa", label = "PIM Geral", color = "#3689e6", strokeWidth = 3)
PIM_graf_1  <- dySeries(PIM_graf_1, "Ind_trans_sa", label = "Transformação", color = "#667885", strokeWidth = 3)
PIM_graf_1  <- dySeries(PIM_graf_1, "Ind_Ext_sa", label = "Extrativa", color = "#d48e15", strokeWidth = 3)
PIM_graf_1  <- dyOptions(PIM_graf_1, gridLineColor = "white", gridLineWidth = 0.2, useDataTimezone = TRUE)
PIM_graf_1  <- dyLegend( PIM_graf_1, show = "always", hideOnMouseOut = TRUE, width = 622)
PIM_graf_1  <- dyRangeSelector(PIM_graf_1,  height = 30, fillColor = "#abacae", dateWindow = c("2019-01-01", "2020-09-01"))