Packagecom.amcharts
Classpublic class AmPieChart
InheritanceAmPieChart Inheritance AmChart Inheritance mx.core.UIComponent

AmPieChart class creates pie (donut) chart.

View the examples.



Public Properties
 PropertyDefined by
  alphaField : String
Alpha field name holds a name of the field in your dataProvider object which holds slice's alpha.
AmPieChart
 Inheritedballoon : AmBalloon
An instance of com.amcharts.AmBalloon.
AmChart
 InheritedclipContent : Boolean
Specifies if the chart contents which goes outside the chart area should be clipped or not.
AmChart
  clipLabels : Boolean
Specifies if labels should be cliped if there are a lot of them.
AmPieChart
  colorField : String
Color field name holds a name of the field in your dataProvider object which holds slice's color.
AmPieChart
 InheriteddataProvider : Object
Specifies the data provider for the chart.
AmChart
  descriptionField : String
Description field name holds a name of the field in your dataProvider object which holds a string with description.
AmPieChart
 Inheritedlegend : AmLegend
Chart legend.
AmChart
 InheritednumberFormatter : NumberFormatter
An instance of mx.formatters.NumberFormatter.
AmChart
 InheritedpercentFormatter : NumberFormatter
An instance of mx.formatters.NumberFormatter.
AmChart
 InheritedprefixesOfBigNumbers : Array
Array of objects with prefixes for big numbers.
AmChart
 InheritedprefixesOfSmallNumbers : Array
Array of objects with prefixes for small numbers.
AmChart
  pulledField : String
Pulled field name holds a name of the field in your dataProvider object which holds a boolean value telling the chart whether this slice must be pulled or not.
AmPieChart
  titleField : String
Title field name holds a name of the field in your dataProvider object which holds slice's title.
AmPieChart
  urlField : String
Url field name holds a name of the field in your dataProvider object which holds url which would be accessed if the user clicks on a slice.
AmPieChart
  urlTarget : String
Target of the url.
AmPieChart
 InheritedusePrefixes : Boolean
If true, prefixes will be used for big and small numbers.
AmChart
  valueField : String
Value field name holds a name of the field in your dataProvider object which holds slice's value.
AmPieChart
  visibleInLegendField : String
visibleInLegendField field name holds a name of the field in your dataProvider object which holds boolean variable defining whether this data item should have an entry in the legend.
AmPieChart
Public Methods
 MethodDefined by
  
Constructor.
AmPieChart
  
animateAgain():void
The animation is played only once or if you change the animation styles.
AmPieChart
  
clickSlice(index:Number):void
You can trigger the click on a slice from outside.
AmPieChart
  
hideSlice(index:Number):void
Hides slice.
AmPieChart
 Inherited
In case data inside your dataProvider was changed, you can call this method to rebuild the chart.
AmChart
  
showSlice(index:Number):void
Shows slice.
AmPieChart
Events
 EventSummaryDefined by
   Dispatched when user clicks on a slice.AmPieChart
 Inherited Dispatched when the chart was updated with new data, when dataProvider or data inside dataProvider was changed.AmChart
   Dispatched when user clicks on a slice and the slice is pulled-in.AmPieChart
   Dispatched when user clicks on a slice and the slice is pulled-out.AmPieChart
   Dispatched when user rolls-out of the slice.AmPieChart
   Dispatched when user rolls-over the slice.AmPieChart
Styles
 StyleDescriptionDefined by
  
adjustLabelWidth
Type: Boolean   CSS Inheritance: no
Specifies whether the component should measure maximum width of a label and use it as labelWidth. In case the actual maximum label width is smaller then labelWidth value, the component will use actual maximum label width. This will help to avoid large empty spaces around the chart. However if you want all your pies in equal size containers to have the same radius, set this to false. The default value is true.
AmPieChart
  
angle
Type: Number   CSS Inheritance: no
Pie lean angle (for 3D effect). Valid range is 0-90. The default value is 0.
AmPieChart
  
balloonText
Type: String   CSS Inheritance: no
Balloon text. The following tags can be used: [[value]], [[title]], [[percents]], [[description]]. You can also use custom fields from your dataProvider. The default value is [[title]]: [[percents]]% ([[value]]) <br>[[description]].
AmPieChart
 Inherited Type: uint   Format: Color   CSS Inheritance: yes
Color of text in the component, including the component label.
AmChart
  
colors
Type: Array   Format: Color   CSS Inheritance: no
Specifies the colors of the slices, if the slice color is not set. If there are more slices than colors in this array, the chart picks random color. The default value is [0xFF0F00,0xFF6600,0xFF9E01,0xFCD202,0xF8FF01,0xB0DE09,0x04D215,0x0D8ECF,0x0D52D1,0x2A0CD0,0x8A0CCF,0xCD0D74,0x754DEB,0xDDDDDD,0x999999,0x333333,0x000000,0x57032A,0xCA9726,0x990000,0x4B0C25].
AmPieChart
  
depth3D
Type: Number   CSS Inheritance: no
Depth of the pie (for 3D effect). The default value is 0.
AmPieChart
 Inherited Type: uint   Format: Color   CSS Inheritance: yes
Color of text in the component if it is disabled.
AmChart
 Inherited Type: String   CSS Inheritance: yes
Sets the antiAliasType property of internal TextFields.
AmChart
 Inherited Type: String   CSS Inheritance: yes
Name of the font to use.
AmChart
 Inherited Type: String   CSS Inheritance: yes
Sets the gridFitType property of internal TextFields that represent text in Flex controls.
AmChart
 Inherited Type: Number   CSS Inheritance: yes
Sets the sharpness property of internal TextFields that represent text in Flex controls.
AmChart
 Inherited Type: Number   Format: Length   CSS Inheritance: yes
Height of the text, in pixels.
AmChart
 Inherited Type: String   CSS Inheritance: yes
Determines whether the text is italic font.
AmChart
 Inherited Type: Number   CSS Inheritance: yes
Sets the thickness property of internal TextFields that represent text in Flex controls.
AmChart
 Inherited Type: String   CSS Inheritance: yes
Determines whether the text is boldface.
AmChart
  
gradient
Type: String   CSS Inheritance: no
Gradient type. Possible values: none, radial, linear. The default value is none.
AmPieChart
  
gradientRatio
Type: Array   CSS Inheritance: no
List of brightness ratio values applied to the color for gradient effect. Each value makes gradient point lighter (positive value) or darker (negative value) than base slice color. The default value is [-20,80].
AmPieChart
  
groupedAlpha
Type: Number   CSS Inheritance: no
Opacity of the group slice. The default value is 1.
AmPieChart
  
groupedColor
Type: uint   Format: Color   CSS Inheritance: no
Color of the group slice. The default value is not set - this means the next available color from "colors" array will be used. The default value is NaN.
AmPieChart
  
groupedDescription
Type: Description   CSS Inheritance: no
Description of the group slice. The default value is undefined.
AmPieChart
  
groupedPulled
Type: Boolean   CSS Inheritance: no
If this is set to true, the group slice will be pulled out when the chart loads. The default value is false.
AmPieChart
  
groupedTitle
Type: String   CSS Inheritance: no
Title of the group slice. The default value is Other.
AmPieChart
  
groupPercent
Type: Number   CSS Inheritance: no
If there is more than one slice whose percentage of the pie is less than this number those slices will be grouped together into one slice. This is the "other" slice. It will always be the last slice in a pie. The default value is 0.
AmPieChart
  
hideLabelsPercent
Type: Number   CSS Inheritance: no
Slices with percent less then hideLabelsPercent won't display labels. This is useful to avoid cluttering up the chart, if you have a lot of small slices. 0 means all labels will be shown. The default value is 0.
AmPieChart
  
hoverAlpha
Type: Number   CSS Inheritance: no
Opacity of the rolled-over slice. The default value is 1.
AmPieChart
  
innerRadius
Type: String   CSS Inheritance: no
Inner radius of the pie, in pixels or percents. The default value is 0.
AmPieChart
 Inherited Type: Boolean   CSS Inheritance: yes
A Boolean value that indicates whether kerning is enabled (true) or disabled (false).
AmChart
  
labelRadius
Type: Number   CSS Inheritance: no
The distance between the label and the slice, in pixels. You can use negative values to put the label on the slice. The default value is 30.
AmPieChart
  
labelsEnabled
Type: Boolean   CSS Inheritance: no
Specifies whether data labels are visible. The default value is true.
AmPieChart
  
labelText
Type: String   CSS Inheritance: no
Label text. The following tags can be used: [[value]], [[title]], [[percents]], [[description]]. You can also use custom fields from your dataProvider. The default value is [[title]]: [[percents]]%.
AmPieChart
  
labelTickAlpha
Type: Number   CSS Inheritance: no
Label tick opacity. The default value is 0.2.
AmPieChart
  
labelTickColor
Type: uint   Format: Color   CSS Inheritance: no
Label tick color. The default value is 0x000000.
AmPieChart
  
labelWidth
Type: Number   CSS Inheritance: yes
Label text width. The default value is 120.
AmPieChart
 Inherited Type: Number   CSS Inheritance: yes
The number of additional pixels to appear between each character.
AmChart
  
marginBottom
Type: Number   CSS Inheritance: no
Bottom margin of the chart. The default value is 5.
AmPieChart
  
marginLeft
Type: Number   CSS Inheritance: no
Left margin of the chart. The default value is 0.
AmPieChart
  
marginRight
Type: Number   CSS Inheritance: no
Right margin of the chart. The default value is 0.
AmPieChart
  
marginTop
Type: Number   CSS Inheritance: no
Top margin of the chart. The default value is 5.
AmPieChart
  
minRadius
Type: Number   CSS Inheritance: no
Minimum radius of the pie, in pixels. The default value is 10.
AmPieChart
  
outlineAlpha
Type: Number   CSS Inheritance: no
Pie outline opacity. The default value is 0.
AmPieChart
  
outlineColor
Type: uint   Format: Color   CSS Inheritance: no
Pie outline color. The default value is 0xFFFFFF.
AmPieChart
  
outlineThickness
Type: Number   CSS Inheritance: no
Pie outline thickness. The default value is 0.
AmPieChart
  
pieAlpha
Type: Number   CSS Inheritance: no
Opacity of the slices. You can set the opacity of individual slice too. The default value is 1.
AmPieChart
  
pieBaseColor
Type: uint   Format: Color   CSS Inheritance: no
Color of the first slice. All the other will be colored with darker or brighter colors. The default value is NaN.
AmPieChart
  
pieBrightnessStep
Type: Number   CSS Inheritance: no
Lightness increase of each subsequent slice. This is only useful if pieBaseColor is set. Use negative values for darker colors. Value range is from -255 to 255 The default value is 30.
AmPieChart
  
pullOutDuration
Type: Number   CSS Inheritance: no
Pull out duration, in seconds. The default value is 1.
AmPieChart
  
pullOutEffect
Type: Function   CSS Inheritance: no
Pull out effect. The default value is Bounce.easeOut.
AmPieChart
  
pullOutOnlyOne
Type: Boolean   CSS Inheritance: no
If this is set to true, only one slice can be pulled out at a time. If the viewer clicks on a slice, any other pulled-out slice will be pulled in. The default value is false.
AmPieChart
  
pullOutRadius
Type: Number   CSS Inheritance: no
Pull out radius, in pixels. The default value is 15.
AmPieChart
  
radius
Type: String   CSS Inheritance: no
Radius of the pie, in pixels or percents. By default, radius is calculated automatically. The default value is NaN.
AmPieChart
  
sequencedAnimation
Type: Boolean   CSS Inheritance: no
Specifies whether the animation should be sequenced or all objects should appear at once. The default value is true.
AmPieChart
  
startAlpha
Type: Number   CSS Inheritance: no
Initial opacity of all slices. If you set startDuration higher than 0, slices will fade in from startAlpha. The default value is 0.
AmPieChart
  
startAngle
Type: Number   CSS Inheritance: no
Angle of the first slice, in degrees. This will work properly only if "depth3D" is set to 0. If "depth3D" is greater than 0, then there can be two angles only: 90 and 270. Valid range is 0-360. The default value is 90.
AmPieChart
  
startDuration
Type: Number   CSS Inheritance: no
Duration of the animation, in seconds. The default value is 0.
AmPieChart
  
startEffect
Type: Function   CSS Inheritance: no
Animation effect. The default value is Bounce.easeOut.
AmPieChart
  
startRadius
Type: Number   CSS Inheritance: no
Radius of the positions from which the slices will fly in. The default value is 500.
AmPieChart
 Inherited Type: String   CSS Inheritance: yes
Alignment of text within a container.
AmChart
 Inherited Type: String   CSS Inheritance: yes
Determines whether the text is underlined.
AmChart
 Inherited Type: Number   Format: Length   CSS Inheritance: yes
Offset of first line of text from the left side of the container, in pixels.
AmChart
Property detail
alphaFieldproperty
alphaField:String  [read-write]

Alpha field name holds a name of the field in your dataProvider object which holds slice's alpha.

Implementation
    public function get alphaField():String
    public function set alphaField(value:String):void
clipLabelsproperty 
clipLabels:Boolean  [read-write]

Specifies if labels should be cliped if there are a lot of them. If false, the size of pie chart will be reduced so that all labels would fit.

The default value is false.

Implementation
    public function get clipLabels():Boolean
    public function set clipLabels(value:Boolean):void
colorFieldproperty 
colorField:String  [read-write]

Color field name holds a name of the field in your dataProvider object which holds slice's color.

Implementation
    public function get colorField():String
    public function set colorField(value:String):void
descriptionFieldproperty 
descriptionField:String  [read-write]

Description field name holds a name of the field in your dataProvider object which holds a string with description.

Implementation
    public function get descriptionField():String
    public function set descriptionField(value:String):void
pulledFieldproperty 
pulledField:String  [read-write]

Pulled field name holds a name of the field in your dataProvider object which holds a boolean value telling the chart whether this slice must be pulled or not.

Implementation
    public function get pulledField():String
    public function set pulledField(value:String):void
titleFieldproperty 
titleField:String  [read-write]

Title field name holds a name of the field in your dataProvider object which holds slice's title.

Implementation
    public function get titleField():String
    public function set titleField(value:String):void
urlFieldproperty 
urlField:String  [read-write]

Url field name holds a name of the field in your dataProvider object which holds url which would be accessed if the user clicks on a slice.

Implementation
    public function get urlField():String
    public function set urlField(value:String):void
urlTargetproperty 
urlTarget:String  [read-write]

Target of the url. Use _blank for a new window.

The default value is _self.

Implementation
    public function get urlTarget():String
    public function set urlTarget(value:String):void
valueFieldproperty 
valueField:String  [read-write]

Value field name holds a name of the field in your dataProvider object which holds slice's value.

Implementation
    public function get valueField():String
    public function set valueField(value:String):void
visibleInLegendFieldproperty 
visibleInLegendField:String  [read-write]

visibleInLegendField field name holds a name of the field in your dataProvider object which holds boolean variable defining whether this data item should have an entry in the legend.

Implementation
    public function get visibleInLegendField():String
    public function set visibleInLegendField(value:String):void
Constructor detail
AmPieChart()constructor
public function AmPieChart()

Constructor.

Method detail
animateAgain()method
public function animateAgain():void

The animation is played only once or if you change the animation styles. You can trigger animation again by calling this method.

clickSlice()method 
public function clickSlice(index:Number):void

You can trigger the click on a slice from outside.

Parameters
index:Number
hideSlice()method 
public function hideSlice(index:Number):void

Hides slice.

Parameters
index:Number
showSlice()method 
public function showSlice(index:Number):void

Shows slice.

Parameters
index:Number
Event detail
clickSliceevent 
Event object type: com.amcharts.events.PieChartEvent

Dispatched when user clicks on a slice.

pullInSliceevent  
Event object type: com.amcharts.events.PieChartEvent

Dispatched when user clicks on a slice and the slice is pulled-in.

pullOutSliceevent  
Event object type: com.amcharts.events.PieChartEvent

Dispatched when user clicks on a slice and the slice is pulled-out.

rollOutSliceevent  
Event object type: com.amcharts.events.PieChartEvent

Dispatched when user rolls-out of the slice.

rollOverSliceevent  
Event object type: com.amcharts.events.PieChartEvent

Dispatched when user rolls-over the slice.

Examples
simplePieChart
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                xmlns:amcharts="http://www.amcharts.com/com_internal"
                layout="absolute"
                backgroundColor="#FFFFFF"
                width="100%"
                height="100%" viewSourceURL="srcview/index.html">
    
    <mx:Script>
        <![CDATA[
            
            import mx.collections.ArrayCollection;
            
            [Bindable]
            private var chartData:ArrayCollection = new ArrayCollection( [
                {country:"Czech Republic",litres:156.90},  
                {country:"Ireland",litres:131.10},
                {country:"Germany",litres:115.80},  
                {country:"Australia",litres:109.90},  
                {country:"Austria",litres:108.30},  
                {country:"UK",litres:99.00},  
                {country:"Belgium",litres:93.00}]); 
        ]]>
    </mx:Script>
    
    <amcharts:AmPieChart width="100%" height="100%" dataProvider="{chartData}" titleField="country" valueField="litres"/>
    
</mx:Application>