在Google可视化表中删除列标题的颜色渐变 [英] Get rid of color gradient for column headers in Google Visualization table

查看:235
本文介绍了在Google可视化表中删除列标题的颜色渐变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用此处显示的事件侦听器方法修改列标题颜色时>,我得到一个默认渐变。链接的代码段示例也在第二列中显示默认渐变。当事件侦听器生成颜色时,如何去除渐变?

When I modify the column header colors using the event listener method shown here, I get a default gradient. The snippet example linked also is also showing the default gradient in the second column. How would I go about getting rid of the gradient when the color is generated by the event listener?

推荐答案

c $ c> background 而不是 backgroundColor

you could use background instead of 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>

这篇关于在Google可视化表中删除列标题的颜色渐变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆