Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add support for shiny::bindCache #1879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2020
Merged

Add support for shiny::bindCache #1879

merged 1 commit into from
Nov 16, 2020

Conversation

wch
Copy link
Contributor

@wch wch commented Nov 5, 2020

To be merged after ramnathv/htmlwidgets#391.

This makes renderPlotly work with shiny::bindCache in the dev version of shiny. For example:

library(shiny)
library(plotly)

ui <- fluidPage(
  selectizeInput(
    inputId = "cities", 
    label = "Select a city", 
    choices = unique(txhousing$city), 
    selected = "Abilene",
    multiple = TRUE
  ),
  plotlyOutput(outputId = "p")
)

server <- function(input, output, ...) {
  output$p <- renderPlotly({
    message("Computing p: ", paste(input$cities, collapse = ", "))
    Sys.sleep(2)
    plot_ly(txhousing, x = ~date, y = ~median) %>%
      filter(city %in% input$cities) %>%
      group_by(city) %>%
      add_lines()
  }) %>% 
    bindCache(input$cities)

}

shinyApp(ui, server)

R/shiny.R Show resolved Hide resolved
@wch wch changed the title Add support for shiny::withCache Add support for shiny::bindCache Nov 13, 2020
@cpsievert cpsievert merged commit e6725e6 into master Nov 16, 2020
@cpsievert cpsievert deleted the wch-withcache branch November 16, 2020 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.