PDA

View Full Version : Can you set Column Chart Colors depending upon value



pablosn
1 Jun 2009, 4:39 AM
Is it possible to change the columns color depending upon the value (e.g. if less than 0 then set column color to red)?

Thanks in advance.

vishal.chawathe
11 Aug 2009, 3:18 PM
Hi even I am looking to change the color dynamically based on the user click..

Also is dragging on charts possible..just to select some bars in the column chart...



Thanks

pablosn
12 Aug 2009, 1:41 AM
So far as far as i can tell no it's not possible. The charting is a third party component and the API is here:

http://developer.yahoo.com/yui/charts/

There are however other options for charting

open flash charts 2 http://teethgrinder.co.uk/open-flash-chart-2/

flot http://code.google.com/p/flot/
and ext variety
http://code.google.com/p/extflot/

Hope all this helps.

GeorgeHernandez
10 Nov 2011, 11:07 AM
Assuming Ext JS 4.x:


series: [{
type: 'column',
...
yField: 'yField',
renderer: function(sprite, record, attr, index, store) {
var value = record.get('yField');
var color;
if (value < 70) {
color = 'rgb(255, 0, 0)';
} else {
color = 'rgb(0, 0, 255)';
}
return Ext.apply(attr, {
fill: color
});
}
}]