Chart HorizontalAxis - styling
is possible style horizontalaxis in chart different colors?
what mean following:
say horizontalaxis has values 0 thru 100.
now want horizontalaxis have color green values 0 thru 30, orange values 31 thru 60 , red values 61 thru 100
yes. have done creating itemrenderer , setting on barseries. renderer extends uicomponent, implements idatarenderer , overrides updatedisplaylist.
here update display list code.
override protected function updatedisplaylist(unscaledwidth:number,
unscaledheight:number) : void {
super.updatedisplaylist(unscaledwidth, unscaledheight);
var fill:number = 0xffffff;
if(!isnan(_chartitem.item.rate) && _chartitem.item.responseratessupported) {
if(_chartitem.item.rate > 100) {
_chartitem.item.rate = 100;
}
if( _chartitem.item.rate < 41
&& _chartitem.item.rate != 0) {
fill = 0xff0000; //red#
}
if(_chartitem.item.rate < 86
&& _chartitem.item.rate > 40) {
fill = 0xffff00; //yellow#
}
if(_chartitem.item.rate < 101
&& _chartitem.item.rate > 80) {
fill = 0x00ff00; //green
}
if(_chartitem.item.rate == 0) {
fill = 0xffffff;//white
}
//currentbarcolor = fill;
var rc:rectangle = new rectangle(0, 0, width , height );
var g:graphics = graphics;
g.clear();
g.moveto(rc.left,rc.top);
g.beginfill(fill);
g.lineto(rc.right,rc.top);
g.lineto(rc.right,rc.bottom);
g.lineto(rc.left,rc.bottom);
g.lineto(rc.left,rc.top);
g.endfill();
}
hope helps.
t.k.
More discussions in Flex (Read Only)
adobe
Comments
Post a Comment