2017-03-17 6 views
1

tabsetPanelを使用する光沢のあるアプリケーションを作成しようとしていますが、タブを作成すると、アプリケーションのコンテンツがウィンドウの全領域をいっぱいにしなくなり、出力の右下に表示されます。以下は非常に基本的な例です。タブがなければ、アプリケーションは流体ページとして完璧に動作しますが、私はそれをタブに分割する必要があります。TabsetPanelがShinyの全ページを埋めていない

簡単な例では:

`library(shiny) 

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

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


mainPanel(
tabsetPanel(
    tabPanel("Test", 
# 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(
    plotOutput("distPlot") 
) 
)), 
#Create second tab just for demonstration 
tabPanel("Second Test", h3("Test") 
     )))) 


# 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') 
}) 

{ "example second tab" } 
} 

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

私はfillPageとfluidPageと周りいじることを試みているが、どちらか、それがすべてで問題が発生し、間違った場所や何にオブジェクトを移動することで、それが悪化させます。これは私に起こっているのですか?誰にも何が起こったのか、それがどうすれば解決できるのか、どんな考えがありますか?ここで

+0

タブセットパネルの幅と高さを調整する場合は、この投稿が参考になります:https://stackoverflow.com/questions/19096439/shiny-how-to-adjust-the-width-of-the - タブセットパネル –

答えて

1

は幅全体にまたがるものです:

library(shiny) 

ui <- fluidPage(
    titlePanel("Title"), 
    tabsetPanel(
     tabPanel(
     "Test", 
      sidebarLayout(
      sidebarPanel(
       sliderInput("bins", "Number of bins:", min = 1, max = 50, value = 30) 
      ), 
      mainPanel(
       plotOutput("distPlot") 
      ) 
      ) 
    ), 
     tabPanel("Second Test", h3("Test")) 
    ) 
) 

server <- function(input, output) { 
    output$distPlot <- renderPlot({ 
    x <- faithful[, 2] 
    bins <- seq(min(x), max(x), length.out = input$bins + 1) 
    hist(x, breaks = bins, col = 'darkgray', border = 'white') 
    }) 
    { "example second tab" } 
} 

shinyApp(ui = ui, server = server) 

基本的にあなたがtabsetPanel巻き付けmainPanelを持っていました。それがなければ、すべてうまく見えます。

+0

パーフェクト、ありがとう!これが私が間違っているところだったことに気付かなかった。 – MLMM

関連する問題