Learn R Programming

timevis (version 0.1)

centerTime: Move the window such that the given time is centered

Description

Move the window such that the given time is centered

Usage

centerTime(id, time, options)

Arguments

id
Timeline id
time
The date/time to center around
options
Named list of options controlling the animation. Most common option is "animation" = TRUE/FALSE. For a full list of options, see the "moveTo" method in the official Timeline documentation

Examples

Run this code
if (interactive()) {
library(shiny)
shinyApp(
  ui = fluidPage(
    timevisOutput("timeline"),
    actionButton("btn", "Center around 24 hours ago")
  ),
  server = function(input, output) {
    output$timeline <- renderTimevis(
      timevis()
    )
    observeEvent(input$btn, {
      centerTime("timeline", Sys.Date())
    })
  }
)
}

Run the code above in your browser using DataLab