Reputation: 265
I have this code from the shiny UI.
I want one input to depend in other input in the UI. So lets say if the user insert 100 in one input I want the MIN of the other input to be input$1 * 5 for example. So in that case the min of the input number 2 would be 500.
Ill attach the code I wanted to work but it doesn't.Is there any other workaround you can think of?
Thanks
ui <- fluidPage(
(titlePanel("Price estimation", windowTitle = "app")),
sidebarLayout( sidebarPanel(
checkboxGroupInput(inputId = "checkgroupuno",
label = "Select stages",
choices = c("Proekt","Working Design",
"Tender Design", "Concept"),
selected = "Proekt", inline = F),
radioButtons(inputId = "radiouno",
label = "Select Design",
choices = c("Shell & Core","Fit Out",
"Shell Core & Fit Out"),
selected = "Shell & Core", inline = F),
sliderInput(inputId = "slideruno",
label = "Size", min = 0, max = 250000, value = 50000,ticks = T),
sliderInput(inputId = "sliderdos",
label = "TIME", min = input$slideruno * 10, max = input$slideruno * 15, value = input$slideruno * 10,ticks = T)
),
mainPanel(plotlyOutput(outputId = "plotuno"))
))
Upvotes: 0
Views: 86
Reputation: 29417
You can dynamically create your slider, as so:
rm(list = ls())
library(shiny)
library(plotly)
ui <- fluidPage(titlePanel("Price estimation", windowTitle = "app"),
sidebarLayout(sidebarPanel(
checkboxGroupInput(inputId = "checkgroupuno",label = "Select stages",
choices = c("Proekt","Working Design","Tender Design", "Concept"),selected = "Proekt", inline = F),
radioButtons(inputId = "radiouno",label = "Select Design",choices = c("Shell & Core","Fit Out","Shell Core & Fit Out"),selected = "Shell & Core", inline = F),
sliderInput(inputId = "slideruno",label = "Size", min = 0, max = 250000, value = 50000,ticks = T),
uiOutput("custom_sliderdos")
)
,mainPanel(plotlyOutput(outputId = "plotuno"))
))
server <- function(input, output) {
output$custom_sliderdos <- renderUI({sliderInput(inputId = "sliderdos", label = "TIME", min = input$slideruno * 10, max = input$slideruno * 15, value = input$slideruno * 10,ticks = T)})
}
shinyApp(ui, server)
Upvotes: 1