2016-05-08 109 views
0

一個複選框如何使2 selectInput並且在一個行一個複選框,顯示器將是這樣的:閃亮 - 2 selectInput和在一行

x軸:----- Y軸:--- ---- -check

和代碼是: UI:

library(shiny) 
shinyUI(fluidPage(
    titlePanel("Shiny"), 
    sidebarLayout(
    sidebarPanel(

    ), 
    mainPanel(

     uiOutput("scatcoefgwr") 
    ) 
) 
)) 

服務器:

shinyServer(function(input, output) { 

    output$scatcoefgwr <- renderUI({ 

    list(

     selectInput("axisx", "x axis:",choices = c("1","2","3")), 
     selectInput("axisy", "y axis:",choices = c("1","2","3")), 
     checkboxInput("scatterD3_ellipsesgwr", "check", value = FALSE) 
    ) 
    }) 

}) 

回答

1

這是使用列的一種方法

#ui.R 
library(shiny) 
shinyUI(fluidPage(
    titlePanel("Shiny"), 
    fluidRow(
    column(width=2,uiOutput("one")), 
    column(width=2,uiOutput("two")), 
    column(width=2,uiOutput("three")) 
) 
)) 

根據需要更改寬度。

#server.R 
shinyServer(function(input, output) { 
    output$one <- renderUI({ 
    list(
     selectInput("axisx", "x axis:",choices = c("1","2","3")) 
    ) 
    }) 
    output$two <- renderUI({ 
    list(
     selectInput("axisy", "y axis:",choices = c("1","2","3")) 
    ) 
    }) 
    output$three <- renderUI({ 
    list(
     checkboxInput("scatterD3_ellipsesgwr", "check", value = FALSE) 
    ) 
    }) 
})