RYO*_* Hu 4 css shinydashboard
我试着参考下面的答案,但徽标位于主面板内但不是标题面板......任何解决方案?
我看到随机变量的分布在主面板的标题内有一个徽标,但无法在shinyDashboard标题中工作.以下是公司徽标标题的编码:
headerPanel(
HTML('Distributions of Random Variables v4
<a href="http://snap.uaf.edu" target="_blank"><img align="right" alt="SNAP Logo" src="./img/SNAP_acronym_100px.png" /></a>'
), "Distributions of Random Variables"
),
Run Code Online (Sandbox Code Playgroud)
下面是我添加公司徽标的编码,源代码在这里.任何的想法?
dbHeader <- dashboardHeader(title = 'Reporting Dashboard',
dropdownMenuOutput('messageMenu'),
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')))
dbHeader$children$children <- HTML("<a href='http://www.scibrokes.com' target='_blank'>
<img align='right' alt='Logo' src='./oda-army.jpg'/></a>")
Run Code Online (Sandbox Code Playgroud)
K. *_*hde 11
解决方案是隐藏你的图像,这样shiny渲染它就像渲染正常的dropdownMenu项目一样.
正如您可能从控制台看到的那样,dashboardHeader抛出错误
Error in FUN(X[[i]], ...) : Expected tag to be of type li
Run Code Online (Sandbox Code Playgroud)
如果您尝试插入任何自定义HTML.如果你选择一个li标签,它甚至会详细说明
Error in FUN(X[[i]], ...) : Expected tag to have class 'dropdown'
Run Code Online (Sandbox Code Playgroud)
所以这是你的交易,在li课程的包装中添加你的形象dropdown,你很高兴.
示例代码:
library(shinydashboard)
library(shiny)
runApp(
shinyApp(
ui = shinyUI(
dashboardPage(
dashboardHeader(title = 'Reporting Dashboard',
tags$li(class = "dropdown",
tags$a(href="http://snap.uaf.edu", target="_blank",
tags$img(height = "20px", alt="SNAP Logo", src="https://www.snap.uaf.edu/sites/default/files/pictures/snap_symbol_color.png")
)
),
dropdownMenuOutput('messageMenu'),
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'))
),
dashboardSidebar(),
dashboardBody()
)
),
server = function(input, output){}
), launch.browser = TRUE
)
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助!
| 归档时间: |
|
| 查看次数: |
6321 次 |
| 最近记录: |