Set the current visible window
setWindow(id, start, end, options)
Timeline id or a timevis
object (the output from timevis()
)
The start date/time to show in the timeline
The end date/time to show in the timeline
Named list of options controlling mainly the animation.
Most common option is animation = TRUE/FALSE
. For a full list of
options, see the "setWindow" method in the
official
Timeline documentation
timevis() %>%
setWindow(Sys.Date() - 1, Sys.Date() + 1)
if (interactive()) {
library(shiny)
shinyApp(
ui = fluidPage(
timevisOutput("timeline"),
actionButton("btn", "Set window to show between yesterday to tomorrow")
),
server = function(input, output) {
output$timeline <- renderTimevis(
timevis()
)
observeEvent(input$btn, {
setWindow("timeline", Sys.Date() - 1, Sys.Date() + 1)
})
}
)
}