Color problems in Google Charts Bar

0

I can not generate different colors in google charts bars. The data is coming from a data.addRows([[${golLog}]]); variable and I noticed that inside that variable there is an array. It looks like it throws only the first color for the two bars.

Follow the code for understanding:

google.charts.load('current', {
   'packages' : [ 'corechart','bar' ]
});
 google.charts.setOnLoadCallback(golLog);

 function golLog() {
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Qtd');
    data.addColumn('number');

    data.addRows([[${golLog}]]);

    var options = {
      chart: {
         left:0,
         top:40,
         width:'100%',
         height:'100%'
      },
      title: 'GOL',
      legend: { position: 'none' },
      theme: 'material',
      fontSize: 20,
      colors:['#fc1700','#212e84']
    };

    var chart = new 
     google.charts.Bar(document.getElementById('chart_golLog'));

     chart.draw(data, google.charts.Bar.convertOptions(options));
  }

   <div id="chart_golLog"></div>

    
asked by anonymous 18.10.2018 / 17:55

0 answers