In noUiSliderInput()
the numbers are shown as decimal by default like: 5.00
To change to integer like: 5
we can use the argument format
: format = list(wNumbFormat(decimals = 0, thousand = ",", prefix = "$"))
This only works partially like here:
library( shiny )
library( shinyWidgets )
ui <- fluidPage(
div(style = 'position: absolute;left: 150px; top:270px; width:950px;margin:auto',
noUiSliderInput(
inputId = "noui2", label = "Slider vertical:",
min = 0, max = 45, step = 1,
value = c(15, 20), margin = 10,
orientation = "vertical",
width = "100px", height = "300px",
format = list(wNumbFormat(decimals = 0, thousand = ",", prefix = "$"))
),
verbatimTextOutput(outputId = "res2")
)
)
server <- function(input, output, session) {
output$res2 <- renderPrint(input$noui2)
}
shinyApp(ui, server)
What is the reason for this behavior?
I'm not sure why you are wrapping wNumbFormat
in a list
, but notice that while you set the prefix to "$"
, it does not show up in your graphic/video, suggesting that your options are not being used.
Remove the list
and it works:
ui <- fluidPage(
div(style = 'position: absolute;left: 150px; top:270px; width:950px;margin:auto',
noUiSliderInput(
inputId = "noui2", label = "Slider vertical:",
min = 0, max = 45, step = 1,
value = c(15, 20), margin = 10,
orientation = "vertical",
width = "100px", height = "300px",
format = wNumbFormat(decimals = 0, thousand = ",", prefix = "$")
),
verbatimTextOutput(outputId = "res2")
)
)