【发布时间】:2019-12-21 04:54:45
【问题描述】:
我的 menuItems 和 menuSubItems 在单击时不显示。它仅保留在默认仪表板主体上。请注意,这些子项还没有包含任何内容。我希望能够在其中包含任何数据之前打开这些页面。
我从视频 10 开始关注此 YouTube 播放列表中的教程:https://www.youtube.com/playlist?list=PLH6mU1kedUy8c44XiTkGSEKRwojVHtsHm
install.packages(c("shiny","shinydashboard","ggplot2","dplyr"))
August <- dataframe("Revenue" = c(150,275,450,890,212,618),
"Team" = c(blue,blue,green,green,gold,gold))
ui <- shinyUI(
dashboardPage(
dashboardHeader(title = "August 2019"),
dashboardSidebar(
sidebarMenu(
menuItem("Dashboard",tabName = "dashboard"),
menuSubItem("By Team", tabName = "by team"),
menuItem("item2"),
menuItem("Raw Data")
)),
dashboardBody(
tabItems(
tabItem(tabName = "dashboard",
fluidRow(
box(valueBoxOutput("totalrevenue"))
)),
tabItem(tabName = "by team",
h1("Numbers by Team")
),
tabItem(tabName = "by customer",
h2("Numbers by Customer")
)))))
server <- shinyServer(function(input,output){
total.revenue <- sum(August$Revenue)
output$totalrevenue <- renderValueBox({
valueBox(
formatC(total.revenue, format = "d", big.mark = ',')
,paste('Revenue:',total.revenue)
,icon = icon("stats", lib = 'glyphicon')
,color = "blue")
})
})
shinyApp(ui, server)
我只需要能够在仪表板上的页面之间切换。
【问题讨论】:
标签: r shiny shinydashboard