我无法将Shiny中的gvisTable的背景变成白色以外的任何东西。我正在尝试这个,但它不起作用:
gvisTable(finalTable, options = list(page='enable',
width='1400px', height='300px',
backgroundColor="black"))
答案 0 :(得分: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
})
})
)
)