addCustomTime {linevis}R Documentation

Add a new vertical bar at a time point that can be dragged by the user

Description

Add a new vertical bar at a time point that can be dragged by the user

Usage

addCustomTime(id, time, itemId)

Arguments

id

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

time

The date/time to add

itemId

The id of the custom time bar

Value

None, side-effect is Javascript call

Examples

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

## End(Not run)

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

[Package linevis version 1.0.0 Index]