flex 3D pieChart用法总结

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:ilog="http://www.ilog.com/2007/ilog/flex" width="100%" height="100%" creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.charts.events.ChartItemEvent;
import mx.charts.HitData;
import ilog.charts3d.PieChart3D;
import mx.collections.ArrayCollection;
[Bindable]
            private var _selectedRegion:Object;

[Bindable]
public var pieData:ArrayCollection = new ArrayCollection
([{objName:'未知',objValue:0},
{objName:'待审核',objValue:58},
{objName:'待实施',objValue:85},
{objName:'待关闭情况',objValue:66}]);

private function init():void
{
pieChart.dataProvider = pieData;
}
       
            public function set selectedRegion(item:Object):void
            {
               _selectedRegion = item;

                var index:int = -1;
                for (var i:int = 0; i < pieData.length && index == -1; i++)
                {
                    if (pieData[i].objName == item.objName)
                        index = i;
                }
                var explodeData:Array = [];
                explodeData[index] = 0.15;
                pieChart.series[0].perWedgeExplodeRadius = explodeData;
            }
           
            private function regionChange(item:Object):void
            {
                selectedRegion = item;
            }
           
            private function getSliceLabel(item:Object, arg2:String, arg3:Number, arg4:Number):String
            {
                return item == null?"":item.objName + item.objValue + "人";
            }
       
]]>
</mx:Script>
<mx:SeriesInterpolate id="interpolate" elementOffset="10"/>
<ilog:PieChart3D x="10" y="10" id="pieChart" width="100%" height="100%" itemClick="regionChange(event.hitData.item)"
showEffect="Fide" hideEffect="Fide" moveEffect="Glow" focusInEffect="Glow" showDataTips="true" fontFamily="simsun">
<ilog:series>
<ilog:PieSeries3D displayName="Series 1" nameField="objName" field="objValue"
labelFunction="getSliceLabel" labelPosition="inside" showDataEffect="{interpolate}" >
<ilog:radialStroke>
                <mx:Stroke weight="0" color="#FFFFFF" alpha="0.20"/>
       </ilog:radialStroke>
         <ilog:stroke>
              <mx:Stroke color="0" alpha="0.20" weight="2"/>
                </ilog:stroke>
        </ilog:PieSeries3D>
</ilog:series>
</ilog:PieChart3D>
</mx:Canvas>

你可能感兴趣的:(flex 3D pieChart用法总结)