I have been working on creating a stacked bar chart using the Google API. Each bar will be divided into 3 sections representing Negative, Neutral, and Positive feedback that we have received.
Here is a snippet of my data and options code:
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 am trying to adjust the color scheme by including an array in the options like this:
colors:['red','blue', 'green'].
However, this only assigns the first color (red) to the entire bars instead of individual slices within them.
Do you have any suggestions on how I can control the colors for each part of the bar chart?
Thanks,
Adam