Giter VIP home page Giter VIP logo

Comments (3)

pvictor avatar pvictor commented on June 11, 2024 1

Hi!

Ahaha nice! Glad you like the package!

Yes, pickerInput doesn't work in dropdownButton, that's related to issue #3 ...
That's why there is a second dropdown function !
This one works with pickerInput and add animations (optionnal), but is a little more experimental.

Here the example in the gallery, select boxes are pickerInput :

library("shiny")
library("shinyWidgets")

ui <- fluidPage(
  tags$h2("pickerInput in dropdown"),
  br(),
  dropdown(
    
    tags$h3("List of Input"),
    
    pickerInput(inputId = 'xcol2',
                label = 'X Variable',
                choices = names(iris),
                options = list(`style` = "btn-info")),
    
    pickerInput(inputId = 'ycol2', 
                label = 'Y Variable',
                choices = names(iris),
                selected = names(iris)[[2]], 
                options = list(`style` = "btn-warning")),
    
    sliderInput(inputId = 'clusters2', 
                label = 'Cluster count', 
                value = 3,
                min = 1, max = 9),
    
    style = "unite", icon = icon("gear"), status = "danger", width = "300px",
    animate = animateOptions(enter = animations$fading_entrances$fadeInLeftBig,
                             exit = animations$fading_exits$fadeOutRightBig)
  ),
  
  plotOutput(outputId = 'plot2')
)

server <- function(input, output, session) {
  
  selectedData2 <- reactive({
    iris[, c(input$xcol2, input$ycol2)]
  })
  
  clusters2 <- reactive({
    kmeans(selectedData2(), input$clusters2)
  })
  
  output$plot2 <- renderPlot({
    palette(c("#E41A1C", "#377EB8", "#4DAF4A", "#984EA3",
              "#FF7F00", "#FFFF33", "#A65628", "#F781BF", "#999999"))
    
    par(mar = c(5.1, 4.1, 0, 1))
    plot(selectedData2(),
         col = clusters2()$cluster,
         pch = 20, cex = 3)
    points(clusters2()$centers, pch = 4, cex = 4, lwd = 4)
  })
  
}

shinyApp(ui = ui, server = server)

PS : I will update the gallery to show the code for the dropdowns

Victor

from shinywidgets.

Minded13 avatar Minded13 commented on June 11, 2024

Thanks a lot for your quick reply and for examples.

I'm really sorry because I didn't look at closed issues before reporting. My bad, I'm new to github and I will remember that.

Goodbye!

from shinywidgets.

pvictor avatar pvictor commented on June 11, 2024

No worries, glad to help :)
Bye!

from shinywidgets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.