Set sliderInput values as characters in shiny

前端 未结 2 1576
别那么骄傲
别那么骄傲 2021-01-18 18:29

My shiny app has a sliderInput, but want to replace values as character labels. How could I implement it? Thanks for any suggestions.

This is my example

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-18 18:49

    This can be easily done using sliderTextInput function in shiny. No need to add all this complex js function. Just a few lines of code will do the trick.Install the shinywidgets package which contains the sliderTextInput function. Do the following :

      sliderTextInput("foo","Animation Duration" , 
                      choices = c("Label 1", "Label 3", "Label 3"), 
                      selected = c("Label 1", "Label 3", "Label 3"), #incase you want all values by default 
                      animate = FALSE, grid = FALSE, 
                      hide_min_max = FALSE, from_fixed = FALSE,
                      to_fixed = FALSE, from_min = NULL, from_max = NULL, to_min = NULL,
                      to_max = NULL, force_edges = FALSE, width = NULL, pre = NULL,
                      post = NULL, dragRange = TRUE)
    

提交回复
热议问题