r - Shiny 的应用程序中选项卡名称之间没有空格

标签 r shiny shinyapps

我已经创建了一个 Shiny 的应用程序,并且我渲染到 UI 的选项卡之间没有额外的间距。我正在使用 bs4dash Shiny 的 UI 框架。这个问题和这个框架有关吗?

enter image description here

code :

tabsetPanel(type = "tabs",
                          tabPanel(title = "abc", 

                                   rHandsontableOutput("contentsl"),tags$style(type="text/css", "#contentsl th {font-weight:bold;}")),
                          tabPanel(title = "fgh",
                                   rHandsontableOutput("content1"),tags$style(type="text/css", "#content1 th {font-weight:bold;}")),
                          tabPanel(title = "hjk",
                                   rHandsontableOutput("content2"),tags$style(type="text/css", "#content2 th {font-weight:bold;}")),
                          tabPanel(title="pqr",rHandsontableOutput("prem"),tags$style(type="text/css", "#prem th {font-weight:bold;}")),
                          tabPanel(title="Scatter Plot View",plotlyOutput("pl9",width = "100%",height = "600px")),
                          tabPanel(title = "Box Plot View",plotlyOutput("pl8",width = "100%",height = "600px")),
                          tabPanel(title = "Plot Data",rHandsontableOutput("pl.data",width = "100%",height = "100%"),tags$style(type="text/css","#pl.data th {font-weight:bold;}"))
                          ))

最佳答案

如果我在基本的 Shiny 应用程序(自动创建)中实现你的代码,它对我来说效果很好。这是代码(这并不是真正的答案,但它不适合评论,所以如果它没用,我将删除它):

#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
#    http://shiny.rstudio.com/
#

library(shiny)
library(rhandsontable)
library(plotly)

# Define UI for application that draws a histogram
ui <- fluidPage(

    # Application title
    titlePanel("Old Faithful Geyser Data"),

    # Sidebar with a slider input for number of bins 
    sidebarLayout(
        sidebarPanel(
            sliderInput("bins",
                        "Number of bins:",
                        min = 1,
                        max = 50,
                        value = 30)
        ),

        # Show a plot of the generated distribution
        mainPanel(
            tabsetPanel(
                type = "tabs",
                tabPanel(
                    title = "abc",

                    rHandsontableOutput("contentsl"),
                    tags$style(type = "text/css", "#contentsl th {font-weight:bold;}")
                ),
                tabPanel(
                    title = "fgh",
                    rHandsontableOutput("content1"),
                    tags$style(type = "text/css", "#content1 th {font-weight:bold;}")
                ),
                tabPanel(
                    title = "hjk",
                    rHandsontableOutput("content2"),
                    tags$style(type = "text/css", "#content2 th {font-weight:bold;}")
                ),
                tabPanel(
                    title = "pqr",
                    rHandsontableOutput("prem"),
                    tags$style(type = "text/css", "#prem th {font-weight:bold;}")
                ),
                tabPanel(title = "Scatter Plot View", plotlyOutput(
                    "pl9", width = "100%", height = "600px"
                )),
                tabPanel(title = "Box Plot View", plotlyOutput(
                    "pl8", width = "100%", height = "600px"
                )),
                tabPanel(
                    title = "Plot Data",
                    rHandsontableOutput("pl.data", width = "100%", height = "100%"),
                    tags$style(type = "text/css", "#pl.data th {font-weight:bold;}")
                )
            )
        )
        )
    )


# Define server logic required to draw a histogram
server <- function(input, output) {

    output$distPlot <- renderPlot({
        # generate bins based on input$bins from ui.R
        x    <- faithful[, 2]
        bins <- seq(min(x), max(x), length.out = input$bins + 1)

        # draw the histogram with the specified number of bins
        hist(x, breaks = bins, col = 'darkgray', border = 'white')
    })
}

# Run the application 
shinyApp(ui = ui, server = server)

关于r - Shiny 的应用程序中选项卡名称之间没有空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58918650/

相关文章:

r - 如何在 Shiny 中提取和保存 visNetwork 操作更改?

r - 列出序列的所有突变(DNA)

r - 使用 R Shiny 将(多个)值添加到数据框

javascript - checkboxGroupInput 包含每个刻度的选项(多个可能的刻度)

r - R Bookdown 中目录的位置

读取带有变量行的 CSV 以跳过、批量

r - SliderInput in Shiny -- 如何控制 Shiny slider 的长度/宽度?

r - 单击多边形并将更新selectinput() -(使用传单R)

shinyapps - 如何使用shinyapps.io 中的blastula 发送电子邮件?

r - 在 Shiny DT 数据表中使用空格(不是管道)批量搜索正则表达式