setWindow {linevis}R Documentation

Set the current visible window

Description

Set the current visible window

Usage

setWindow(id, start, end, options)

Arguments

id

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

start

The start date/time to show in the graph2d

end

The end date/time to show in the graph2d

options

Named list of options controlling mainly the animation. Most common option is animation = TRUE/FALSE. For a full list of options, see the "setWindow" method in the official graph2d documentation

Value

None, side-effect is Javascript call

Examples

## Not run: 
linevis() %>%
  setWindow(Sys.Date() - 1, Sys.Date() + 1)

## End(Not run)

if (interactive()) {
library(shiny)
shinyApp(
  ui = fluidPage(
    linevisOutput("graph2d"),
    actionButton("btn", "Set window to show between yesterday to tomorrow")
  ),
  server = function(input, output) {
    output$graph2d <- renderLinevis(
      linevis()
    )
    observeEvent(input$btn, {
      setWindow("graph2d", Sys.Date() - 1, Sys.Date() + 1)
    })
  }
)
}

[Package linevis version 1.0.0 Index]