demo/apps/zoom/ui.r

library(ggvis)

var_range <- function(id, label, variable) {
  rng <- range(variable, na.rm = TRUE)
  sliderInput(id, label, rng[1], rng[2], rng)
}

shinyUI(pageWithSidebar(
  headerPanel("Zooming demo"),
  sidebarPanel(
    var_range("x_domain", "X", mtcars$disp),
    var_range("y_domain", "Y", mtcars$mpg)
  ),
  mainPanel(
    ggvisOutput("zoom")
  )
))

Try the ggvis package in your browser

Any scripts or data that you put into this service are public.

ggvis documentation built on May 29, 2024, 1:12 a.m.