我对R Shiny仪表板存在轻微问题,希望有人能帮助我。
以下是我正在处理的其中一个闪亮应用的摘录。在这个页面上,同一行并排有两个面板,每个面板上有两个标签,每个标签都有自己的图形。每个面板都有一致的标题,括号中的位略有不同。我注意到,当我调整浏览器窗口的大小时(尽管R闪亮非常好并且动态地更改了图表,文本等以适应新的大小),稍长的标题会跳转到tabPanel()
选项下方的行之前。标题。这导致两个面板在行中具有不同的高度,使其看起来有些不整洁。
因此,有没有办法将面板标题分成多行?我已经搜索了一段时间,并尝试了#34; \ 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)
)
答案 0 :(得分:0)
一些搜索导致了以下页面:
how to insert new line in R shiny string
这就是答案。在问题中提供的代码中,我们需要将以下内容作为title
函数:
title = HTML(paste("Consistent title", "(bit in brackets)", sep = "<br/>"))