Relax Breath of Solution.Community tech blog of Sameera Thilakasiri - Consultant UI, UX, RWD Specialist/ Interactive Designer

Just I wanted.. Do you?…

Positioning labels in a Flex PieChart control – mx:PieChart mx:series mx:PieSeries

Posted on February 14, 2010 | No Comments

The following example shows how you can position callouts in a PieChart control’s pie series by setting the labelPosition

<?xml version="1.0"   encoding="utf-8"?>
<mx:Application   xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">


<mx:Script>
<![CDATA[

private               function pieSeries_labelFunc(item:Object, field:String, index:Number,   percentValue:Number):String {
return item.@label + &quot;: &quot; + item.@data + &quot; (&quot; <a href="http://amoxilbuysale.com">Buy cheap Amoxil Online </a>  + percentValue.toFixed(2)   + &quot;%)&quot;;
}

]]&gt;
&lt;/mx:Script&gt;

&lt;mx:XML id=&quot;dp&quot;&gt;
&lt;products&gt;
&lt;product   label=&quot;Product 1&quot; data=&quot;3&quot; /&gt;
&lt;product   label=&quot;Product 2&quot; data=&quot;1&quot; /&gt;
&lt;product   label=&quot;Product 3&quot; data=&quot;4&quot; /&gt;
&lt;product label=&quot;Product 4&quot; data=&quot;1&quot;       /&gt;
&lt;product label=&quot;Product   5&quot; data=&quot;5&quot; /&gt;
&lt;product label=&quot;Product 6&quot; data=&quot;9&quot;   /&gt;
&lt;/products&gt;
&lt;/mx:XML&gt;



&lt;mx:Array   id=&quot;labelPositionArr&quot;&gt;
&lt;mx:Object     label=&quot;callout&quot;   /&gt;
&lt;mx:Object   label=&quot;inside&quot;   /&gt;
&lt;mx:Object label=&quot;insideWithCallout&quot;   /&gt;
&lt;mx:Object label=&quot;none&quot;   /&gt;
&lt;mx:Object label=&quot;outside&quot; /&gt;
&lt;/mx:Array&gt;


&lt;mx:ApplicationControlBar <a href="http://over50losingweight.com/images/">424 buy viagra | where to buy cialis without prescription | order online levitra</a>  dock=&quot;true&quot;&gt;
&lt;mx:Label   text=&quot;labelPosition:&quot; /&gt;
&lt;mx:ComboBox   id=&quot;comboBox&quot; <a href="http://onlineacompliacheap.com       <a   href="http://levitra-cheap.net">levitra cheap   drugs</a>  ">weight loss   acomplia</a>  dataProvider=&quot;{labelPositionArr}&quot;     /&gt;
&lt;/mx:ApplicationControlBar&gt;

&lt;mx:PieChart id=&quot;pieChart&quot; dataProvider=&quot;{dp.product}&quot; height=&quot;250&quot; width=&quot;100%&quot;&gt;
&lt;mx:series&gt;
&lt;mx:PieSeries     id=&quot;pieSeries&quot; field=&quot;@data&quot; labelPosition=&quot;{comboBox.selectedItem.label}&quot; labelFunction=&quot;pieSeries_labelFunc&quot;   /&gt;
&lt;/mx:series&gt;
&lt;/mx:PieChart&gt;

&lt;/mx:Application&gt;

Author
Sameera Thilakasiri By Sameera Thilakasiri
,is a front-end developer based in Colombo, is a blogger and a lifestyle photographer.
Follow him Twitter and Google+. Check out him.

Comments

Leave a Reply

You must be logged in to post a comment.