【问题标题】:How can I make the main panel in shiny occupy the entire width of the screen如何使闪亮的主面板占据屏幕的整个宽度
【发布时间】:2021-04-25 21:55:38
【问题描述】:

我正在制作一个闪亮的应用程序,我希望主面板占据 100% 的屏幕,我该如何实现?在这种情况下,我展示了一个表格,但我还想添加一个图表,以便可以看到它很大。

下面是我正在使用的代码

screen shiny

library(shiny)
library(DT)

shinyUI(fluidPage(
    
    # Application title
    titlePanel("Company-Feature Chart"),
    
    
    
    mainPanel(
        uiOutput("seleccione_col1"),
        uiOutput("seleccione_col2"),
        DT::dataTableOutput(outputId =
                                "diagram")
    )
)
)



shinyServer(function(input, output) {
    
    datachart <- read.csv("examplechart1.csv", row.names=1, sep=";")
    
    output$seleccione_col1<- renderUI({
         selectInput(inputId="columnaD", (("Product")), 
                    choices  =names(datachart),
                    selected = names(datachart)[c(1,2)],multiple = TRUE)
    })
    
    output$seleccione_col2<- renderUI({
        
        
        selectInput(inputId="columnaE", (("Features")), 
                    choices  =row.names(datachart),
                    selected = row.names(datachart)[1],multiple = TRUE)
    })
    
 
    output$diagram<- renderDataTable({
        req(input$columnaE)
        
        data  <-datachart[input$columnaE,input$columnaD]

        DT::datatable(data, escape = FALSE,options = list(sDom  = '<"top">lrt<"bottom">ip',lengthChange = FALSE))
    },  rownames = TRUE)
    
})

【问题讨论】:

    标签: r shiny dt


    【解决方案1】:

    使用width 选项:

    mainPanel(
        uiOutput("seleccione_col1"),
        uiOutput("seleccione_col2"),
        DT::dataTableOutput(outputId = "diagram"),
        width = 12
    )
    

    【讨论】:

    • 非常感谢,成功了,我已经学会控制布局了
    猜你喜欢
    • 1970-01-01
    • 2017-01-24
    • 1970-01-01
    • 2020-11-29
    • 2019-02-27
    • 2019-08-06
    • 2017-02-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多