Tar*_*Jae 3 html r shiny shinydashboard bs4dash
拥有这个基本的闪亮应用程序:我想将我的标题放置在标题中,如下图红色所示:
已经有一些解决方案 在闪亮的仪表板标题右侧添加文本 ,但我想知道是否有更“直接”的方法?
@matrixloading 的解决方案很有吸引力,但并不令人满意,因为文本前面有一个点:
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "Basic dashboard"),
dashboardSidebar(),
dashboardBody(
# Boxes need to be put in a row (or column)
fluidRow(
box(plotOutput("plot1", height = 250)),
box(
title = "Controls",
sliderInput("slider", "Number of observations:", 1, 100, 50)
)
)
)
)
server <- function(input, output) {
set.seed(122)
histdata <- rnorm(500)
output$plot1 <- renderPlot({
data <- histdata[seq_len(input$slider)]
hist(data)
})
}
shinyApp(ui, server)
Run Code Online (Sandbox Code Playgroud)
我们可以在 的 de nav 元素内附加一个子元素dashboardHeader。
dashboardHeader(title = "Basic dashboard") |>
tagAppendChild(
div(
"This is My Title",
style = "
display: block;
font-size: 1.5em;
margin-block-start: 0.5em;
font-weight: bold;
color: darkred;
margin-right: 50%",
align = "right"
),
.cssSelector = "nav"
)
Run Code Online (Sandbox Code Playgroud)