有没有办法显示 dateRangeInput()
的两个输入字段小部件的方式不是并排排列,而是像堆栈一样垂直排列,即 start = <date>
在end = <date>
之上?
我浏览过 shiny
文档,但找不到完成此操作的方法,而且我还不太擅长 CSS/Javascript。
提前致谢。
更新:
为了澄清这一点,这是我的应用程序的一个片段:
app <- shinyApp(
ui = fluidPage(
sidebarLayout(
sidebarPanel(
width = 3,
# --- code based on selectInput() with choices linking to conditional panels ---
tags$div(title = "Request data for a given time period",
conditionalPanel(
condition = "input.outputstyle == 'Density plot (week)'",
dateRangeInput("daterange",
label = "Date Range: ",
start = Sys.Date() - 8,
end = Sys.Date() - 1,
max = Sys.Date(),
format = "d M",
separator = "--"))),
# --- more code for other conditional panels, etc. ---
server = function(input, output) {
# rest of code
}
)
最佳答案
fluidRow(column(width = 12,dateInput("daterange1", "Date range:", start = "2001-01-01")),
column(width = 12,dateInput("daterange2", "Date range:", end = "2017-01-01")))
您可以使用 Shiny 的 dateInput() 小部件来完成此操作。
将宽度更改为 12 可以实现堆叠它的技巧。
关于R:Shiny - 如何重新排列 dateRangeInput() 小部件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46054327/