Ich habe mit ein bisschen ein Hack für diese Arbeit (und ich weiß, Sie nicht für sie fragte, aber hier ist eine anklickbare Logo, während wir gerade dabei sind):
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()
)
Das nistet also einen glänzenden Tag in der Kopfzeile. Der zweite Schlitz in diesem speziellen glänzenden Objekt ist der Logo-Steckplatz (Sie werden in Ihren/www/Ordnern im App-Verzeichnis ein ‚logo.png‘ müssen)
EDIT:
ich gerade überprüft, und als von jetzt, dieser Hack sollte nicht mehr notwendig sein, können Sie die HTML direkt von der DashboardHeader-Funktion über die title=
-Parameter einfügen, (vorher, dieser Parameter wurde nur Durchsetzung von Text),
Ich denke, die Antwort könnte immer noch nützlich sein als eine Methode, um bestehende glänzende Funktionen zu modifizieren, wo Dinge ARE hardcoded in obwohl.
Hier ist das Verfahren jetzt:
dashboardPage(
dashboardHeader(title = tags$a(href='http://mycompanyishere.com',
tags$img(src='logo.png')))
oder, ein wenig mehr Magie zum Logo hinzufügen (ich auch mein Logo als Ladeleiste):
# 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()
)
Diese helfen könnte. http://stackoverflow.com/questions/21996887/embdding-image-in-shiny-app – Shiva