I have a xts
object in R with dates from 2018-09-01
to 2020-08-01
. I'm using dyRangeSelector
with dateWindow()
from 2019-01-01
to 2020-08-01
and does not appear last month (August). I saw this question, but doesn't work.
My code:
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"))
My 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"
)))
I can see data from August, but in legend shows only until July. What am I doing wrong?
scroll to the right of your View Panel. It shows the latest values if you move your cursor to them.
code to produce the chart:
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"))