addItem: Add a single item to a timeline

Description Usage Arguments Examples

View source: R/api.R

Description

Add a single item to a timeline

Usage

1

Arguments

id

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

data

A named list containing the item data to add.

Examples

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

if (interactive()) {
library(shiny)
shinyApp(
  ui = fluidPage(
    timevisOutput("timeline"),
    actionButton("btn", "Add item today")
  ),
  server = function(input, output) {
    output$timeline <- renderTimevis(
      timevis()
    )
    observeEvent(input$btn, {
      addItem("timeline", list(start = Sys.Date(), content = "Today"))
    })
  }
)
}

westdana/Timeline documentation built on July 28, 2017, 12:13 a.m.