I've got a Shiny dashboard with an Plotly time series, the range of which is adjusted via a reactive dateRangeInput I put together (please see code below).
Everything was working fine, but then I updated my packages. Since then, the variables do not automatically show in the first instance, you have to choose the date ranges instead of the plot loading in with a default time range.
What's more the dateRangeInput is using strange language such as monate, tueate, wedate etc.
I need some help to establish what my issue may be.
Session info
Prior to the update I was using Plotly 3.6.0, shinyDashboard 0.5.1 and shiny 0.13.2.
After the update I am using Plotly 4.5.6, shinyDashboard 0.5.3 and shiny 0.14.2
Please see the respective code below
ui - plotlyOuput Time Series code
box(width = 8,
solidHeader = TRUE,
plotlyOutput("Time_Ser", height ="300px"))
ui - dateRangeInput code
dateRangeInput("date","Date:",
label = h4("Time Series: select dates"),
start = "2017-05-02",
end = "2017-07-30",
min = "2017-05-02",
max = "2017-06-30",
startview = "2017-06-30")
server - Reactive input code
Time2 <- Time
reactiveTime <- reactive({
Time2 %>% filter(Date.received>=input$date[1] &
Date.received<input$date[2])
})
server - output
output$Time_Ser <- renderPlotly({
Time_Ser <- plot_ly(reactiveTime(),
x = ~Date.received,
y = ~n,
type = "scatter",
mode = "lines") %>%
layout(title = "Enquiries Time Series")
})
Supporting images
Try using something like the following for your dateRangeInput
. I can't explain why your code worked before, but note that startview
should be a categorical string, you can specify date format shown (to overwrite the fact that it seems to be defaulting to DD
), and you can force language (but shouldn't actually need to).
dateRangeInput("date", "Date:",
label = h4("Time Series: select dates"),
start = "2016-05-02",
end = "2016-12-31",
min = "2016-01-01",
max = "2016-12-31",
startview = "year",
weekstart=0,
language="en",
format="yyyy-mm-dd")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.