r - 如何在 Shiny 中的文本旁边插入信息图标?
问题描述
如何在右侧插入一个绿色信息图标,上面写着“选择最佳数量的垃圾箱”。你能帮助我吗?
我真的很感激帮助!
我在下面插入一个可执行代码:
library(shiny)
library(shinythemes)
ui <- fluidPage(
titlePanel("Old Faithful Geyser Data"),
sidebarLayout(
sidebarPanel(h4("Select the best the number of bins"),
br(),
br(),
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
mainPanel(
plotOutput("distPlot")
)
)
)
server <- function(input, output) {
output$distPlot <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
shinyApp(ui = ui, server = server)
解决方案
只需icon
在h4
. 要更改颜色,您可以使用style = "color: green"
.
library(shiny)
ui <- fluidPage(
titlePanel("Old Faithful Geyser Data"),
sidebarLayout(
sidebarPanel(h4("Select the best the number of bins",
icon("info", style = "color: green")),
br(),
br(),
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
mainPanel(
plotOutput("distPlot")
)
)
)
server <- function(input, output) {
output$distPlot <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
shinyApp(ui = ui, server = server)
推荐阅读
- c# - DevExpress BlazorServer DataGrid LayoutChanged 事件在刷新后不会触发
- android-studio - 无法确定 Android SDK
- flutter - 如何在 Flutter 中显示指数字符串?
- docker - Docker Not pulling images from the Docker Hub on Mac OS
- python - 在使用 Sphinx 构建文档结束时记录日志
- multilabel-classification - 如何在 mlr 中使用调整参数进行多标签分类?
- sql-server - Power Apps Dataflow 从 Azure SQL 到 Dataverse 的持续时间真的很慢而且错误消息很糟糕吗?
- c# - 为什么我更新数据库后我的数据网格没有更新?
- visual-studio-code - 使用虚拟环境时,vscode 内部人员中的 sys.path 行为不等同于 jupyter lab
- apache-spark - net.snowflake.client.jdbc.SnowflakeSQLException:SQL 访问控制错误:权限不足,无法对架构“PUBLIC”进行操作