Learn R Programming

linevis (version 1.0.0)

setCurrentTime: Adjust the time of the current time bar

Description

Adjust the time of the current time bar

Usage

setCurrentTime(id, time)

Value

None, side-effect is Javascript call

Arguments

id

graph2d id or a linevis object (the output from linevis())

time

The new date/time

Examples

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

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

Run the code above in your browser using DataLab