私はこれのためにちょっとしたハックに取り組んできました (そして、あなたがそれを求めていないことは知っていますが、私たちがそれをしている間、ここにクリック可能なロゴがあります):
library(shiny)
library(shinydashboard)
dbHeader <- dashboardHeader()
dbHeader$children[[2]]$children <- tags$a(href='http://mycompanyishere.com',
tags$img(src='logo.png',height='60',width='200'))
dashboardPage(
dbHeader,
dashboardSidebar(),
dashboardBody()
)
したがって、これは、ヘッダー内に Shiny.tag をネストします。この特定の光沢のあるオブジェクトの 2 番目のスロットはロゴ スロットです (アプリ ディレクトリの /www/ フォルダーに「logo.png」が必要です)。
編集:
確認したところ、現時点では、このハックは不要になっているはずです。title=
パラメーターを介して、dashboardHeader 関数から直接 html を挿入できます (以前は、そのパラメーターはテキストのみを強制していました)。
ただし、ハードコードされている既存の光沢のある関数を変更する方法として、答えはまだ役立つかもしれないと思います。
これが今の方法です:
dashboardPage(
dashboardHeader(title = tags$a(href='http://mycompanyishere.com',
tags$img(src='logo.png')))
または、ロゴにもう少し魔法を追加します (私は自分のロゴを読み込みバーとしても使用しています):
# Takes a location 'href', an image location 'src', a loading gif 'loadingsrc'
# height, width and alt text, and produces a loading logo that activates while
# Shiny is busy
loadingLogo <- function(href, src, loadingsrc, height = NULL, width = NULL, alt = NULL) {
tagList(
tags$head(
tags$script(
"setInterval(function(){
if ($('html').attr('class')=='shiny-busy') {
$('div.busy').show();
$('div.notbusy').hide();
} else {
$('div.busy').hide();
$('div.notbusy').show();
}
},100)")
),
tags$a(href=href,
div(class = "busy",
img(src=loadingsrc,height = height, width = width, alt = alt)),
div(class = 'notbusy',
img(src = src, height = height, width = width, alt = alt))
)
)
}
dashboardBody(
dashboardHeader(title = loadingLogo('http://mycompanyishere.com',
'logo.png',
'loader.gif'),
dashboardSidebar(),
dashboardBody()
)