fitWindow: Adjust the visible window such that it fits all items

View source: R/api.R

fitWindowR Documentation

Adjust the visible window such that it fits all items

Description

Adjust the visible window such that it fits all items

Usage

fitWindow(id, options)

Arguments

id

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

options

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

Value

None, side-effect is Javascript call

Examples

if (interactive()) {
library(shiny)
shinyApp(
  ui = fluidPage(
    linevisOutput("graph2d"),
    actionButton("btn", "Fit all items")
  ),
  server = function(input, output) {
    output$graph2d <- renderLinevis(
      linevis(data.frame(
        start = c(Sys.Date(), Sys.Date() - 1), content = c("1", "2")
      ))
    )
    observeEvent(input$btn, {
      fitWindow("graph2d", list(animation = FALSE))
    })
  }
)
}

linevis documentation built on April 3, 2025, 10:57 p.m.