Pie Chart "Key"

Instead of waiting for RenderComplete, you can add another layout that 
defines the legend.  Here is a rough example: 

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009
                           xmlns:s="library://ns.adobe.com/flex/spark" 
                           xmlns:mx="library://ns.adobe.com/flex/mx" 
                           xmlns:axiis="http://www.axiis.org/2009
                           xmlns:transitions="org.axiis.transitions.*" 
                           xmlns:degrafa="http://www.degrafa.com/2007
                           width="620" height="300"> 
        <fx:Script> 
                <![CDATA[ 
                        import mx.collections.ArrayCollection; 
                        [Bindable] 
                        private var dp:ArrayCollection = new ArrayCollection( 
                                        [ 
                                                {label:'USA' , count:3}, 
                                                {label:'Canada' , count:3}, 
                                                {label:'Mexico' , count:4} 
                                        ] 
                                ) 
                ]]> 
        </fx:Script> 
        <s:BorderContainer width="100%" height="100%" borderVisible="false"> 
                <s:layout> 
                        <s:VerticalLayout paddingBottom="15" paddingLeft="10" 
paddingRight="10" paddingTop="10"/> 
                </s:layout> 
                <s:VGroup> 
                        <axiis:DataCanvas id="dc" width="250" height="250"> 
                                <axiis:layouts> 
                                        <axiis:WedgeStackLayout  id="wedgeGroup" 
                                                                                         dataProvider="{dp}" 
                                                                                         angleGap="0" 
                                                                                         innerRadiusRatio="0" 
                                                                                         outerRadiusRatio="1" 
                                                                                         labelRadiusRatio="1.07" 
                                                                                         dataField="count" 
                                                                                         labelField="label" 
                                                                                         width="250" 
                                                                                         height="250" 
                                                                                         showDataTips="false" 
                                                                                         fill="{wedgeFill}"> 
                                        </axiis:WedgeStackLayout> 
                                        <axiis:VBoxLayout id="legendLayout" 
                                                                          x="300" 
                                                                          width="300" 
                                                                          height="300" 
                                                                          dataProvider="{dp}" 
                                                                          dataField="count" 
                                                                          showDataTips="false" 
                                                                          > 
                                                <axiis:drawingGeometries> 
                                                        <degrafa:RasterText 
                                                                id="legendText" 
                                                                y="{legendLayout.currentReference.y+10}" 
                                                                x="{legendLayout.currentReference.x+13}" 
                                                                text="{legendLayout.currentDatum['label']}" 
                                                                fontSize="10" 
                                                        /> 
                                                        <degrafa:RegularRectangle 
                                                                id="legendSquare" width="10" height="10" fill="{legendFill}" 
                                                                y="{legendLayout.currentReference.y+14}"/> 
                                                </axiis:drawingGeometries> 
                                        </axiis:VBoxLayout> 
                                </axiis:layouts> 
                                <axiis:palettes> 
                                        <axiis:LayoutAutoPalette id="wedgePalette" colorFrom="0x3914AF" 
colorTo="0xFFD401" layout="{wedgeGroup}"/> 
                                        <axiis:LayoutAutoPalette id="legendPalette" colorFrom="0x3914AF" 
colorTo="0xFFD401" layout="{legendLayout}"/> 
                                </axiis:palettes> 
                                <axiis:fills> 
                                        <degrafa:SolidFill id="wedgeFill" 
color="{wedgePalette.currentColor}" /> 
                                        <degrafa:SolidFill id="legendFill" 
color="{legendPalette.currentColor}" /> 
                                </axiis:fills> 
                        </axiis:DataCanvas> 
                </s:VGroup> 
        </s:BorderContainer> 
</s:Application> 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值