setItems {linevis}R Documentation

Set the items of a graph2d

Description

Set the items of a graph2d

Usage

setItems(id, data)

Arguments

id

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

data

A dataframe containing the item data to use.

Value

None, side-effect is Javascript call

Examples

## Not run: 
linevis(data.frame(start = Sys.Date(), content = "Today")) %>%
  setItems(data.frame(start = Sys.Date() - 1, content = "yesterday"))

## End(Not run)

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

[Package linevis version 1.0.0 Index]