光泽:文本框会自动调整为文本大小,而不仅仅是字符串

问题描述 投票:0回答:1

我是新来的,所以请光着身子!

我想创建4个相等的文本框,用于描述上面的照片

ui1 <- (fluidPage(fluidRow(splitLayout(cellWidths = c("25%", "25%", "25%", "25%"), 
                                      tags$img(src = "Photo1.jpg", width = "100%"), 
                                      tags$img(src = "Photo2.jpg", width = "100%"), 
                                      tags$img(src = "Photo3.jpg", width = "100%"),
                                      tags$img(src = "Photo4.jpg", width = "100%"))),
                 fluidRow(splitLayout(cellWidths = c("25%", "25%", "25%", "25%"), 
                                      tags$h5("Photo 1", align = 'center', style = "color:#00A69C"), 
                                      tags$h5("Photo 2", align = 'center', style = "color:#00A69C"), 
                                      tags$h5("Photo 3", align = 'center', style = "color:#00A69C"), 
                                      tags$h5("Photo 4", align = 'center', style = "color:#00A69C"))),
                 fluidRow(splitLayout(cellWidths = c("25%", "25%", "25%", "25%"),
                                      wellPanel(tags$p("Photo 1 is text text text text text text text text text text text text text text text text text text text text")),
                                      wellPanel(tags$p("Photo 2 is text text text text text text text text text text text text text text text text text text text text")), 
                                      wellPanel(tags$p("Photo 3 is text text text text text text text text text text text text text text text text text text text text")), 
                                      wellPanel(tags$p("Photo 4 is text text text text text text text text text text text text text text text text text text text text"))))))


server1 <- (function(input, output){})

shinyApp(ui = ui1, server = server1)

如果我在用户界面中运行此代码,则最后一部分只会得到一串文本,而且我必须使用水平滚动条才能看到其余的文本。我想要的是,我的wellPanel会自动调整为文本的大小,并且不再需要滚动。

有人可以帮我吗?

谢谢!

r string text shiny output
1个回答
0
投票
library(shiny)

ui1 <- (fluidPage(fluidRow(splitLayout(cellWidths = c("25%", "25%", "25%", "25%"), 
                                       tags$img(src = "Photo1.jpg", width = "100%"), 
                                       tags$img(src = "Photo2.jpg", width = "100%"), 
                                       tags$img(src = "Photo3.jpg", width = "100%"),
                                       tags$img(src = "Photo4.jpg", width = "100%"))),
                  fluidRow(splitLayout(cellWidths = c("25%", "25%", "25%", "25%"), 
                                       tags$h5("Photo 1", align = 'center', style = "color:#00A69C"), 
                                       tags$h5("Photo 2", align = 'center', style = "color:#00A69C"), 
                                       tags$h5("Photo 3", align = 'center', style = "color:#00A69C"), 
                                       tags$h5("Photo 4", align = 'center', style = "color:#00A69C"))),
                  fluidRow(
                    column(width = 3,wellPanel(tags$p("Photo 1 is text text text text text text text text text text text text text text text text text text text text"))),
                    column(width = 3,wellPanel(tags$p("Photo 2 is text text text text text text text text text text text text text text text text text text text text"))), 
                    column(width = 3,wellPanel(tags$p("Photo 3 is text text text text text text text text text text text text text text text text text text text text"))), 
                    column(width = 3,wellPanel(tags$p("Photo 4 is text text text text text text text text text text text text text text text text text text text text"))))

                  ))


server1 <- (function(input, output){})

shinyApp(ui = ui1, server = server1)
© www.soinside.com 2019 - 2024. All rights reserved.