2015-10-26 20 views
0

这个例子似乎并没有与当前的代码工作调整浏览器窗口时: https://stackoverflow.com/questions/29211664/controlling-layout-of-multiple-dimple-charts-in-shiny闪亮和rcdimple htmlwidget - 如何调整到容器?

有些开始代码预期不调整:

library(shiny) 
library(shinydashboard) 
library(rcdimple) 

## need to eventually plot points over bars, so... 
##devtools::install_github("timelyportfolio/[email protected]/layers") 

server <- function(input, output) { 
    output$test_plot <- renderDimple(
    dimple(x = c('cyl', 'gear'), 
      y = 'mpg', 
      groups = 'gear', 
      data = mtcars, 
      width = '100%', 
      type = 'bar') 
) 
} 

ui <- dashboardPage(
    dashboardHeader(title = 'test rcdimple'), 

    dashboardSidebar(
    verbatimTextOutput('clicked_value') 
), 

    dashboardBody(
    fluidRow(
     box(
     width = 4, 
     status = 'info', 
     solidHeader = TRUE, 
     title = 'test', 
     dimpleOutput('test_plot') 
    ) 
    ) 
) 
) 

shinyApp(ui = ui, server = server) 



> sessionInfo() 
R version 3.2.2 (2015-08-14) 
Platform: i386-w64-mingw32/i386 (32-bit) 
Running under: Windows 7 x64 (build 7601) Service Pack 1 

locale: 
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252 
[3] LC_MONETARY=English_United States.1252 
[4] LC_NUMERIC=C       
[5] LC_TIME=English_United States.1252  

attached base packages: 
[1] stats  graphics grDevices utils  datasets 
[6] methods base  

other attached packages: 
[1] rcdimple_0.1   htmltools_0.2.6  
[3] htmlwidgets_0.5  shinydashboard_0.5.1 
[5] shiny_0.12.2   

loaded via a namespace (and not attached): 
[1] Rcpp_0.12.1  lattice_0.20-33 digest_0.6.8  
[4] mime_0.4   grid_3.2.2  R6_2.1.1   
[7] xtable_1.7-4  jsonlite_0.9.17 magrittr_1.5  
[10] rstudioapi_0.3.1 tools_3.2.2  httpuv_1.3.3  
[13] yaml_2.1.13 

回答

0

很高兴你正在使用rcdimple。我相信你只需要将width = "100%"移动到ui即可。

library(shiny) 
library(shinydashboard) 
library(rcdimple) 

## need to eventually plot points over bars, so... 
##devtools::install_github("timelyportfolio/[email protected]/layers") 

server <- function(input, output) { 
    output$test_plot <- renderDimple(
    dimple(x = c('cyl', 'gear'), 
      y = 'mpg', 
      groups = 'gear', 
      data = mtcars, 
      type = 'bar') 
) 
} 

ui <- dashboardPage(
    dashboardHeader(title = 'test rcdimple'), 

    dashboardSidebar(
    verbatimTextOutput('clicked_value') 
), 

    dashboardBody(
    fluidRow(
     box(
     width = 4, 
     status = 'info', 
     solidHeader = TRUE, 
     title = 'test', 
     dimpleOutput('test_plot',width="100%") 
    ) 
    ) 
) 
) 

shinyApp(ui,server) 
+0

这是我试过的变化之一。所以,我在RStudio和几个浏览器中测试了这些特定的代码,没有任何的乐趣。也许我在一个不太支持它的版本上?基于另一个笔记和我需要绘制点横跨酒吧,我使用devtools :: install_github(“及时portfolio/rcdimple @功能/图层”) – user3292305