2014-09-01 48 views
1

在Windows 7 64位R 3.1.1上使用RStudio 0.98.1028,使用Shiny的fluidPage,sidebarLayout和sidebarPanel創建一個交互式文檔。它們都可以很好地播放,正如小窗口大小所描述的那樣,但是當我使用RStudio的內置瀏覽器或使用網絡瀏覽器(IE 11)全屏播放時,會有大量(約40%)的區域只是我的窗口左側沒有被使用的空白區域。我能做些什麼來讓Shiny使用我所有的瀏覽器窗口寬度?使用Shiny(RMarkdown)來使用完整瀏覽器窗口

測試用例:

--- 
title: "TestBed" 
author: "Derek Slone-Zhen" 
date: "Tuesday, September 02, 2014" 
output: html_document 
runtime: shiny 
--- 

```{r echo=FALSE} 
shinyUI(fluidPage(
    titlePanel("title panel"), 

    sidebarLayout(
    sidebarPanel(

      actionButton("goButton", label="Submit") 
    ), 
    mainPanel(
     renderDataTable({ 
      input$goButton 
      mx <- 1:10000 
      dim(mx) <- c(100,100) 
      mx <- as.data.frame(mx) 
      mx 
     } 
    ) 
    ) 
) 
)) 
``` 

什麼我不喜歡的樣子:

enter image description here

回答

1

您可能需要運行rmarkdown所以

devtools::install_github("rstudio/rmarkdown") 
的開發版本

https://github.com/rstudio/rmarkdown/issues/135

您YAML頭更改爲:

--- 
title: "TestBed" 
author: "Derek Slone-Zhen" 
date: "Tuesday, September 02, 2014" 
runtime: shiny 
output: 
    html_document: 
    css: my.css 
--- 

然後你就可以在同一個目錄中添加一個CSS my.css爲您.Rmd文件。 默認情況下,降價放置在引導程序流體容器class = main-container與默認樣式margin-left: auto;。您可以更改此例如

my.css:

.main-container{ 
    margin-left: 0px !important; 
    } 

導致:

enter image description here

相關問題