Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
43 lines (35 sloc) 801 Bytes
library(shiny)
library(robservable)
robs <- robservable(
"@d3/bar-chart",
include = "chart",
input = list(color = "red", height = 700)
)
ui <- tagList(
robservableOutput("bar")
)
server <- function(input, output, session) {
output$bar <- renderRobservable({
robs
})
# set up a proxy to our bar robservable instance
# for later manipulation
robs_proxy <- robservableProxy("bar")
robs_observe(robs_proxy, "color")
observeEvent(input$bar_color, {
print(input$bar_color)
})
observe({
invalidateLater(2000, session)
# update with random color
robs_update(
robs_proxy,
color = paste0(
"rgb(",
paste0(col2rgb(colors()[floor(runif(1,1,length(colors())))]),collapse=","),
")"
)
)
})
}
shinyApp(ui, server)
You can’t perform that action at this time.