Search code examples
apache-flexflex3flex-charting

Getting fill color inside the itemrenderer in Adobe Flex


I am writing a custom item renderer to render a column series in my application. Its a stacked chart and i want to use the same item renderer for both the column series. The color for each series in the stack is different and am setting that in the 'fill' property of the two series. My doubt is how can i get the color specified in the fill property of the column series from the item renderer. if this works then i can very well use the same renderer for both series.

Thanks in advance, Anoop


Solution

  • I was able to crack this down finally. It was very simple. In the item renderer I declared a public variable with datatype uint to store the fillcolor. In the column series instead of giving like 'itemRenderer="LabeledRenderer"' I gave like this :

    <mx:ColumnSeries ....>
         <mx:itemRenderer>
        <mx:Component>
             <local:LabeledRenderer3 fillColor="0x819CCC"/>
        </mx:Component>
         </mx:itemRenderer>
    </mx:ColumnSeries>
    

    Bingo! It worked perfectly. Cheers, PK