css - 摆脱 Google Visualization 表格中列标题的颜色渐变

标签 css google-apps-script google-visualization

当我使用显示的事件监听器方法修改列标题颜色时 here ,我得到一个默认渐变。链接的代码片段示例也在第二列中显示了默认渐变。当颜色由事件监听器生成时,我将如何摆脱渐变?

最佳答案

您可以使用 background 而不是 backgroundColor

看下面的例子...

google.charts.load('current', {
  callback: function () {
    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],
      ['Web', 9999]
    ]);

    var container = document.getElementById('table_div');
    var table = new google.visualization.Table(container);
    google.visualization.events.addListener(table, 'ready', function () {
      container.getElementsByTagName('TR')[0].cells[1].style.background = 'magenta';
    });

    table.draw(data, {
      allowHtml: true
    });
  },
  packages: ['table']
});
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="table_div"></div>

关于css - 摆脱 Google Visualization 表格中列标题的颜色渐变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38158520/

相关文章:

html - Bootstrap 下拉列表位于导航栏下方

html - 无法设置指向 Div 的超链接

javascript - 如何在 Google 表格的对话框中添加重置按钮

javascript - 如何为 Google Charts 中的特定行添加背景色

html - 定位多个背景图像

google-apps-script - 来自 FormResponse 的表单标题

google-apps-script - 使用脚本更新 Google 电子表格数据透视表范围

post - 有没有办法使用 Google Charts API 的 POST 方法通过 Google Apps Script 获取二维码图像?

javascript - Google Chart 中的自动宽度滚动条

html - 如何使用 CSS 为 <p> 元素中的每一行自动编号