【问题标题】:I can't change the annotation color of my google chart我无法更改我的谷歌图表的注释颜色
【发布时间】:2021-07-29 17:22:59
【问题描述】:

我尝试了几个小时来更改我的柱形图旁边的矩形的颜色(我是使用谷歌图表的新手),但我找不到解决方案,你能帮我吗?

这是我的代码:

 var data3 = google.visualization.arrayToDataTable([
                
                ['Element', 'Nombre de projets en cours',{ role: 'style' }, { role: 'annotation' }, ],
                ['Abel', abelProjet, '#05204A', '' ],
                ['Evan', evanProjet, '#05204A', '' ],
                ['Florent', florentProjet, '#05204A', '' ],
                ['Florian', florianProjet, '#05204A', '' ],
                ['Martin', martinProjet, '#05204A', '' ],
                ['Novan', novanProjet, '#05204A', '' ],
                ['Valentin', valentinProjet, '#05204A', '' ]
            ]);

            var options3 = {};

这就是它的外观: Screenshot

矩形应该与列的颜色相同吗?

【问题讨论】:

    标签: javascript charts colors annotations google-visualization


    【解决方案1】:

    使用colors 图表选项...

    这就是传奇的驱动力。

    var options3 = {
      colors: ['#05204A']
    };
    

    此选项将使条形颜色相同,并且可以删除样式角色。
    仅当您需要覆盖系列中特定条形的颜色时才需要样式角色。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-09-24
      • 2016-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-01
      • 1970-01-01
      相关资源
      最近更新 更多