【问题标题】:Logo appears as a question mark on shiny dashboard徽标在闪亮的仪表板上显示为问号
【发布时间】:2019-05-18 10:51:27
【问题描述】:

我试图在我闪亮的仪表板的右上角添加一个徽标,但它显示为一个问号。我尝试更改徽标的高度和宽度,但它不起作用。当您单击徽标时,它会将您带到一个可以正常工作但无法在仪表板上看到徽标的网站。

我已经参考了以下所有这些文章,但没有一篇可以解决我的问题

Adding a company Logo to ShinyDashboard header

Image not showing in Shiny app R

R shiny - image does not appear

这是我迄今为止编写的仪表板标题代码

library(shiny)
library(shinydashboard)
library(dplyr)
library(ggplot2)
ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody()
)
server <- function(input, output) {}


#Dashboard header carrying the title of the dashboard
header <- dashboardHeader(title="Dashboard"
                          ,tags$li(class = "dropdown",
                                   tags$a(href="https://www.mbm.net.nz/", 
                                          tags$img(height = "20px", src="Ascibe_logo.jpg", width = "200px")
                                   )),

                          dropdownMenu(type = "messages",
                                       messageItem(
                                         from = "Sales Dept",
                                         message = "Sales are steady this month."),
                                       messageItem(
                                         from = "New User",
                                         message = "How do I register?",
                                         icon = icon("question"),
                                         time = "13:45"),
                                       messageItem(
                                         from = "Support",
                                         message = "The new server is ready.",
                                         icon = icon("life-ring"),
                                         time = "2014-12-01")),
                          dropdownMenu(type = "notifications",
                                       notificationItem(
                                         text = "5 new users today",
                                         icon("users")),
                                       notificationItem(
                                         text = "12 items delivered",
                                         icon("truck"),
                                         status = "success"),
                                       notificationItem(
                                         text = "Server load at 86%",
                                         icon = icon("exclamation-triangle"),
                                         status = "warning"
                                       )),
                          dropdownMenu(type = "tasks", badgeStatus = "success",
                                       taskItem(value = 90, color = "green",
                                                "Documentation"
                                       ),
                                       taskItem(value = 17, color = "aqua",
                                                "Project X"
                                       ),
                                       taskItem(value = 75, color = "yellow",
                                                "Server deployment"
                                       ),
                                       taskItem(value = 80, color = "red",
                                                "Overall project")))  

谁能帮我解决这个问题。

提前非常感谢!!

【问题讨论】:

  • 您是否将图像放在工作目录中名为www 的文件夹中?如果没有,请创建一个名为 www 的文件夹并将所有图像粘贴到该文件夹​​中。
  • @msr_003 该建议有所帮助。我按照建议将它们放在 www 文件夹中,并且有效。非常感谢您的帮助

标签: r shiny shinydashboard


【解决方案1】:

希望得到帮助:

library(shiny)
library(shinydashboard)
app <- shinyApp(
ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(
    tags$head(tags$style(HTML('
                              /* navbar (rest of the header) */
                              .skin-blue .main-header .navbar {
                              background-image:url("https://static1.squarespace.com/static/4f32f57f8754b8e18aef1e01/50716878e4b03adec665056f/5081fc0084ae02360227cc7a/1445030506945/your-logo-here-27.png?format=300w");
                              background-position-x: 99%;
                              background-size: 80px 50px;
                              background-repeat: no-repeat;
                              background-color:#000;
                              }'
)))
    )
    ), 
server <- function(input, output) {}
)
runApp(app)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-06
    • 1970-01-01
    • 1970-01-01
    • 2019-05-11
    • 2018-05-18
    • 2023-03-22
    • 1970-01-01
    • 2015-04-22
    相关资源
    最近更新 更多