Hey, very cool Jason.
 
One question -- your app seems to have a drop shadow per wedge...which makes wedges drop shadows onto other wedges. Is that intentional? At first glance, I can't see if anything in your code caused that.
 
Ely.
 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jason
Sent: Thursday, June 15, 2006 2:09 PM
To: [email protected]
Subject: [flexcoders] example code to color pie wedges based on predefined categories

Okay, long long ago I posted wanting to figure out how to tell a PieSeries which colors to use for the data based on a field in the data.  Ely posted some related code that helped a lot.  I've only just now gotten comfortable enough to understand and modify it for my needs.

I figured I would post about it here in case anyone else wants to use it. 

http://three.fsphost.com/flex2/PieCategory/PieCategoryApp.htm
lhttp://three.fsphost.com/flex2/PieCategory/srcview/

Here's an example of how you use it:

<mx:PieSeries field="@costs" nameField="@month" labelPosition="insideWithCallout" labelFunction="getLabel">
    <mx:itemRenderer>
 &n! bsp;      <mx:Component>
            <nes:PieCategoryWedgeRenderer xmlns:qc="nes.charts.dataRenderers.*">
                <nes:categories>
                    <nes:PieCategory value="January" field="@month">
                        <nes:fill>
              <mx:LinearGradient>
                <mx:entries>
                  <mx:Array>
           !          <mx:Gradie! ntEntry color="0x000000" ratio="33"/>
                    <mx:GradientEntry color="0xFF0000" ratio="90"/>
                  </mx:Array>
                </mx:entries>
              </mx:LinearGradient>
                        </nes:fill>
                    </nes:PieCategory>
                    <nes:PieCategory value="February" field="@month" color="#00FF00"/>
 ! ;                   <nes:PieCategory value="March" field="@month" color="#0000FF" alpha="0.2"/>
     
                </nes:categories>
            </nes:PieCategoryWedgeRenderer>
        </mx:Component>
    </mx:itemRenderer>
</mx:PieSeries>



Note that you can either put your own fill or you can use the color/alpha properties of the PieCategory element and it will do a SolidColor field for you.  If you omit the "field" from the PieCategory, it will use the PieSeries "nameField" if available.

This is a first whack, so feel free to make any suggestions.  Thanks to Ely for providing the stoplight example.  Always remember when a developer says somethin! g is "not too hard", they mean if you already know how to do i! t.  ;)


__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to