如何在闪亮的App的infoBox中显示图像?

时间:2018-10-30 09:45:58

标签: r shiny

我正在尝试将图像放入ShinyApp的infoBox中。

我收到此错误:

  

shinyUI(dashboardPage,dashboardHeader(“ ABC”))中的错误,   dashboardBody(fluidPage(h1(“ type”),:未使用的参数   (dashboardHeader(“ ABC”),dashboardBody(fluidPage(h1(“ type”),   mainPanel(tabsetPanel(tabPanel(h1(“ summary”),infoBox(“ BCD”,a,   div(img(src =“ ribbon.PNG”,width = 100),style =“ text-align:   中心;“)))))))))

代码:

library(shiny)
library(shinydashboard)
a  = 45
ui < - shinyUI(dashboardPage,
           dashboardHeader("ABC"),
           dashboardBody(fluidPage(h1("type"),
             mainPanel(
               tabsetPanel(
                 tabPanel(h1("summary"), 
                         infoBox("BCD", a, div(img(src = "ribbon.PNG", 
                         width = 100), style = "text-align: center;"))))))))
server <- shinyServer({})
shinyApp(ui, server)

有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

img.png文件夹中设置图片www,然后下面的代码起作用:

library(shiny)
library(shinydashboard)
a <- 45

ui <-   shinyUI(
    dashboardPage(
        dashboardHeader(title = "ABC"),
        dashboardSidebar(),
        dashboardBody(
            fluidPage(
                infoBox("BCD", a, div(img(src = "img.png", width = 100), style = "text-align: center;"))
            )
        )
    )
)

server <- function(input, output) {}

shinyApp(ui = ui, server = server)