Learn R Programming

timevis (version 2.1.0)

setCurrentTime: Adjust the time of the current time bar

Description

Adjust the time of the current time bar

Usage

setCurrentTime(id, time)

Arguments

id

Timeline id or a timevis object (the output from timevis())

time

The new date/time

Examples

Run this code
if (FALSE) {
timevis() %>%
  setCurrentTime(Sys.Date())
}

if (interactive()) {
library(shiny)
shinyApp(
  ui = fluidPage(
    timevisOutput("timeline"),
    actionButton("btn", "Set current time to beginning of today")
  ),
  server = function(input, output) {
    output$timeline <- renderTimevis(
      timevis()
    )
    observeEvent(input$btn, {
      setCurrentTime("timeline", Sys.Date())
    })
  }
)
}

Run the code above in your browser using DataLab