【问题标题】:R Shiny tabBox title breakR Shiny tabBox 标题中断
【发布时间】:2018-04-12 13:12:01
【问题描述】:

我在使用 R Shiny 仪表板时遇到了一个小问题,希望有人能够帮助我。

以下是我正在开发的一款闪亮应用的摘录。在此页面上,同一行有两个并排的面板,每个面板中有两个选项卡,每个选项卡都有自己的图表。每个面板都有一个一致的标题,括号中的位略有不同。我注意到,当我调整浏览器窗口的大小时(尽管 R shiny 非常好,并且可以动态更改绘图、文本等以适应新大小),稍长的标题会跳到较短标题之前的 tabPanel() 选项下方的行。这会导致两个面板在行中具有不同的高度,并使其看起来有点不整洁。

因此,有没有办法将面板标题拆分为多行?我已经搜索了一段时间,并尝试了“\n”、“\r\n”、“|”等没有运气。或者,如果有其他解决方案,我会很高兴听到它。

感谢您的帮助,如果答案就在那里而我错过了,我们深表歉意!

  fluidRow(
    tabBox(
      title = "Consistent Title (bit in brackets)",
      side = "right",
      tabPanel(
        "Panel title X",
        textOutput("X_total"),
        plotOutput("X"),
        tags$i("All metrics calculated based on blah.")
      ),
      tabPanel(
        "Panel title Y",
        textOutput("Y_mean"),
        plotOutput("Y"),
        tags$i("All metrics calculated based on blah.")
      ), width = 6),
    tabBox(
      title = "Consistent Title (longer bit in brackets)",
      side = "right",
      tabPanel(
        "Panel title A",
        textOutput("A_total"),
        plotOutput("A"),
        tags$i("All metrics calculated based on blah.")
      ),
      tabPanel(
        "Panel title B",
        textOutput("B_total"),
        plotOutput("B"),
        tags$i("All metrics calculated based on blah.")
      ), width = 6)
  )

【问题讨论】:

    标签: r shiny shinydashboard


    【解决方案1】:

    稍作搜索,出现以下页面:

    how to insert new line in R shiny string

    这就是答案。在问题提供的代码中,我们需要将以下内容作为title 函数:

    title = HTML(paste("Consistent title", "(bit in brackets)", sep = "<br/>"))
    

    【讨论】:

      猜你喜欢
      • 2019-01-22
      • 2016-09-24
      • 2019-01-23
      • 2016-07-20
      • 1970-01-01
      • 2019-08-30
      • 1970-01-01
      • 2019-06-06
      • 2019-05-07
      相关资源
      最近更新 更多