setOptions {linevis}R Documentation

Update the configuration options of a graph2d

Description

Update the configuration options of a graph2d

Usage

setOptions(id, options)

Arguments

id

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

options

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

Value

None, side-effect is Javascript call

Examples

## Not run: 
linevis(
  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(
    linevisOutput("graph2d"),
    actionButton("btn", "Show current time and allow items to be editable")
  ),
  server = function(input, output) {
    output$graph2d <- renderLinevis(
      linevis(
        data.frame(start = Sys.Date(), content = "Today"),
        options = list(showCurrentTime = FALSE, orientation = "top")
      )
    )
    observeEvent(input$btn, {
      setOptions("graph2d", list(editable = TRUE, showCurrentTime = TRUE))
    })
  }
)
}

[Package linevis version 1.0.0 Index]