I am trying to have multiple tabs, each tab with its own sidebar, I need selectInput
in the first tab, and sliderInput
in the second tab.
Can anyone help ?
My code:
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))
)
)
)
)
)
I made a simple UI template you can use based on your description. I also changed your column specification from 8,7 to 7,5 because shiny UI is based on 12 grid system. Here is the code:
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) {
}
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With