Search code examples
javascriptchartscolorsannotationsgoogle-visualization

I can't change the annotation color of my google chart


I'm trying for hours to change the color of the rectangle which is next to my column chart (i'm new using google chart) and i can't find a solution can you help me pls ?

This is my code :

 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 = {};

And this is how it's looking : Screenshot

The rectangle is supposed to be in the same color of the columns right ?


Solution

  • use the colors chart option...

    this is what drives the legend.

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

    this option will color the bars the same, and the style role can be removed.
    the style role is only needed if you need to override the color of a specific bar in a series.