How do I have a different color or gradient for each bar in a Bar chart?

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Tim on 3rd April 2013
If I have a simple bar chart with three data values (e.g., var data = [ 14.3, 5.9, 13.2 ] ), how can I get each bar to be a different color/gradient?

I know that pairs of data values (e.g., var data = [ [ 3, 14.3 ], [ 8, 5.9 ], [ 3, 13.2 ] ] ) can, by setting two colors (e.g., bar.Set('chart.colors', ['green','blue']); ) be rendered with different colors or gradients for the 1st and 2nd bar in each pair, but that is not what I want.

Thanks in advance,

Posted by RGraph support on 4th April 2013
Hi there,

You can set the colors that you want to use with chart.colors and also set chart.colors.sequential to true.


Add a reply

« Back to message list