首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >infoBox标牌上的自定义图标仪表板

infoBox标牌上的自定义图标仪表板
EN

Stack Overflow用户
提问于 2019-10-16 00:19:40
回答 1查看 1.3K关注 0票数 3

有没有办法在shinydashboardinfoBox上使用自定义图标?我试着在hrbrmstr gist上使用这个例子,但是我找不到更新infoBox函数的地方。

代码语言:javascript
复制
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)
EN

回答 1

Stack Overflow用户

发布于 2019-10-25 01:15:05

我使用的是来自leonawiczapputils包。我用apputils::infoBox替换了infoBox函数。

代码语言:javascript
复制
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)
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58398925

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档