how to obtain fillColor from mx:LegendItem
I need to get the fillcolo开发者_JS百科r from a legendItem, howerver doing
lItem.getStyle("fill")
returns a different color than the actual legendItem marker color. Any pointers on what am I doing wrong here?
This should return to you the color of the fill. The variable type you get back from lItem.getStyle("fill")
is SolidColor.
Something to be aware of ...
If you use the fillFunction or fills to set the fill color of your chart, then the Legend will be out of synch with the chart color. :(
http://livedocs.adobe.com/flex/3/html/help.html?content=charts_formatting_07.html "If you use the fills property or the fillFunction to define the fills of chart items, and you want a legend, you must manually create the Legend object for that chart."
you can get Chart Series Color From Legend Item as
var chartElement:ChartElement = legendItem.element as ChartElement;
var chartElementSolidColor:SolidColor = chartElement.getStyle("fill") as SolidColor;
var chartElementColor:uint = chartElementSolidColor.color;
HTH
精彩评论