简体   繁体   English

两个选项卡或更多使用 shinydashboard package

[英]two tabs or more using shinydashboard package

can any one build in that below very simple shiny dashboard another tab where we can have other sliderbar, other output.....etc.i am realy confused.任何人都可以在非常简单的 shiny 仪表板下方构建另一个选项卡,我们可以在其中设置其他滑块,其他 output.....等等。我真的很困惑。

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(title="Tab1"),
  dashboardSidebar(    width = 230,
sidebarMenu(
  fileInput("df",
              label="Upload FCM Data"
              ),
  fileInput("dl",
            label="Upload Device AX Data"
  ),
  
  uiOutput('choose_TEC'),
  uiOutput('choose_OP'),
  uiOutput('choose_APL'),
  uiOutput('choose_PRD'),
  uiOutput('choose_DEV'),
  uiOutput('choose_NACol')
)),
  dashboardBody()
)

server <- function(input, output) { }

shinyApp(ui, server)

I created just an example dashboard with two tabs using tabPanel .我使用tabPanel创建了一个带有两个选项卡的示例仪表板。 You can use the following code:您可以使用以下代码:

library(shiny)
library(shinythemes)
library(shinydashboard)

shinyApp(
  ui = navbarPage("Dashboard", theme = shinytheme("flatly"),
                  tabPanel("Tab1",
                           sidebarLayout(
                             sidebarPanel(
                               fileInput("df",
                                         label="Upload FCM Data"
                               ),
                               fileInput("dl",
                                         label="Upload Device AX Data"
                               ),
                               
                               uiOutput('choose_TEC'),
                               uiOutput('choose_OP'),
                               uiOutput('choose_APL'),
                               uiOutput('choose_PRD'),
                               uiOutput('choose_DEV'),
                               uiOutput('choose_NACol')
                             ),
                             mainPanel(
                               h2("text tab 1")
                             )
                           )
                  ),
                  tabPanel("Tab 2",
                           sidebarLayout(
                             sidebarPanel(
                               sliderInput("slider1", label = h3("Slider"), min = 0, 
                                           max = 100, value = 50)
                             ),
                             mainPanel(
                               h2("text tab2")
                             )
                           )
                  )
  ),
  server = function(input, output) { }
)

Output looks like this: Output 看起来像这样:

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM