Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
B_嵌入_popover,带反光板_R_Shiny_Shinydashboard - Fatal编程技术网

B_嵌入_popover,带反光板

B_嵌入_popover,带反光板,r,shiny,shinydashboard,R,Shiny,Shinydashboard,我在使用bsplus与shinydashboard的popover时遇到问题,因为文本未显示,并且位于标题面板后面 library(shiny) library(bsplus) library(htmltools) library(shinydashboard) # UI ui <- dashboardPage( dashboardHeader(title = "Title"), dashboardSidebar( use_bs_popover(),

我在使用
bsplus
shinydashboard
的popover时遇到问题,因为文本未显示,并且位于标题面板后面

library(shiny)
library(bsplus)
library(htmltools)
library(shinydashboard)

# UI
ui <-   
  dashboardPage(
    dashboardHeader(title = "Title"),
    dashboardSidebar(
      use_bs_popover(),
        selectInput(
          inputId = "letter",
          label = "Label with popover help",
          choices = c("a", "b", "c")
        ) %>%
        shinyInput_label_embed(
          shiny_iconlink() %>%
            bs_embed_popover(
              title = "Letter", content = "Choose a favorite", placement ="right"
            )
        )
    ),
    dashboardBody(
    )
)

# Server
server <- shinyServer(function(input, output) {    
})

# Run the applicationenter image description here
shinyApp(ui = ui, server = server)
库(闪亮)
图书馆(bsplus)
图书馆(htmltools)
图书馆(shinydashboard)
#用户界面
ui%
shinyInput_标签_嵌入(
闪亮的图标链接()%>%
bs_嵌入_popover(
title=“Letter”,content=“选择收藏夹”,placement=“right”
)
)
),
仪表板主体(
)
)
#服务器

服务器我在shinydashboard上也尝试过同样的方法,使用fluidpage(),效果非常好。 我使用BSPover和bsButton函数对ShinyBS库进行了相同的尝试。 这可能会解决你的目的。 这是代码

library(shiny)
library(bsplus)
library(htmltools)
library(shinyBS)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(
    selectInput(
      inputId = "letter",
      label = "Label with popover help",
      choices = c("a", "b", "c")
    )%>%shinyInput_label_embed(
      shiny_iconlink() %>%
        bs_embed_popover(title = "Number", content = "Demo Description", placement ="left")
    ),
    use_bs_popover(),
    selectInput(
      inputId = "letter",
      label = h5("Label with popover help ",
                 tags$style(type = "text/css", "#q1 {float: right;}"),
                 bsButton("q1", label = "", icon = icon("question"), style = "info", size = "extra-small")),
      choices = c("a", "b", "c")),
    bsPopover(id = "q1", title = "Demo data",
              content = paste0("Demo Description "
              ),
              placement = "right", 
              trigger = "focus", 
              options = list(container = "body")
    )
      ),
    dashboardBody()
  )

  server <- shinyServer(function(input, output) {

  })

  shinyApp(ui = ui, server = server)
库(闪亮)
图书馆(bsplus)
图书馆(htmltools)
图书馆(shinyBS)
图书馆(shinydashboard)
用户界面%shinyInput\u标签\u嵌入(
闪亮的图标链接()%>%
bs_embed_popover(title=“Number”,content=“Demo Description”,placement=“left”)
),
使用_bs_popover(),
选择输入(
inputId=“字母”,
label=h5(“带有popover帮助的标签”,
标记$style(type=“text/css”,“#q1{float:right;}”),
bsButton(“q1”,label=”,icon=icon(“问题”),style=“info”,size=“extra-small”),
选项=c(“a”、“b”、“c”),
bspover(id=“q1”,title=“演示数据”,
内容=粘贴0(“演示说明”
),
placement=“right”,
trigger=“focus”,
选项=列表(container=“body”)
)
),
仪表板主体()
)

服务器由于某些原因,文本显示为白色(您可以尝试突出显示文本内容,它会自动显示)。所以它不是隐藏的,您可以使用CSS修复它:

.popover-title {color:black;}
.popover-content {color:black;}
第二个问题与以下事实有关:由于每个元素的
z-index
,弹出框显示在导航栏下。问题是popover嵌套在侧栏中,侧栏中有一个带有数值的
z-index
,因此,即使popover的
z-index
大于标题的
z-index
,它仍将保留在标题下。要使其工作,只需将侧栏的
z-index
设置为
auto

.main-sidebar {z-index:auto}
总而言之,您可以使用以下几行代码使您的闪亮应用程序按需要运行:

dashboardBody(tags$style(HTML('.popover-title {color:black;}
                               .popover-content {color:black;}
                               .main-sidebar {z-index:auto;}'))
)

完美的谢谢