shiny conditional panel to hide plots

624 views
Skip to first unread message

Philip Moy

unread,
Mar 3, 2016, 2:43:13 PM3/3/16
to Shiny - Web Framework for R

How do I create a condition where it will hide a plot and push the bottom plot up?

Below in my ui.R I have a conditional panel that plots 3 charts. How do I add a condition to turn on/off value_plot whenever an input is selected and push data_table up the value_plot's spot?

ui.R

 shinyUI(fluidPage(

  sidebarLayout(
    sidebarPanel(uiOutput("year"),
                 conditionalPanel(
                   condition = "input.years != 'Select'",
                   uiOutput("type")
                 ),
                 conditionalPanel(
                   condition = "input.type != 'Select' & input.type != 'OVERVIEW'",
                   uiOutput("agency")
                 ),
                 conditionalPanel(
                   condition = "input.agency != 'Select'",
                   uiOutput("agency_system")
                 )
                 ),
    mainPanel(
      conditionalPanel(
        condition = "input.type != 'OVERVIEW' & input.years != 'Select'",
        plotOutput("volume_plot"),
        br(),
        plotOutput("value_plot"),
        br(),
        dataTableOutput("data_table")
      )
    )
  )
))

Joe Cheng

unread,
Mar 3, 2016, 4:40:42 PM3/3/16
to Philip Moy, Shiny - Web Framework for R
Put another conditionalPanel around the plotOutput? conditionalPanel shouldn't take up any space when its condition is false, I would expect it to work the way you want.

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/39b2c2d4-53ef-4af5-af47-14cddb3de482%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages