PieChar, this code can be found on the Internet

Source: Internet
Author: User

 

Code

<? Xml version = "1.0" encoding = "UTF-8"?>
<Mx: Application xmlns: mx = "http://www.adobe.com/2006/mxml" layout = "vertical" width = "100%" height = "100%">
<Mx: Script>
<! [CDATA [
Import mx. charts. series. items. PieSeriesItem;
Import mx. charts. events. ChartItemEvent;
Import mx. effects. easing .*;

Private function perEvent (evt: ChartItemEvent): void {
Var obj: PieSeriesItem = evt. hitData. chartItem as PieSeriesItem;
Var dgrees: Number = radius (obj. startAngle );
Var arr: Array = [];
If (cbox. selected)
Arr [obj. index] = 0.2;
Pser. perWedgeExplodeRadius = arr; // block change
// Pser. startAngle-= dgrees; // rotate

Pd. refresh ();
}
Private function radius (n1: Number): Number {
Return n1 * (180/Math. PI );
}
]>
</Mx: Script>
<! -- Display dataset -->
<Mx: XMLListCollection id = "pd">
<Mx: source>
<Mx: XMLList xmlns = "">
<Product label = "data1" data = "5"/>
<Product label = "data2" data = "7"/>
<Product label = "data3" data = "1"/>
<Product label = "data4" data = "3"/>
<Product label = "data5" data = "8"/>
<Product label = "data6" data = "4"/>
<Product label = "data7" data = "6"/>
<Product label = "data8" data = "9"/>
</Mx: XMLList>
</Mx: source>
</Mx: XMLListCollection>
<Mx: ApplicationControlBar dock = "true" width = "400">
<Mx: CheckBox id = "cbox" label = "Selected" selected = "true"/>
</Mx: ApplicationControlBar>
<Mx: PieChart id = "p1" dataProvider = "{pd}" showDataTips = "true" itemClick = "perEvent (event);">
<Mx: series>
<Mx: PieSeries id = "pser" field = "@ data" nameField = "@ label">
<Mx: showDataEffect>
<Mx: SeriesInterpolate duration = "2000" easingFunction = "{Elastic. easeOut}"/>
</Mx: showDataEffect>
<Mx: filters>
<Mx: DropShadowFilter/>
</Mx: filters>
</Mx: PieSeries>
</Mx: series>
</Mx: PieChart>
<Mx: Legend dataProvider = "{p1}" direction = "horizontal"/>
</Mx: Application>

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.