setCustomTime {linevis}R Documentation

Adjust the time of a custom time bar

Description

Adjust the time of a custom time bar

Usage

setCustomTime(id, time, itemId)

Arguments

id

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

time

The new date/time

itemId

The id of the custom time bar

Value

None, side-effect is Javascript call

Examples

## Not run: 
linevis() %>%
  addCustomTime(Sys.Date(), "yesterday") %>%
  setCustomTime(Sys.Date() - 1, "yesterday")

## End(Not run)

if (interactive()) {
library(shiny)
shinyApp(
  ui = fluidPage(
    linevisOutput("graph2d"),
    actionButton("btn", "Set time bar 24 hours ago")
  ),
  server = function(input, output) {
    output$graph2d <- renderLinevis(
      linevis() %>% addCustomTime(Sys.Date(), "yesterday")
    )
    observeEvent(input$btn, {
      setCustomTime("graph2d", Sys.Date() - 1, "yesterday")
    })
  }
)
}

[Package linevis version 1.0.0 Index]