setCurrentTime: Adjust the time of the current time bar

View source: R/api.R

setCurrentTimeR Documentation

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

## Not run: 
timevis() %>%
  setCurrentTime(Sys.Date())

## End(Not run)

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())
    })
  }
)
}

timevis documentation built on Nov. 3, 2022, 9:06 a.m.