2016-07-25 7 views
1

私は、ウェブサイトへの画像出力のハイパーリンクを作成しようとしているが、私は、スタックオーバーフロー上の他の質問を熟読したトラブルを抱えていますはRシャイニーヘッダーに画像ハイパーリンクを作成

svg with clickable links in shiny - not clickable

http://www.invisiblecompany.com/shiny%20parts/archives/2004/11/clickable-logo.php

http://www.leahkalamakis.com/add-an-image-to-your-sidebar-make-it-clickable/

タグが

SEを働いていません

library(shiny) 



ui <- shinyUI(pageWithSidebar(
titlePanel(imageOutput("image1")), 

sidebarPanel(
    helpText( a("Click Here for the Source Code on Github!",   href="https://github.com/Bohdan-Khomtchouk/Microscope",target="_blank")) 

), 
mainPanel(
tabsetPanel(


    tabPanel("Instructions",textOutput("text1")) 
)) 
)) 

ui.r rver.r

library(shiny) 
library(png) 


server <- shinyServer(function(input, output) { 

output$image1 <- renderImage({ 
    width<- "100%" 
    height<- "100%" 
list(src = "www/logo.png", 
    contentType = "image/png", 
    width = width, 
    height = height, 
) 

}, deleteFile = FALSE) 
output$text1 <- renderText({ "please help make the image hyperlinked"  }) 


}) 

あなたは、私は、ハイパーリンクは、サーバーのリストに入ると思います好きでlogo.pngを置き換えることができます。

+1

に関する動的な何もない場合HTMLビルダ機能を使用するだけです: 'a(img(src =" logo.png ")、href =" https://github.com/Bohdan-Khomtchouk/Microscope ")' – alistaire

答えて

3

ちょうどそうUIにtags$aimageOutputをラップ:

titlePanel(tags$a(imageOutput("image1"),href="https://www.google.com")) 

あなたは、あなたがこのような何かを必要とするサーバ側からWebページを定義する場合:

#server 
    output$example <- renderUI({ 
    tags$a(imageOutput("image1"),href="https://www.google.com") 
    }) 
#UI 
titlePanel(uiOutput("example")) 
関連する問題