setItems: Set the items of a timeline

Description Usage Arguments Examples

Description

Set the items of a timeline

Usage

1

Arguments

id

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

data

A dataframe containing the item data to use.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
timevis(data.frame(start = Sys.Date(), content = "Today")) %>%
  setItems(data.frame(start = Sys.Date() - 1, content = "yesterday"))

if (interactive()) {
library(shiny)
shinyApp(
  ui = fluidPage(
    timevisOutput("timeline"),
    actionButton("btn", "Change the data to yesterday")
  ),
  server = function(input, output) {
    output$timeline <- renderTimevis(
      timevis(data.frame(start = Sys.Date(), content = "Today"))
    )
    observeEvent(input$btn, {
      setItems("timeline",
               data.frame(start = Sys.Date() - 1, content = "yesterday"))
    })
  }
)
}

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