【问题标题】:Shiny: spaces between sidebar and "sentence"闪亮:侧边栏和“句子”之间的空格
【发布时间】:2017-10-03 03:32:20
【问题描述】:

所以我刚刚在 Shinyapps 上部署了我的电影推荐,但还有一件事我想改变。请看下面的图片。

由于我不想将“你可能也喜欢这个”放在另一个框中,所以我真的不知道如何将其调整为 html/css 格式。对我来说,它离侧边栏太近了,我只想在它和侧边栏之间留一些空间。

我的代码:

ui <- shinyUI(dashboardPage(skin="blue",

                            dashboardHeader(title = "Movies"),
                            dashboardSidebar(
                              sidebarMenu( 
                                menuItem(
                                  list( 
                                    selectInput("select", label = h5("Select 1 movie you like"),
                                                choices = as.character(movies$title[1:length(unique(movies$movieId))]),
                                                selectize = TRUE,
                                                selected = "Toy Story (1995)"),
                                    submitButton("Done")
                                  )
                                )
                              )
                            ),


                            dashboardBody( 
                              includeCSS("data/custom.css"),
                              fluidRow(
                                box(
                                  width=3,
                                  height=400,
                                  status = "primary", 
                                  title = "introduction",
                                  textOutput("name1"),
                                  #br(),  
                                  imageOutput("myImage",height="300px")
                                  #valueBoxOutput("tableRatings1")

                                ),

                                box(
                                  width=8,
                                  height=400,
                                  status = "primary",
                                  title = "Plot",
                                  textOutput("des1"),
                                  br(),
                                  h4("Ratings"),
                                  br(),
                                  valueBoxOutput("tableRatings1")
                                 )
                               ),

                              fluidRow(
                                h4("You might also like this"),
                                box(
                                  width=2,
                                  height=220,
                                  status = "danger",
                                  imageOutput("myImage1",height="150px"),
                                  textOutput("myreco1")
                                  #textOutput("myrate1")
                                ),
                                box(
                                  width=2,
                                  height=220,
                                  status = "danger",
                                  imageOutput("myImage2",height="150px"),
                                  textOutput("myreco2")
                                  #textOutput("myrate2")
                                ),
                                box(
                                  width=2,
                                  height=220,
                                  status = "danger",
                                  imageOutput("myImage3",height="150px"),
                                  textOutput("myreco3")
                                  #textOutput("myrate3")
                                ),
                                box(
                                  width=2,
                                  height=220,
                                  status = "danger",
                                  imageOutput("myImage4",height="150px"),
                                  textOutput("myreco4")
                                  #textOutput("myrate4")
                                ),
                                box(
                                  width=2,
                                  height=220,
                                  status = "danger",
                                  imageOutput("myImage5",height="150px"),
                                  textOutput("myreco5")
                                  #textOutput("myrate5")
                                )
                              )

                            )

)
)   

顺便说一下,我的shinyapps 现在运行很慢,我不知道为什么。它曾经跑得更快。而这个应用程序目前总共只花费 4 个小时。如果我使用免费计划,每个应用程序都有 25 小时,对吗?

【问题讨论】:

  • 您似乎在使用shinydashboard,您需要确保您的文本包含在fluidRowcolumn 中,而不是单独存在。您应该提供minimal reproducible example,这样我们就不会猜测如何为您提供帮助。
  • @KevinArseneau 嗨!我只是列出它:)
  • 您的代码不可重现。不过,我建议你把你的内容放到一个专栏里……fluidRow(column(width = 2, h4("your text"), box(...)))
  • @KevinArseneau 谢谢!我会试试的:)
  • @amrrs 如果你也使用闪亮的仪表板,ui.R 上的 imageOutput("image") 和 output$image

标签: html r shiny


【解决方案1】:
HTML("<h4>&nbsp; &nbsp; &nbsp; You might also like this</h4>")

【讨论】:

    猜你喜欢
    • 2021-03-13
    • 2018-12-24
    • 2020-09-20
    • 2017-04-23
    • 2019-11-13
    • 2016-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多