proxies.Rd
Use proxies with shiny.
b_zoom_p(proxy, domain) b_focus_p(proxy, series) b_defocus_p(proxy, series = NULL) b_transform_p(proxy, to, serie) b_stack_p(proxy, serie) b_region_p(proxy, axis, start, end, class = NULL) b_add_region_p(proxy, axis, start, end, class = NULL) b_flow_p(proxy, data, series, x = NULL) b_load_p(proxy, data, series, unload = NULL) b_export_p(proxy)
proxy | an object of class |
---|---|
domain | domain to zoom to. |
to | transformation target, see details. |
serie, series | target series. |
axis | target axis. |
start, end | start and end of region. |
class |
|
data | data set. |
x | x column. |
unload | series to unload. |
Zoom on a specific area.
Focus on a particular serie.
Unfocus from particular serie.
Change charge type.
Stack series.
Add regions.
Define region.
Add rows of data.
Add series.
# NOT RUN { library(shiny) ui <- fluidPage( fluidRow( column( 3, sliderInput("zoom", "Zoom on a region", min = 0, max = 150, value = 100 ) ), column( 2, selectInput( "transform", "Filter:", choices = c("line", "spline", "area", "area-spline", "scatter", "bar"), selected = "line" ) ), column( 2, selectInput( "focus", label = "Focus on data", choices = c("y", "z"), selected = "y" ) ), column( 3, selectInput( "stack", label = "Stack", choices = c("x", "y", "z"), selected = "y", multiple = TRUE ) ), column( 2, checkboxInput( "region", "Add region", FALSE ) ) ), fluidRow( billboardOutput("billboard") ), fluidRow( column( 3, sliderInput("add", "Add rows", min = 0, max = 100, value = 0 ) ), column( 3, actionButton("cols", "Add serie") ), column( 3, actionButton("export", "Export") ) ) ) server <- function(input, output){ data <- data.frame(x = runif(100, 1, 100), y = runif(100, 1, 100), z = runif(100, 1, 100)) df <- eventReactive(input$add, { data.frame(x = runif(input$add, 10, 80), y = runif(input$add, 10, 80), z = runif(input$add, 10, 80)) }) random_data <- eventReactive(input$cols, { df <- data.frame(x = runif(100, 1, 100)) names(df) <- paste0("col", sample(LETTERS, 1)) df }) output$billboard <- renderBillboard({ data %>% b_board() %>% b_line(x) %>% b_bar(y, stack = TRUE) %>% b_area(z, stack = TRUE) %>% b_zoom() }) observeEvent(input$zoom, { billboardProxy("billboard") %>% b_zoom_p(c(0, input$zoom)) }) observeEvent(input$transform, { billboardProxy("billboard") %>% b_transform_p(input$transform, "x") }) observeEvent(input$focus, { billboardProxy("billboard") %>% b_focus_p(list("x", input$filter)) }) observeEvent(input$stack, { billboardProxy("billboard") %>% b_stack_p(list("x", input$stack)) }) observeEvent(input$region, { if(isTRUE(input$region)){ billboardProxy("billboard") %>% b_add_region_p(axis = "x", start = 1, end = 40) } }) observeEvent(input$add, { billboardProxy("billboard") %>% b_flow_p(df(), names(df())) }) observeEvent(input$cols, { billboardProxy("billboard") %>% b_load_p(random_data(), names(random_data())) }) observeEvent(input$export, { billboardProxy("billboard") %>% b_export_p() }) } shinyApp(ui, server) # }