每个标签中都有多个标签和不同侧边栏

Saz*_*man 7 tabs r shiny

我正在尝试使用多个选项卡,每个选项卡都有自己的侧边栏,我需要selectInput在第一个选项卡和sliderInput第二个选项卡中.

有人可以帮忙吗?

我的代码:

ui <- fluidPage(

    headerPanel("Terrorism in The World"),
            sidebarPanel(      
                    selectInput("Country", "Select Country", choices = sort(unique(mydat$Country)), selected = "Iraq")
                ,sliderInput("year", "Year:", min = 1968, max = 2009, value = 2009, sep='')
        ),
        mainPanel(

        tabsetPanel(
            tabPanel("Map",htmlOutput("Attacks")),
            tabPanel("plot",
                fluidRow(
                    column(8,  plotlyOutput("trendheatrPlot", height = "300px",width = 700)),
                    column(7, plotlyOutput("trendstakbarPlot", height = "300px",width = 700))   
                )
            )
        )
    )
)
Run Code Online (Sandbox Code Playgroud)

dva*_*las 28

我根据您的描述创建了一个简单的UI模板.我还将列规范从8,7改为7,5,因为闪亮的UI基于12个网格系统.这是代码:

library(shiny)
library(plotly)

shinyApp(
  ui = fluidPage(
    tabsetPanel(
      tabPanel("Map", fluid = TRUE,
               sidebarLayout(
                 sidebarPanel(selectInput("Country", "Select Country", choices = "", selected = "")),
                 mainPanel(
                   htmlOutput("Attacks")
                 )
               )
      ),
      tabPanel("plot", fluid = TRUE,
               sidebarLayout(
                 sidebarPanel(sliderInput("year", "Year:", min = 1968, max = 2009, value = 2009, sep='')),
                 mainPanel(fluidRow(
                   column(7,  plotlyOutput("")),
                   column(5, plotlyOutput(""))   
                 )
                 )
               )
      )
    )
  ), 
  server = function(input, output) {

  }
)
Run Code Online (Sandbox Code Playgroud)

  • @Sazan Abdalrhmam欢迎你.你能否接受答案,以便其他人知道它正在发挥作用.你也可以发布你正在思考的图片,因为我无法想象中间的侧边栏. (3认同)