0
我构建了一个闪亮的应用程序,告诉您剩余多少天,直到您的生日。但在视觉上,我想文本是在一排,而它是目前这样的: 更改闪亮应用程序的布局
我想这应该很容易,但我是新的闪亮,并没有真正得到它。 这是我的代码: 库(闪亮)
ui <- (shinyUI(fluidPage(
sidebarPanel(
strong("Wann wurdest du geboren?"),
selectInput("a1",label="Tag", choices=(c(1:31))),
selectInput("a2",label="Monat", choices=(c(1:12))),
selectInput("a3",label="Jahr", choices=(c(1940:year(Sys.time())))),
mainPanel(
verbatimTextOutput('a_out'),
# UI output
uiOutput("b1")
)
))))
server <- shinyServer(function(input, output) {
data <- reactive({
Geburtsdatum <- paste0(input$a1,".", input$a2, ".", input$a3)
Uhrzeit <- "00:00:01"
Geb <- paste(Geburtsdatum, Uhrzeit)
geburt <- strptime(c(Geb), format = "%d.%m.%Y %H:%M:%S", tz = "CET")
geburtstag <- geburt
year(geburtstag) <- year(Sys.time())
gebu <- geburtstag - Sys.time()
if(gebu < 0){year(geburtstag) <- year(Sys.time())+1}
gebu <- geburtstag - Sys.time()
Alter <- ceiling((Sys.time() - geburt)/365)
runden <- function(Wert){
trunc(Wert)
}
decimalpl <- function(Wert){
Wert-trunc(Wert)
}
list(a = (trunc(gebu)),
b = (runden(decimalpl(gebu)*24)),
c = (runden(decimalpl(decimalpl(gebu)*24)*60)),
d = (runden(decimalpl(decimalpl(decimalpl(gebu)*24)*60)*60)),
e = (paste(Alter,".", sep="")))
})
output$b1 <- renderUI({
strong(paste("Noch", data()$a, "Tage,",
data()$b, "Stunden,",
data()$c, "Minuten, und",
data()$d, "Sekunden bis zu deinem",
data()$e, "Geburtstag!"))
})
})
shinyApp(ui = ui, server = server)
真的谢谢了! 上限:我可以赞美backgorund和文本吗?或者包含一张图片?
错误的括号;而不是selectInput(“a3”,label =“Jahr”,choices =(c(1940:year(Sys.time())))),mainPanel(verbatimTextOutput('a_out'),uiOutput(“b1”))尝试使用selectInput(“a3”,label =“Jahr”,choices =(c(1940:year(Sys.time()))))),mainPanel(verbatimTextOutput('a_out'),uiOutput(“b1”)) – MLavoie
非常感谢! –