我想根据单选按钮的输入值设置滑块的动态最小值和最大值。现在我可以使用renderUI选项执行此操作,我在server.ui中设置了min和max值,并且动态设置了值。
但是当我将动画选项置于无法正常工作的renderUI中时。在我的ui.r中,我有以下代码。
radioButtons("interval", "Time Interval:",
c("Day of the week"="%u","Day of the month" = "%d", "Week of the year" = "%W", "Month of the year" = "%m","Quarter of the year"="quarter","year"="%y"))
,uiOutput("Slider")
在我的server.r中,我设置了如下值。
order$date_of_month<-as.numeric(format(as.Date(order$Date.Ordered), interval))
output$Slider<-renderUI({
sliderInput("date_range", "Date Range", min = 2,
max = max(order$date_of_month), value = max(order$date_of_month)
,step = 1
,animate = animationOptions(loop = TRUE, interval = 5000))
})
radioButtons("interval", "Time Interval:",
c("Day of the week"="%u","Day of the month" = "%d",
"Week of the year" = "%W", "Month of the year" = "%m","Quarter of the year"="quarter","year"="%y"))
,uiOutput("Slider")
答案 0 :(得分:0)
尝试以此替换当前的滑块功能:
input$interval
interval
而非date_of_month
访问输入值。 renderUI
函数内部移动input$interval
的计算,以便对{{1}}中的变化起反应。