gpt4 book ai didi

删除特定 tabPanel 的侧边栏面板

转载 作者:行者123 更新时间:2023-12-04 11:46:35 28 4
gpt4 key购买 nike

我正在使用 Shiny 的 R 网络应用程序,该应用程序由主面板左侧的侧栏面板(带有 2 个 tabspanel)和下方的另一个侧栏面板组成。
我想为第一个主面板保留底部侧边栏面板,但为第二个主面板将其移除。
代码如下:

  sidebarPanel(

wellPanel(

fileInput('file1', 'Choisissez les data service ?',
accept = c('text/csv', 'text/comma-separated-values',
'text/tab-separated-values', 'text/plain',
'.csv', '.tsv', 'RData'
)
)


),


wellPanel(

selectInput(inputId = "fonction.de",
label = "En fonction de ?",
choices = fonctions.de,
selected = "perimetre_commercial_estime"
),


selectInput(inputId = "perimetre",
label = "Perimetres commercial",
choices = perimetres,
selected = "2-HDM MARCHAND",
multiple = TRUE
),

checkboxInput(inputId = "case1", label = "Tous perimetres", value = FALSE),


selectInput(inputId = "ae",
label = "AE",
choices = aes,
selected = "AE Paris",
multiple = TRUE
),

checkboxInput(inputId = "case2", label = "Tous AE", value = FALSE),


selectInput(inputId = "segment",
label = "Segment commercial",
choices = segments,
selected = "Premium",
multiple = TRUE
),

checkboxInput(inputId = "case3", label = "Tous segments", value = FALSE)





)
),

mainPanel(

tabsetPanel(type = "tabs",
tabPanel("Graphiques",
plotlyOutput("my.chart")),
tabPanel("Tables",
dataTableOutput("my.table"),
htmlOutput("my.text1"))

)
),

sidebarPanel(

selectInput(inputId = "abscisse",
label = "Abscisse",
choices = abscisses,
selected = "",
multiple = FALSE
),


selectInput(inputId = "ordonnee",
label = "Ordonnee",
choices = ordonnees,
selected = "",
multiple = FALSE
)

),


sidebarPanel(
img(src="Dymetryyy.jpg", height = 150, width = 350)
)


)
)

最佳答案

对于面临同样问题的人,您必须使用 conditionalPanel 来解决它。

  mainPanel(

tabsetPanel(id = "bab",
type = "tabs",
tabPanel(value = "graphiques",
"Graphiques",
plotlyOutput("my.chart")),
tabPanel(value = "tables",
"Tables",
dataTableOutput("my.table"),
htmlOutput("my.text1"))

)
),

conditionalPanel(condition = "input.bab == 'graphiques'",
sidebarPanel(

selectInput(inputId = "abscisse",
label = "Abscisse",
choices = abscisses,
selected = "",
multiple = FALSE
),


selectInput(inputId = "ordonnee",
label = "Ordonnee",
choices = ordonnees,
selected = "",
multiple = FALSE
)

),


sidebarPanel(
img(src="dymetryyy", height = 150, width = 350)
)

)

关于删除特定 tabPanel 的侧边栏面板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37277983/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com