Skip to content
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

Bug settings controls to NULL ? #148

Closed
bthieurmel opened this issue Apr 15, 2021 · 3 comments
Closed

Bug settings controls to NULL ? #148

bthieurmel opened this issue Apr 15, 2021 · 3 comments

Comments

@bthieurmel
Copy link

Little example :

library(shiny)
library(esquisse)

ui <- fluidPage(
  tags$h1("Use esquisse as a Shiny module"),
  
  radioButtons(
    inputId = "data", 
    label = "Data to use:", 
    choices = c("iris", "mtcars"),
    inline = TRUE
  ),
  checkboxGroupInput(
    inputId = "aes", 
    label = "Aesthetics to use:", 
    choices = c(
      "fill", "color", "size", "shape", 
      "weight", "group", "facet", "facet_row", "facet_col"
    ),
    selected = c("fill", "color", "size", "facet"),
    inline = TRUE
  ),
  esquisse_ui(
    id = "esquisse", 
    header = FALSE, # dont display gadget title
    controls = NULL,
    container = esquisseContainer(height = "700px")
  )
)

server <- function(input, output, session) {
  
  data_rv <- reactiveValues(data = iris, name = "iris")
  
  observeEvent(input$data, {
    if (input$data == "iris") {
      data_rv$data <- iris
      data_rv$name <- "iris"
    } else {
      data_rv$data <- mtcars
      data_rv$name <- "mtcars"
    }
  })
  
  esquisse_server(
    id = "esquisse", 
    data_rv = data_rv, 
    default_aes = reactive(input$aes)
  )
  
}
shinyApp(ui, server)

And then using this graphic :

image

@bthieurmel
Copy link
Author

Seems to be when "labs" is not passed to controls

@pvictor
Copy link
Member

pvictor commented Apr 15, 2021

Thanks, should be fixed (84982ca). Caused by a bad call to ifelse:

> ifelse(TRUE, NULL, "")
Error in ans[ypos] <- rep(yes, length.out = len)[ypos] : 
  l'argument de remplacement est de longueur nulle
De plus : Warning message:
In rep(yes, length.out = len) : 'x' is NULL so the result will be NULL

@bthieurmel
Copy link
Author

Yes. fixed. Thanks @pvictor

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

No branches or pull requests

2 participants