3

奇怪的是,当我运行以下闪亮的应用程序时,页面右侧会出现一个滚动条:

shinyUI(
  fluidPage(
    tabsetPanel(
      tabPanel("Plot", htmlOutput("test")),
      tabPanel("Summary"),
      tabPanel("Table")
    )
  )
)

library(googleVis)
library(shiny)

shinyServer(function(input, output, session) {
  output$test <- renderGvis({
     gvisBubbleChart(Fruits, idvar="Fruit", 
                            xvar="Sales", yvar="Expenses",
                            colorvar="Year", sizevar="Profit",
                            options=list(
                              hAxis='{minValue:75, maxValue:125}',
                              vAxis='{minValue:0, maxValue:250}'
                              ,height=600,width=600)
     )  
  }) 
})

如果我从 tabsetPanel 布局更改为 pageWithSidebar 布局,则该图通常会出现而没有滚动条。另外,如果我没有在选项列表中指定宽度和高度,我会得到两个滚动条,一个是垂直的,一个是水平的。

是否可以在没有滚动条的 tabsetPanels 中使用 googleVis 图表?

4

1 回答 1

3

您可以通过向调用添加参数来将overflow其设置为隐藏:styletabPanel

library(googleVis)
library(shiny)
runApp(
  list(ui = fluidPage(
    tabsetPanel(
      tabPanel("Plot", htmlOutput("test"), style = "overflow:hidden;"),
      tabPanel("Summary"),
      tabPanel("Table")
    )
  )
  , server = function(input, output, session) {
    output$test <- renderGvis({
      gvisBubbleChart(Fruits, idvar="Fruit", 
                      xvar="Sales", yvar="Expenses",
                      colorvar="Year", sizevar="Profit",
                      options=list(
                        hAxis='{minValue:75, maxValue:125}',
                        vAxis='{minValue:0, maxValue:250}'
                        ,height=600,width=600)
      )  
    }) 
  })
)

在此处输入图像描述

于 2014-09-26T12:00:47.810 回答