I am creating a stacked bar chart using google api. Each bar will consist of 3 "slices" representing Negative, Neutral and Positive feedback we received.
my data and options code looks as follows:
data = google.visualization.arrayToDataTable([
['Category', 'Negative', 'Neutral', 'Positive', ],
['icon', 10, 800, 5],
['colour', 5, 5, 5],
['copy', 5, 5, 5],
['navigation', 5, 5, 5]
]);
};
options = {
isStacked: true,
width: '100%',
height: 400,
hAxis: {title: 'Category', textStyle: {bold : true, fontSize: 24}, titleTextStyle: {color: 'White'}},
vAxis: {title: 'Responses', textStyle: {bold : true, fontSize: 24}, titleTextStyle: {color: 'White'}},
};
var chart = new google.charts.Bar(document.getElementById('categoryChart'));
chart.draw(data, google.charts.Bar.convertOptions(options));
I have been trying to address that by adding an array like this to options
colors:['red','blue', 'green'].
to options but that only picks the first colour (red) and applies it to whole bars (slices are just separated by gradient).
Any tips how to control the colours of each part of the bar chart?
Best,
Adam