removeCustomTime: Remove a custom time previously added

Description Usage Arguments Examples

Description

Remove a custom time previously added

Usage

1
removeCustomTime(id, itemId)

Arguments

id

Timeline id or a timevis object (the output from timevis())

itemId

The id of the custom time bar

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
timevis() %>%
  addCustomTime(Sys.Date() - 1, "yesterday") %>%
  addCustomTime(Sys.Date() + 1, "tomorrow") %>%
  removeCustomTime("yesterday")

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

westdana/Timeline documentation built on May 3, 2019, 3:02 p.m.