2

This is what my web application looks like: enter image description here

However, I don't want visible tick lines at random intervals (45,001, 90,001, etc). Quite simply, it looks pretty ugly. How can I change my code so that it is labeled at 1, 50k, 100k, 150k...400k, 428,036?

Here is my current code:

  sliderInput(inputId = "CR_num",
              label = "Please choose how many case reports you would like our tool to analyze.",
              value = "20000",
              step = 5000,
              min = 1,
              max = 428036)

I think the step parameter only allows the user to choose values from the scale at that interval...it doesn't change the labels.

Thanks.

sweetmusicality
  • 937
  • 1
  • 10
  • 27
  • Perhaps [this](https://stackoverflow.com/questions/30502870/shiny-slider-on-logarithmic-scale/31066997#31066997) might be useful – akrun Sep 10 '17 at 06:44

1 Answers1

2

I was able to do it by using the shinyWidgets library. Basically, create a list of your desired step values and call the sliderTextInput() function.

numlist <- prettyNum(c(1, seq(5000, (floor(428036/5000)*5000), 5000), 428036), big.mark = ",")

slider <- sliderTextInput(
  inputId = "CR_num",
  label = "Please choose how many case reports you would like our tool to analyze.",
  choices = numlist,
  selected ="20,000",
  grid = FALSE, dragRange = FALSE)

Now the only options are the ones you chose:

2

The only hiccup is now the values are strings, so there are a LOT of tick marks. So, I removed them.

rfineman
  • 128
  • 2
  • 9