removeCustomTime {linevis}R Documentation

Remove a custom time previously added

Description

Remove a custom time previously added

Usage

removeCustomTime(id, itemId)

Arguments

id

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

itemId

The id of the custom time bar

Value

None, side-effect is Javascript call

Examples

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

## End(Not run)

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

[Package linevis version 1.0.0 Index]