2

我不能让 Shiny 中的 gvisTable 的背景不是白色。我正在尝试这个,但它不起作用:

gvisTable(finalTable, options = list(page='enable', 
                                     width='1400px', height='300px',
                                     backgroundColor="black"))
4

1 回答 1

3

您可以使用以下cssClassNames选项:

require(shiny)
require(googleVis)
runApp(
  list(ui = pageWithSidebar(
    headerPanel("googleVis on Shiny"),
    sidebarPanel(
      selectInput("dataset", "Choose a dataset:",
                  choices = c("rock", "pressure", "cars"))
    ),
    mainPanel(
      htmlOutput("table")
      ,tags$head(tags$style(type="text/css", ".myTableHeadrow {background-color:red;} .myTablerow {background-color:yellow;}"))
    )
  ),
  server =function(input, output)({
    output$table <- renderGvis({
      ## Table with enabled paging
      tbl2 <- gvisTable(Population, options=list(page='enable', height=300, cssClassNames = "{headerRow: 'myTableHeadrow', tableRow: 'myTablerow'}", alternatingRowStyle = FALSE), chartid = "mytable")
      tbl2
    })    
  })
  )
)

googleVis 示例

于 2014-05-07T19:32:54.953 回答