【发布时间】:2020-08-28 19:21:03
【问题描述】:
我想创建一个可钻取的图形,链接到我闪亮应用程序中的其他地方。
library(tidyverse)
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title="My Fitness Dashboard",titleWidth =400),
####sidebar#####
dashboardSidebar(width = 240,
sidebarMenu(startExpanded = TRUE,
br(),
br(),
br(),
menuItem(text = 'Overview',
tabName = "fitDash"),
menuItem(text = 'Floors',
tabName = "floors")
)), #close dashboardSidebar
dashboardBody(
tabItems(
tabItem(tabName = 'fitDash',
uiOutput("dashboard"),
), #close tabItem
tabItem(tabName = 'floorsUp',
fluidRow(
column(width = 10,
box(width = 12,
textOutput('floorsClimbed') #plot comments
) #close box
) #close column
) #close fluidRow
) #close tabItem
) #close tabItems
) #close dashboardBody
) #close dashboardPage
###### Server logic required to draw plots####
server <- function(input, output, session) {
output$dashboard <- renderUI({
tags$map(name="fitMap",
tags$area(shape ="rect", coords="130,250,240,150", alt="floors", href="https://www.w3schools.com"),
#tags$area(shape ="rect", coords="130,250,240,150", alt="floors", href="/floorsClimbed"),
tags$img(src = 'fitbit1.jpg', alt = 'System Indicators', usemap = '#fitMap')
) #close tags$map
})
output$floorsClimbed <- renderText({
"I walked up 12 floors today!"
})
} #close server function
# Run the application
shinyApp(ui = ui, server = server)
以下行完美地链接到外部网站:
tags$area(shape ="rect", coords="130,250,240,150", alt="floors", href="https://www.w3schools.com")
但是,我实际上想在内部链接到“floorsUp”选项卡,如下所示:
tags$area(shape ="rect", coords="130,250,240,150", alt="floors", href="/floorsUp")
【问题讨论】:
标签: html r shiny anchor relative-url