Skip to contents

Moves the zoom slider of GC_zoom() in a running Shiny app, without drawing the chart again from R.

Usage

GC_zoom_to(outputId, range = NULL, session = shiny::getDefaultReactiveDomain())

Arguments

outputId

The output ID of the chart, as in GC_chartOutput().

range

The window, as c(start, end) in the units of the mode of GC_zoom(): shares of the clusters ("relative") or base pairs ("absolute"). NULL shows everything.

session

The Shiny session.

Value

Nothing; called for its effect.

See also

Examples

if (interactive()) {
  library(shiny)
  ui <- fluidPage(
    actionButton("first", "First half"),
    actionButton("all", "Everything"),
    GC_chartOutput("chart", height = "300px")
  )
  server <- function(input, output, session) {
    output$chart <- renderGC_chart(
      GC_chart(ophA_clusters, cluster = "cluster", group = "class") %>%
        GC_zoom() %>%
        GC_events(zoom = TRUE)
    )
    observeEvent(input$first, GC_zoom_to("chart", c(0, 0.5)))
    observeEvent(input$all, GC_zoom_to("chart", NULL))
    observeEvent(input$chart_zoom, str(input$chart_zoom))
  }
  shinyApp(ui, server)
}