1
votes

I have the following code with only one series. I cannot add another series due with the data I am working with - the challenge I am presented with is to style the bars on the bar chart with different colors. Any suggestions?

var options = {
title:selVal + ': Electricity Consumption Yearly % Change',
legend:{alignment:'center', position:'bottom'},
vAxis:{title:'Yearly % Change', format:'#,###%'},
seriesType: "bars",
width:600, 
height:300
};
2

2 Answers

1
votes
var options = {
          legend: 'none',
          series: {
            0: { color: '#e2431e' },
            1: { color: '#e7711b' },
            2: { color: '#f1ca3a' },
            3: { color: '#6f9654' },
            4: { color: '#1c91c0' },
            5: { color: '#43459d' },
          }
        };
0
votes

You can give multiple colors by giving an array of colors in the option

var options = {
title:selVal + ': Electricity Consumption Yearly % Change',
legend:{alignment:'center', position:'bottom'},
vAxis:{title:'Yearly % Change', format:'#,###%'},
seriesType: "bars",
width:600, 
height:300,
colors: ["red","blue","green"]
};