setOptions: Update the configuration options of a timeline

View source: R/api.R

setOptionsR Documentation

Update the configuration options of a timeline

Description

Update the configuration options of a timeline

Usage

setOptions(id, options)

Arguments

id

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

options

A named list containing updated configuration options to use. See the options parameter of the timevis function to see more details.

Examples

## Not run: 
timevis(
  data.frame(start = Sys.Date(), content = "Today"),
  options = list(showCurrentTime = FALSE, orientation = "top")
) %>%
  setOptions(list(editable = TRUE, showCurrentTime = TRUE))

## End(Not run)

if (interactive()) {
library(shiny)
shinyApp(
  ui = fluidPage(
    timevisOutput("timeline"),
    actionButton("btn", "Show current time and allow items to be editable")
  ),
  server = function(input, output) {
    output$timeline <- renderTimevis(
      timevis(
        data.frame(start = Sys.Date(), content = "Today"),
        options = list(showCurrentTime = FALSE, orientation = "top")
      )
    )
    observeEvent(input$btn, {
      setOptions("timeline", list(editable = TRUE, showCurrentTime = TRUE))
    })
  }
)
}

timevis documentation built on Nov. 3, 2022, 9:06 a.m.