[英]Custom icon on infoBox shinydashboard
Is there a way to use a custom icon on infoBox
on shinydashboard
.有没有办法在infoBox
的shinydashboard
上使用自定义图标。 I am trying to use the example on hrbrmstr gist but it I can not find the place to update the infoBox
function.我正在尝试使用hrbrmstr gist上的示例,但我找不到更新infoBox
function 的位置。
library(shiny)
ui <- dashboardPage(
dashboardHeader(title = "Dynamic boxes"),
dashboardSidebar(),
dashboardBody(
fluidRow(
box(width = 2, actionButton("count", "Count")),
infoBoxOutput("ibox"),
valueBoxOutput("vbox")
)
)
)
server <- function(input, output) {
output$ibox <- renderInfoBox({
infoBox(
"Title",
input$count,
#icon = icon("credit-card")
icon=icon(list(src=x, width="80px"), lib="local")
)
})
output$vbox <- renderValueBox({
valueBox(
"Title",
input$count,
icon = icon("credit-card")
)
})
}
shinyApp(ui, server)
I used the apputils
package from leonawicz .我使用了apputils
的 apputils package 。 I replaced the infoBox
function with the apputils::infoBox
.我用apputils::infoBox
替换了infoBox
function 。
library(shiny)
library(apputils)
#exApp("icons")
ui <- dashboardPage(
dashboardHeader(title = "Dynamic boxes"),
dashboardSidebar(),
dashboardBody(
fluidRow(
box(width = 2, actionButton("count", "Count")),
infoBoxOutput("ibox"),
valueBoxOutput("vbox")
)
)
)
server <- function(input, output) {
output$ibox <- renderInfoBox({
ic <- apputils::icon(list(src = "https://cdn1.iconfinder.com/data/icons/money-47/512/Money_Currency_Finance-41-512.png", width = "80px"), lib = "local")
apputils::infoBox(
"Title",
input$count,
icon = ic
#icon = icon("credit-card")
#icon=icon(list(src=x, width="80px"), lib="local")
)
})
output$vbox <- renderValueBox({
valueBox(
"Title",
input$count,
icon = icon("credit-card")
)
})
}
shinyApp(ui, server)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.