我的R闪亮滑块输入有问题。 “圆形功能”无效,您可以在in this picture中看到。我做错了吗?
sliderInput("Er", "Choose expected return (in percent)",
min = min, max = max, value = min , round = -1,
sep = "" , post = "%", ticks = FALSE
)
答案 0 :(得分:5)
您必须为.scrollTest {
height: 2000px;
background: -moz-linear-gradient(top, #a90329 0%, #8f0222 44%, #6d0019 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, #a90329 0%,#8f0222 44%,#6d0019 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, #a90329 0%,#8f0222 44%,#6d0019 100%);
}
* {
box-sizing: border-box;
padding: 0;
margin: 0; }
html, body {
width: 100%;
height: 100%; }
header nav #logo {
width: 140px;
position: absolute;
top: 15px; }
nav {
position: fixed;
background-color: #242628;
height: 70px;
padding-left: 20px;
width: 100%;
}
nav ul {
position: absolute;
height: 100%;
margin: auto;
top: 0;
bottom: 0;
width: 800px;
padding-left: 200px; }
nav ul li {
-moz-transition: all 0.2s linear;
-webkit-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
transition: all 0.2s linear;
display: inline-block;
height: inherit;
width: 100px;
border-right: 1px solid gray; }
nav ul li:hover {
background-color: rgba(12, 240, 255, 0.3); }
nav ul li a {
color: white;
text-decoration: none;
position: absolute;
height: inherit;
width: inherit;
text-align: center;
padding-top: 25px; }
指定一个step
:
round
否则,正如@Ryan Morton评论的那样,如果您对library(shiny)
min_Er <- 20.31
max_Er <- 23.59
shinyApp( ui = fluidPage(sliderInput("Er1", "Rounding doesn't work",
round = -2, step = NULL,
min = min_Er,
max = max_Er,
value = min_Er,
sep = "" , post = "%", ticks = FALSE),
sliderInput("Er2", "Rounding works",
round = -2, step = 0.01,
min = min_Er,
max = max_Er,
value = min_Er,
sep = "" , post = "%", ticks = FALSE)
), server=function(input, output, session){
observe(print(input$Er1))
observe(print(input$Er2))
})
和min
使用整数,max
即使round
也会有效:
step = NULL