R Gvistable为每行/单元格指定颜色

R Gvistable为每行/单元格指定颜色,r,google-visualization,shiny,ggvis,R,Google Visualization,Shiny,Ggvis,我有一个有gvistables的闪亮应用程序。我需要更改表格中每一行的字体颜色或背景颜色。我得到的最接近的方法是改变整个桌子的背景色。是否可以更改背景或每行的文本颜色?! 我给出了一个代码,其中包含使用总体数据的样本数据 require(shiny) require(googleVis) runApp( list(ui = pageWithSidebar( headerPanel("googleVis on Shiny"), sidebarPanel( selec

我有一个有gvistables的闪亮应用程序。我需要更改表格中每一行的字体颜色或背景颜色。我得到的最接近的方法是改变整个桌子的背景色。是否可以更改背景或每行的文本颜色?! 我给出了一个代码,其中包含使用总体数据的样本数据

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[1:5, ], options=list(page='enable', height=300, cssClassNames = "{headerRow: 'myTableHeadrow', tableRow: 'myTablerow'}", alternatingRowStyle = FALSE), chartid = "mytable")
      tbl2
    })    
  })
  )
)
有人能帮我想一想如何使它适应闪亮吗

var data = new google.visualization.DataTable();
data.addColumn('string', 'Department');
data.addColumn('number', 'Revenues');
data.addRows([
  ['Shoes', 10700],
  ['Sports', -15400],
  ['Toys', 12500],
  ['Electronics', -2100],
  ['Food', 22600],
  ['Art', 1100]
]);

var table = new google.visualization.Table(document.getElementById('colorformat_div'));

var formatter = new google.visualization.ColorFormat();
formatter.addRange(-20000, 0, 'white', 'orange');
formatter.addRange(20000, null, 'red', '#33ff33');
formatter.format(data, 1); // Apply formatter to second column

table.draw(data, {allowHtml: true, showRowNumber: true, width: '100%', height: '100%'});