簡體   English   中英

如何在Shiny App(R)中更改gvisTable的背景顏色

[英]How to change background color of gvisTable in Shiny App (R)

我無法將Shiny中的gvisTable的背景設為白色以外的任何其他顏色。 我正在嘗試此操作,但不起作用:

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

您可以使用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示例

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM