PDA

View Full Version : change color of bar in stackedbarchart



amanind
12 Mar 2012, 7:08 AM
Hi,

Can I change color of bars in stacked bar chart. if so, how to do it.
Any help please

Thanks

mitchellsimoens
12 Mar 2012, 8:50 AM
Using the color array in the axis

http://yuilibrary.com/yui/docs/api/classes/BarSeries.html#attr_styles

rbraddy
19 Aug 2012, 1:49 PM
Here's an example, if that's more helpful than a link to the documentation:

http://jsfiddle.net/rbraddy/SdGHK/3/
(http://jsfiddle.net/rbraddy/SdGHK/3/)
series: [{
style: { color: ["#DAA520"] },
type: 'stackcolumn',
displayName: 'Page Views',
yField: 'views'
},{
style: { color: ["#32CD32"] },
type:'stackcolumn',
displayName: 'Visits',
yField: 'visits'
}]


You can apparently also control the colors by changing the Theme, which seemed like overkill to me, as I want to control my bar colors in a simple way.

This took me HOURS to figure out, due to lack of simple examples. Hope it saves someone else some time.

Rick



(http://jsfiddle.net/rbraddy/SdGHK/3/)