<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; PieChart</title>
	<atom:link href="http://blog.flexexamples.com/category/piechart/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting the font weight on the MX Legend control in Flex 4</title>
		<link>http://blog.flexexamples.com/2010/02/23/setting-the-font-weight-on-the-mx-legend-control-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2010/02/23/setting-the-font-weight-on-the-mx-legend-control-in-flex-4/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 07:08:41 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta2]]></category>
		<category><![CDATA[Charting]]></category>
		<category><![CDATA[Legend]]></category>
		<category><![CDATA[LegendItem]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[fontWeight]]></category>
		<category><![CDATA[Gumbo]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=2511</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/09/25/setting-the-font-weight-on-a-charting-legend-control-in-flex/">&#8220;Setting the font weight on a charting Legend control in Flex&#8221;</a>, we saw how you could set the font weight of a Flex Charting Legend control by setting the fontWeight style on the LegendItem CSS selector.</p> <p>The following example shows how you can set the font weight of an MX [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/09/25/setting-the-font-weight-on-a-charting-legend-control-in-flex/">&#8220;Setting the font weight on a charting Legend control in Flex&#8221;</a>, we saw how you could set the font weight of a Flex Charting Legend control by setting the <code>fontWeight</code> style on the LegendItem CSS selector.</p>
<p>The following example shows how you can set the font weight of an MX Legend control by setting the <code>fontWeight</code> style on the LegendItem CSS selector in Flex 4.</p>
<p><span id="more-2511"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2010/02/23/setting-the-font-weight-on-the-mx-legend-control-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;MX_LegendItem_fontWeight_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/mx&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        @namespace s &quot;library://ns.adobe.com/flex/spark&quot;;
        @namespace mx &quot;library://ns.adobe.com/flex/mx&quot;;
&nbsp;
        mx|LegendItem {
            fontWeight: normal;
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:XMLListCollection</span> id=<span style="color: #ff0000;">&quot;dp&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:source</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:XMLList</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 1&quot;</span> data=<span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 2&quot;</span> data=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 3&quot;</span> data=<span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 4&quot;</span> data=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 5&quot;</span> data=<span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 6&quot;</span> data=<span style="color: #ff0000;">&quot;9&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:XMLList</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:source</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:XMLListCollection</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Panel</span> left=<span style="color: #ff0000;">&quot;20&quot;</span> right=<span style="color: #ff0000;">&quot;20&quot;</span> top=<span style="color: #ff0000;">&quot;20&quot;</span> bottom=<span style="color: #ff0000;">&quot;20&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Legend</span> dataProvider=<span style="color: #ff0000;">&quot;{pieChart}&quot;</span></span>
<span style="color: #000000;">                    direction=<span style="color: #ff0000;">&quot;horizontal&quot;</span></span>
<span style="color: #000000;">                    horizontalGap=<span style="color: #ff0000;">&quot;100&quot;</span></span>
<span style="color: #000000;">                    width=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:PieChart</span> id=<span style="color: #ff0000;">&quot;pieChart&quot;</span></span>
<span style="color: #000000;">                dataProvider=<span style="color: #ff0000;">&quot;{dp}&quot;</span></span>
<span style="color: #000000;">                showDataTips=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                height=<span style="color: #ff0000;">&quot;100%&quot;</span></span>
<span style="color: #000000;">                width=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:series</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:PieSeries</span> id=<span style="color: #ff0000;">&quot;pieSeries&quot;</span></span>
<span style="color: #000000;">                        field=<span style="color: #ff0000;">&quot;@data&quot;</span></span>
<span style="color: #000000;">                        nameField=<span style="color: #ff0000;">&quot;@label&quot;</span></span>
<span style="color: #000000;">                        filters=<span style="color: #ff0000;">&quot;[]&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:series</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:PieChart</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Panel</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<div span="googleAdsLeaderboard">
<script type="text/javascript"><!--
google_ad_client = "pub-3325829455487492";
/* 728x90, created 7/15/09 */
google_ad_slot = "6403511741";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<br />
</div>
<p class="information"><a href="http://dl.dropbox.com/u/4509565/FlexExamples_com/MX_LegendItem_fontWeight_test/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://dl.dropbox.com/u/4509565/FlexExamples_com/MX_LegendItem_fontWeight_test/main.html" width="100%" height="300"></iframe></p>
<p>Or, if you wanted to use an embedded font, you could use the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2010/02/23/setting-the-font-weight-on-the-mx-legend-control-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;MX_LegendItem_fontWeight_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/mx&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        @namespace s &quot;library://ns.adobe.com/flex/spark&quot;;
        @namespace mx &quot;library://ns.adobe.com/flex/mx&quot;;
&nbsp;
        @font-face {
            src: url(&quot;C:/Windows/Fonts/comic.ttf&quot;);
            fontFamily: myEmbeddedFont;
            fontWeight: normal;
            embedAsCFF: false;
        }
&nbsp;
        mx|LegendItem {
            color: white;
            fontFamily: myEmbeddedFont;
            fontSize: 16;
            fontWeight: normal;
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:XMLListCollection</span> id=<span style="color: #ff0000;">&quot;dp&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:source</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:XMLList</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 1&quot;</span> data=<span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 2&quot;</span> data=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 3&quot;</span> data=<span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 4&quot;</span> data=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 5&quot;</span> data=<span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 6&quot;</span> data=<span style="color: #ff0000;">&quot;9&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:XMLList</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:source</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:XMLListCollection</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Panel</span> left=<span style="color: #ff0000;">&quot;20&quot;</span> right=<span style="color: #ff0000;">&quot;20&quot;</span> top=<span style="color: #ff0000;">&quot;20&quot;</span> bottom=<span style="color: #ff0000;">&quot;20&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Legend</span> dataProvider=<span style="color: #ff0000;">&quot;{pieChart}&quot;</span></span>
<span style="color: #000000;">                    direction=<span style="color: #ff0000;">&quot;horizontal&quot;</span></span>
<span style="color: #000000;">                    horizontalGap=<span style="color: #ff0000;">&quot;100&quot;</span></span>
<span style="color: #000000;">                    width=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:PieChart</span> id=<span style="color: #ff0000;">&quot;pieChart&quot;</span></span>
<span style="color: #000000;">                dataProvider=<span style="color: #ff0000;">&quot;{dp}&quot;</span></span>
<span style="color: #000000;">                showDataTips=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                height=<span style="color: #ff0000;">&quot;100%&quot;</span></span>
<span style="color: #000000;">                width=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:series</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:PieSeries</span> id=<span style="color: #ff0000;">&quot;pieSeries&quot;</span></span>
<span style="color: #000000;">                        field=<span style="color: #ff0000;">&quot;@data&quot;</span></span>
<span style="color: #000000;">                        nameField=<span style="color: #ff0000;">&quot;@label&quot;</span></span>
<span style="color: #000000;">                        filters=<span style="color: #ff0000;">&quot;[]&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:series</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:PieChart</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Panel</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="alert">This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the font weight on the MX Legend control in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/02/23/setting-the-font-weight-on-the-mx-legend-control-in-flex-4/',contentID: 'post-2511',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'fontWeight,Gumbo',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2010/02/23/setting-the-font-weight-on-the-mx-legend-control-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting the horizontal and vertical gaps on a Legend control in Flex</title>
		<link>http://blog.flexexamples.com/2008/09/29/setting-the-horizontal-and-vertical-gaps-on-a-legend-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/09/29/setting-the-horizontal-and-vertical-gaps-on-a-legend-control-in-flex/#comments</comments>
		<pubDate>Tue, 30 Sep 2008 06:57:03 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[Legend]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[horizontalGap]]></category>
		<category><![CDATA[verticalGap]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/29/setting-the-horizontal-and-vertical-gaps-on-a-legend-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set the horizontal and vertical gaps on a Flex Legend control by setting the horizontalGap and verticalGap styles.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/09/29/setting-the-horizontal-and-vertical-gaps-on-a-legend-control-in-flex/ --&#62; &#60;mx:Application name="Legend_horizontalGap_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:XMLListCollection id="dp"&#62; &#60;mx:source&#62; &#60;mx:XMLList&#62; &#60;product label="Product 1" data="3" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the horizontal and vertical gaps on a Flex Legend control by setting the <code>horizontalGap</code> and <code>verticalGap</code> styles.</p>
<p>Full code after the jump.</p>
<p><span id="more-812"></span></p>
<p class="download"><a href="">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/29/setting-the-horizontal-and-vertical-gaps-on-a-legend-control-in-flex/ --&gt;
&lt;mx:Application name="Legend_horizontalGap_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="horizontalGap:"&gt;
                &lt;mx:HSlider id="sliderHGap"
                        minimum="0"
                        maximum="100"
                        snapInterval="1"
                        tickInterval="25"
                        liveDragging="true"
                        dataTipPrecision="0" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="verticalGap:"&gt;
                &lt;mx:HSlider id="sliderVGap"
                        minimum="0"
                        maximum="100"
                        snapInterval="1"
                        tickInterval="25"
                        liveDragging="true"
                        dataTipPrecision="0" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="{sliderHGap.value}"
                    verticalGap="{sliderVGap.value}"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p>You can also set the <code>horizontalGap</code> and <code>verticalGap</code> styles in an external .CSS file or &lt;mx:Style /&gt; block, as seen in the following example:</p>
<p class="download"><a href="">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/29/setting-the-horizontal-and-vertical-gaps-on-a-legend-control-in-flex/ --&gt;
&lt;mx:Application name="Legend_horizontalGap_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        Legend {
            horizontalGap: 100;
            verticalGap: 30;
        }
    &lt;/mx:Style&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend dataProvider="{pieChart}"
                    direction="horizontal"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p>Or, you can set the <code>horizontalGap</code> and <code>verticalGap</code> styles using ActionScript, as seen in the following example:</p>
<p class="download"><a href="">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/29/setting-the-horizontal-and-vertical-gaps-on-a-legend-control-in-flex/ --&gt;
&lt;mx:Application name="Legend_horizontalGap_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.SliderEvent;

            private function sliderHGap_change(evt:SliderEvent):void {
                legend.setStyle("horizontalGap", evt.value);
            }

            private function sliderVGap_change(evt:SliderEvent):void {
                legend.setStyle("verticalGap", evt.value);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="horizontalGap:"&gt;
                &lt;mx:HSlider id="sliderHGap"
                        minimum="0"
                        maximum="100"
                        value="8"
                        snapInterval="1"
                        tickInterval="25"
                        liveDragging="true"
                        dataTipPrecision="0"
                        change="sliderHGap_change(event);" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="verticalGap:"&gt;
                &lt;mx:HSlider id="sliderVGap"
                        minimum="0"
                        maximum="100"
                        value="6"
                        snapInterval="1"
                        tickInterval="25"
                        liveDragging="true"
                        dataTipPrecision="0"
                        change="sliderVGap_change(event);" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend id="legend"
                    dataProvider="{pieChart}"
                    direction="horizontal"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the horizontal and vertical gaps on a Legend control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/09/29/setting-the-horizontal-and-vertical-gaps-on-a-legend-control-in-flex/',contentID: 'post-812',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'horizontalGap,verticalGap',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/09/29/setting-the-horizontal-and-vertical-gaps-on-a-legend-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting the marker width and height on a Legend control in Flex</title>
		<link>http://blog.flexexamples.com/2008/09/28/setting-the-marker-width-and-height-on-a-legend-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/09/28/setting-the-marker-width-and-height-on-a-legend-control-in-flex/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 06:58:56 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[Legend]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[markerHeight]]></category>
		<category><![CDATA[markerWidth]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/28/setting-the-marker-width-and-height-on-a-legend-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set the marker width and marker height on a Flex Legend control by setting the markerWidth and markerHeight styles.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Legend_markerHeight_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/09/28/setting-the-marker-width-and-height-on-a-legend-control-in-flex/ --&#62; &#60;mx:Application name="Legend_markerHeight_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:XMLListCollection id="dp"&#62; &#60;mx:source&#62; &#60;mx:XMLList&#62; &#60;product label="Product 1" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the marker width and marker height on a Flex Legend control by setting the <code>markerWidth</code> and <code>markerHeight</code> styles.</p>
<p>Full code after the jump.</p>
<p><span id="more-811"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Legend_markerHeight_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/28/setting-the-marker-width-and-height-on-a-legend-control-in-flex/ --&gt;
&lt;mx:Application name="Legend_markerHeight_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="markerWidth:"&gt;
                &lt;mx:HSlider id="markerWSlider"
                        minimum="5"
                        maximum="15"
                        value="10"
                        snapInterval="1"
                        tickInterval="1"
                        liveDragging="true" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="markerHeight:"&gt;
                &lt;mx:HSlider id="markerHSlider"
                        minimum="5"
                        maximum="15"
                        value="10"
                        snapInterval="1"
                        tickInterval="1"
                        liveDragging="true" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel id="panel"
            styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                showDataTips="true"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar&gt;
            &lt;mx:Legend id="legend"
                    dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    markerWidth="{markerWSlider.value}"
                    markerHeight="{markerHSlider.value}" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Legend_markerHeight_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/Legend_markerHeight_test/bin/main.html" width="100%" height="500"></iframe></p>
<p>You can also set the <code>markerWidth</code> and <code>markerHeight</code> styles in an external .CSS file or &lt;mx:Style /&gt; block, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Legend_markerHeight_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/28/setting-the-marker-width-and-height-on-a-legend-control-in-flex/ --&gt;
&lt;mx:Application name="Legend_markerHeight_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        Legend {
            markerWidth: 5;
            markerHeight: 5;
        }
    &lt;/mx:Style&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:Panel id="panel"
            styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                showDataTips="true"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar&gt;
            &lt;mx:Legend id="legend"
                    dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p>Or, you can set the <code>markerWidth</code> and <code>markerHeight</code> styles using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Legend_markerHeight_test/bin/srcview/source/main3.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/28/setting-the-marker-width-and-height-on-a-legend-control-in-flex/ --&gt;
&lt;mx:Application name="Legend_markerHeight_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.SliderEvent;

            private function markerWSlider_change(evt:SliderEvent):void {
                legend.setStyle("markerWidth", evt.value);
            }

            private function markerHSlider_change(evt:SliderEvent):void {
                legend.setStyle("markerHeight", evt.value);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="markerWidth:"&gt;
                &lt;mx:HSlider id="markerWSlider"
                        minimum="5"
                        maximum="15"
                        value="10"
                        snapInterval="1"
                        tickInterval="1"
                        liveDragging="true"
                        change="markerWSlider_change(event);" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="markerHeight:"&gt;
                &lt;mx:HSlider id="markerHSlider"
                        minimum="5"
                        maximum="15"
                        value="10"
                        snapInterval="1"
                        tickInterval="1"
                        liveDragging="true"
                        change="markerHSlider_change(event);" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel id="panel"
            styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                showDataTips="true"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar&gt;
            &lt;mx:Legend id="legend"
                    dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    markerWidth="10"
                    markerHeight="10" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Legend_markerHeight_test/bin/srcview/source/main4.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/28/setting-the-marker-width-and-height-on-a-legend-control-in-flex/ --&gt;
&lt;mx:Application name="Legend_markerHeight_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.charts.Legend;
            import mx.charts.PieChart;
            import mx.charts.series.PieSeries;
            import mx.collections.XMLListCollection;
            import mx.containers.ApplicationControlBar;
            import mx.containers.ControlBar;
            import mx.containers.Form;
            import mx.containers.FormItem;
            import mx.containers.Panel;
            import mx.containers.TileDirection;
            import mx.controls.HSlider;
            import mx.events.SliderEvent;

            private var dp:XMLListCollection;
            private var legend:Legend;
            private var markerHSlider:HSlider;
            private var markerWSlider:HSlider;
            private var panel:Panel;
            private var pieChart:PieChart;
            private var pieSeries:PieSeries;

            private function init():void {
                var xmlDP:XML = &lt;products&gt;
                            &lt;product label="Product 1" data="3" /&gt;
                            &lt;product label="Product 2" data="1" /&gt;
                            &lt;product label="Product 3" data="4" /&gt;
                            &lt;product label="Product 4" data="1" /&gt;
                            &lt;product label="Product 5" data="5" /&gt;
                            &lt;product label="Product 6" data="9" /&gt;
                        &lt;/products&gt;;

                dp = new XMLListCollection(xmlDP.product);

                markerWSlider = new HSlider();
                markerWSlider.minimum = 5;
                markerWSlider.maximum = 15;
                markerWSlider.value = 10;
                markerWSlider.snapInterval = 1;
                markerWSlider.tickInterval = 1;
                markerWSlider.liveDragging = true;
                markerWSlider.addEventListener(SliderEvent.CHANGE,
                            markerWSlider_change);

                markerHSlider = new HSlider();
                markerHSlider.minimum = 5;
                markerHSlider.maximum = 15;
                markerHSlider.value = 10;
                markerHSlider.snapInterval = 1;
                markerHSlider.tickInterval = 1;
                markerHSlider.liveDragging = true;
                markerHSlider.addEventListener(SliderEvent.CHANGE,
                            markerHSlider_change);

                var formItem1:FormItem = new FormItem();
                formItem1.label = "markerWidth:";
                formItem1.addChild(markerWSlider);

                var formItem2:FormItem = new FormItem();
                formItem2.label = "markerHeight:";
                formItem2.addChild(markerHSlider);

                var form:Form = new Form();
                form.styleName = "plain";
                form.addChild(formItem1);
                form.addChild(formItem2);

                var appControlBar:ApplicationControlBar;
                appControlBar = new ApplicationControlBar();
                appControlBar.dock = true;
                appControlBar.addChild(form);
                addChildAt(appControlBar, 0);

                pieSeries = new PieSeries();
                pieSeries.field = "@data";
                pieSeries.nameField = "@label";
                pieSeries.filters = [];

                pieChart = new PieChart();
                pieChart.dataProvider = dp;
                pieChart.showDataTips = true;
                pieChart.percentWidth = 100;
                pieChart.percentHeight = 100;
                pieChart.series = [pieSeries];

                legend = new Legend();
                legend.dataProvider = pieChart;
                legend.direction = TileDirection.HORIZONTAL;
                legend.setStyle("horizontalGap", 100);
                legend.setStyle("markerWidth", markerWSlider.value);
                legend.setStyle("markerHeight", markerHSlider.value);

                var controlBar:ControlBar = new ControlBar();
                controlBar.addChild(legend);

                panel = new Panel();
                panel.styleName = "opaquePanel";
                panel.percentWidth = 100;
                panel.percentHeight = 100;
                panel.addChild(pieChart);
                panel.addChild(controlBar);
                addChild(panel);
            }

            private function markerWSlider_change(evt:SliderEvent):void {
                legend.setStyle("markerWidth", evt.value);
            }

            private function markerHSlider_change(evt:SliderEvent):void {
                legend.setStyle("markerHeight", evt.value);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the marker width and height on a Legend control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/09/28/setting-the-marker-width-and-height-on-a-legend-control-in-flex/',contentID: 'post-811',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'markerHeight,markerWidth',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/09/28/setting-the-marker-width-and-height-on-a-legend-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting the label placement on a Legend control in Flex</title>
		<link>http://blog.flexexamples.com/2008/09/27/setting-the-label-placement-on-a-legend-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/09/27/setting-the-label-placement-on-a-legend-control-in-flex/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 05:28:47 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[Legend]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[labelPlacement]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/27/setting-the-label-placement-on-a-legend-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set the label placement on a Flex Legend control by setting the labelPlacement style.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Legend_labelPlacement_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/09/27/setting-the-label-placement-on-a-legend-control-in-flex/ --&#62; &#60;mx:Application name="Legend_labelPlacement_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:XMLListCollection id="dp"&#62; &#60;mx:source&#62; &#60;mx:XMLList&#62; &#60;product label="Product 1" data="3" /&#62; &#60;product label="Product 2" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the label placement on a Flex Legend control by setting the <code>labelPlacement</code> style.</p>
<p>Full code after the jump.</p>
<p><span id="more-810"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Legend_labelPlacement_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/27/setting-the-label-placement-on-a-legend-control-in-flex/ --&gt;
&lt;mx:Application name="Legend_labelPlacement_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="direction:"&gt;
                &lt;mx:ComboBox id="directionCB"&gt;
                    &lt;mx:dataProvider&gt;
                        &lt;mx:Array&gt;
                            &lt;mx:Object label="horizontal" /&gt;
                            &lt;mx:Object label="vertical" /&gt;
                        &lt;/mx:Array&gt;
                    &lt;/mx:dataProvider&gt;
                &lt;/mx:ComboBox&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="labelPlacement:"&gt;
                &lt;mx:ComboBox id="labelPlacementCB" selectedIndex="1"&gt;
                    &lt;mx:dataProvider&gt;
                        &lt;mx:Array&gt;
                            &lt;mx:Object label="left" /&gt;
                            &lt;mx:Object label="right" /&gt;
                        &lt;/mx:Array&gt;
                    &lt;/mx:dataProvider&gt;
                &lt;/mx:ComboBox&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend dataProvider="{pieChart}"
                    direction="{directionCB.value}"
                    labelPlacement="{labelPlacementCB.value}"
                    horizontalGap="100"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Legend_labelPlacement_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/Legend_labelPlacement_test/bin/main.html" width="100%" height="500"></iframe></p>
<p>You can also set the <code>labelPlacement</code> style in an external .CSS file or &lt;mx:Style /&gt; block, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Legend_labelPlacement_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/27/setting-the-label-placement-on-a-legend-control-in-flex/ --&gt;
&lt;mx:Application name="Legend_labelPlacement_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        Legend {
            labelPlacement: left;
        }
    &lt;/mx:Style&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="direction:"&gt;
                &lt;mx:ComboBox id="directionCB"&gt;
                    &lt;mx:dataProvider&gt;
                        &lt;mx:Array&gt;
                            &lt;mx:Object label="horizontal" /&gt;
                            &lt;mx:Object label="vertical" /&gt;
                        &lt;/mx:Array&gt;
                    &lt;/mx:dataProvider&gt;
                &lt;/mx:ComboBox&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend dataProvider="{pieChart}"
                    direction="{directionCB.value}"
                    horizontalGap="100"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p>Or, you can set the <code>labelPlacement</code> style using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Legend_labelPlacement_test/bin/srcview/source/main3.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/27/setting-the-label-placement-on-a-legend-control-in-flex/ --&gt;
&lt;mx:Application name="Legend_labelPlacement_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.ListEvent;

            private function directionCB_change(evt:ListEvent):void {
                legend.direction = directionCB.value.toString();
            }

            private function labelPlacementCB_change(evt:ListEvent):void {
                legend.setStyle("labelPlacement", labelPlacementCB.value);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="direction:"&gt;
                &lt;mx:ComboBox id="directionCB"
                        change="directionCB_change(event);"&gt;
                    &lt;mx:dataProvider&gt;
                        &lt;mx:Array&gt;
                            &lt;mx:Object label="horizontal" /&gt;
                            &lt;mx:Object label="vertical" /&gt;
                        &lt;/mx:Array&gt;
                    &lt;/mx:dataProvider&gt;
                &lt;/mx:ComboBox&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="labelPlacement:"&gt;
                &lt;mx:ComboBox id="labelPlacementCB"
                        selectedIndex="1"
                        change="labelPlacementCB_change(event);"&gt;
                    &lt;mx:dataProvider&gt;
                        &lt;mx:Array&gt;
                            &lt;mx:Object label="left" /&gt;
                            &lt;mx:Object label="right" /&gt;
                        &lt;/mx:Array&gt;
                    &lt;/mx:dataProvider&gt;
                &lt;/mx:ComboBox&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend id="legend"
                    dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Legend_labelPlacement_test/bin/srcview/source/main4.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/27/setting-the-label-placement-on-a-legend-control-in-flex/ --&gt;
&lt;mx:Application name="Legend_labelPlacement_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.charts.Legend;
            import mx.charts.PieChart;
            import mx.charts.series.PieSeries;
            import mx.collections.XMLListCollection;
            import mx.containers.ApplicationControlBar;
            import mx.containers.ControlBar;
            import mx.containers.Form;
            import mx.containers.FormItem;
            import mx.containers.Panel;
            import mx.containers.TileDirection;
            import mx.controls.ButtonLabelPlacement;
            import mx.controls.ComboBox;
            import mx.events.ListEvent;

            private var directionCB:ComboBox;
            private var dp:XMLListCollection;
            private var labelPlacementCB:ComboBox;
            private var legend:Legend;
            private var panel:Panel;
            private var pieChart:PieChart;
            private var pieSeries:PieSeries;

            private function init():void {
                var data:XML = &lt;products&gt;
                            &lt;product label="Product 1" data="3" /&gt;
                            &lt;product label="Product 2" data="1" /&gt;
                            &lt;product label="Product 3" data="4" /&gt;
                            &lt;product label="Product 4" data="1" /&gt;
                            &lt;product label="Product 5" data="5" /&gt;
                            &lt;product label="Product 6" data="9" /&gt;
                        &lt;/products&gt;;

                dp = new XMLListCollection(data.product);

                var directionDP:Array = [];
                directionDP.push({label:TileDirection.HORIZONTAL});
                directionDP.push({label:TileDirection.VERTICAL});

                directionCB = new ComboBox();
                directionCB.dataProvider = directionDP;
                directionCB.addEventListener(ListEvent.CHANGE,
                            directionCB_change);

                var labelPlacementDP:Array = [];
                labelPlacementDP.push({label:ButtonLabelPlacement.LEFT});
                labelPlacementDP.push({label:ButtonLabelPlacement.RIGHT});

                labelPlacementCB = new ComboBox();
                labelPlacementCB.dataProvider = labelPlacementDP;
                labelPlacementCB.selectedIndex = 1;
                labelPlacementCB.addEventListener(ListEvent.CHANGE,
                            labelPlacementCB_change);

                var formItem1:FormItem = new FormItem();
                formItem1.label = "direction:";
                formItem1.addChild(directionCB);

                var formItem2:FormItem = new FormItem();
                formItem2.label = "labelPlacement:";
                formItem2.addChild(labelPlacementCB);

                var form:Form = new Form();
                form.styleName = "plain";
                form.addChild(formItem1);
                form.addChild(formItem2);

                var appControlBar:ApplicationControlBar;
                appControlBar = new ApplicationControlBar();
                appControlBar.dock = true;
                appControlBar.addChild(form);
                addChildAt(appControlBar, 0);

                pieSeries = new PieSeries();
                pieSeries.field = "@data";
                pieSeries.nameField = "@label";
                pieSeries.filters = [];

                pieChart = new PieChart();
                pieChart.dataProvider = dp;
                pieChart.percentWidth = 100;
                pieChart.percentHeight = 100;
                pieChart.series = [pieSeries];

                legend = new Legend();
                legend.dataProvider = pieChart;
                legend.direction = TileDirection.HORIZONTAL;
                legend.percentWidth = 100;
                legend.setStyle("horizontalGap", 100);

                var controlBar:ControlBar = new ControlBar();
                controlBar.addChild(legend);

                panel = new Panel();
                panel.styleName = "opaquePanel";
                panel.percentWidth = 100;
                panel.percentHeight = 100;
                panel.addChild(pieChart);
                panel.addChild(controlBar);
                addChild(panel);
            }

            private function directionCB_change(evt:ListEvent):void {
                legend.direction = directionCB.value.toString();
            }

            private function labelPlacementCB_change(evt:ListEvent):void {
                legend.setStyle("labelPlacement", labelPlacementCB.value);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the label placement on a Legend control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/09/27/setting-the-label-placement-on-a-legend-control-in-flex/',contentID: 'post-810',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'labelPlacement',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/09/27/setting-the-label-placement-on-a-legend-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting a custom label function on a PieChart in Flex</title>
		<link>http://blog.flexexamples.com/2008/09/26/setting-a-custom-label-function-on-a-piechart-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/09/26/setting-a-custom-label-function-on-a-piechart-in-flex/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 13:02:21 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[PieSeries]]></category>
		<category><![CDATA[labelFunction]]></category>
		<category><![CDATA[labelPosition]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/26/setting-a-custom-label-function-on-a-piechart-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set a custom label function on a Flex PieChart control by setting the labelFunction property on the PieSeries object.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_labelFunction_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/09/26/setting-a-custom-label-function-on-a-piechart-in-flex/ --&#62; &#60;mx:Application name="PieSeries_labelFunction_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.utils.StringUtil; private function pieSeries_labelFunc(item:Object, [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set a custom label function on a Flex PieChart control by setting the <code>labelFunction</code> property on the PieSeries object.</p>
<p>Full code after the jump.</p>
<p><span id="more-808"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_labelFunction_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/26/setting-a-custom-label-function-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieSeries_labelFunction_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.utils.StringUtil;

            private function pieSeries_labelFunc(item:Object, field:String, index:Number, percentValue:Number):String {
                return StringUtil.substitute("{0} ({1}%)",
                            item.@label,
                            percentValue.toFixed(1));
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                showDataTips="false"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        labelPosition="callout"
                        labelFunction="pieSeries_labelFunc" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_labelFunction_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PieSeries_labelFunction_test/bin/main.html" width="100%" height="500"></iframe></p>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_labelFunction_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/26/setting-a-custom-label-function-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieSeries_labelFunction_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.charts.Legend;
            import mx.charts.PieChart;
            import mx.charts.chartClasses.Series;
            import mx.charts.series.PieSeries;
            import mx.collections.XMLListCollection;
            import mx.containers.ControlBar;
            import mx.containers.Panel;
            import mx.containers.TileDirection;
            import mx.utils.StringUtil;

            private var dp:XMLListCollection;
            private var legend:Legend;
            private var panel:Panel;
            private var pieChart:PieChart;
            private var pieSeries:PieSeries;

            private function init():void {
                var productsXML:XML = &lt;products&gt;
                            &lt;product label="Product 1" data="3" /&gt;
                            &lt;product label="Product 2" data="1" /&gt;
                            &lt;product label="Product 3" data="4" /&gt;
                            &lt;product label="Product 4" data="1" /&gt;
                            &lt;product label="Product 5" data="5" /&gt;
                            &lt;product label="Product 6" data="9" /&gt;
                        &lt;/products&gt;;

                dp = new XMLListCollection(productsXML.product);

                pieSeries = new PieSeries();
                pieSeries.field = "@data";
                pieSeries.nameField = "@label";
                pieSeries.labelFunction = pieSeries_labelFunc;
                pieSeries.setStyle("labelPosition", "callout");

                pieChart = new PieChart();
                pieChart.dataProvider = dp;
                pieChart.showDataTips = false;
                pieChart.percentWidth = 100;
                pieChart.percentHeight = 100;
                pieChart.series = [pieSeries];

                legend = new Legend();
                legend.dataProvider = pieChart;
                legend.direction = TileDirection.HORIZONTAL;
                legend.setStyle("horizontalGap", 100);
                legend.percentWidth = 100;

                var controlBar:ControlBar = new ControlBar();
                controlBar.percentWidth = 100;
                controlBar.addChild(legend);

                panel = new Panel();
                panel.styleName = "opaquePanel";
                panel.percentWidth = 100;
                panel.percentHeight = 100;
                panel.addChild(pieChart);
                panel.addChild(controlBar);
                addChild(panel);
            }

            private function pieSeries_labelFunc(item:Object, field:String, index:Number, percentValue:Number):String {
                return StringUtil.substitute("{0} ({1}%)",
                            item.@label,
                            percentValue.toFixed(1));
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting a custom label function on a PieChart in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/09/26/setting-a-custom-label-function-on-a-piechart-in-flex/',contentID: 'post-808',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'labelFunction,labelPosition',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/09/26/setting-a-custom-label-function-on-a-piechart-in-flex/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Setting the font weight on a charting Legend control in Flex</title>
		<link>http://blog.flexexamples.com/2008/09/25/setting-the-font-weight-on-a-charting-legend-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/09/25/setting-the-font-weight-on-a-charting-legend-control-in-flex/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 06:31:23 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[Legend]]></category>
		<category><![CDATA[LegendItem]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[fontWeight]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/25/setting-the-font-weight-on-a-charting-legend-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set the font weight of a Flex Charting Legend control by setting the fontWeight style on the LegendItem CSS selector.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2008/09/25/setting-the-font-weight-on-a-charting-legend-control-in-flex/ --&#62; &#60;mx:Application name=&#34;LegendItem_fontWeight_test&#34; xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;vertical&#34; verticalAlign=&#34;middle&#34; backgroundColor=&#34;white&#34;&#62; &#160; &#60;mx:Style&#62; LegendItem { fontWeight: normal; } &#60;/mx:Style&#62; &#160; &#60;mx:XMLListCollection id=&#34;dp&#34;&#62; &#60;mx:source&#62; &#60;mx:XMLList&#62; &#60;product label=&#34;Product [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the font weight of a Flex Charting Legend control by setting the <code>fontWeight</code> style on the LegendItem CSS selector.</p>
<p><span id="more-807"></span></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2008/09/25/setting-the-font-weight-on-a-charting-legend-control-in-flex/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;LegendItem_fontWeight_test&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        LegendItem {
            fontWeight: normal;
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:XMLListCollection</span> id=<span style="color: #ff0000;">&quot;dp&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:source</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:XMLList</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 1&quot;</span> data=<span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 2&quot;</span> data=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 3&quot;</span> data=<span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 4&quot;</span> data=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 5&quot;</span> data=<span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;">&lt;product label=<span style="color: #ff0000;">&quot;Product 6&quot;</span> data=<span style="color: #ff0000;">&quot;9&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:XMLList</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:source</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:XMLListCollection</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Panel</span> styleName=<span style="color: #ff0000;">&quot;opaquePanel&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;100%&quot;</span></span>
<span style="color: #000000;">            height=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:PieChart</span> id=<span style="color: #ff0000;">&quot;pieChart&quot;</span></span>
<span style="color: #000000;">                dataProvider=<span style="color: #ff0000;">&quot;{dp}&quot;</span></span>
<span style="color: #000000;">                showDataTips=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                height=<span style="color: #ff0000;">&quot;100%&quot;</span></span>
<span style="color: #000000;">                width=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:series</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:PieSeries</span> id=<span style="color: #ff0000;">&quot;pieSeries&quot;</span></span>
<span style="color: #000000;">                        field=<span style="color: #ff0000;">&quot;@data&quot;</span></span>
<span style="color: #000000;">                        nameField=<span style="color: #ff0000;">&quot;@label&quot;</span></span>
<span style="color: #000000;">                        filters=<span style="color: #ff0000;">&quot;[]&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:series</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:PieChart</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ControlBar</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Legend</span> dataProvider=<span style="color: #ff0000;">&quot;{pieChart}&quot;</span></span>
<span style="color: #000000;">                    direction=<span style="color: #ff0000;">&quot;horizontal&quot;</span></span>
<span style="color: #000000;">                    horizontalGap=<span style="color: #ff0000;">&quot;100&quot;</span></span>
<span style="color: #000000;">                    width=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ControlBar</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Panel</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/LegendItem_fontWeight_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/LegendItem_fontWeight_test/bin/main.html" width="100%" height="500"></iframe></p>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2008/09/25/setting-the-font-weight-on-a-charting-legend-control-in-flex/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;LegendItem_fontWeight_test&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span></span>
<span style="color: #000000;">        initialize=<span style="color: #ff0000;">&quot;init();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            import mx.charts.Legend;</span>
<span style="color: #339933;">            import mx.charts.PieChart;</span>
<span style="color: #339933;">            import mx.charts.series.PieSeries;</span>
<span style="color: #339933;">            import mx.collections.XMLListCollection;</span>
<span style="color: #339933;">            import mx.containers.ControlBar;</span>
<span style="color: #339933;">            import mx.containers.Panel;</span>
<span style="color: #339933;">            import mx.containers.TileDirection;</span>
&nbsp;
<span style="color: #339933;">            private var dp:XMLListCollection;</span>
<span style="color: #339933;">            private var legend:Legend;</span>
<span style="color: #339933;">            private var panel:Panel;</span>
<span style="color: #339933;">            private var pieChart:PieChart;</span>
<span style="color: #339933;">            private var pieSeries:PieSeries;</span>
&nbsp;
<span style="color: #339933;">            private function init():void {</span>
<span style="color: #339933;">                dp = new XMLListCollection();</span>
<span style="color: #339933;">                dp.addItem(&lt;product label=&quot;Product 1&quot; data=&quot;3&quot; /&gt;);</span>
<span style="color: #339933;">                dp.addItem(&lt;product label=&quot;Product 2&quot; data=&quot;1&quot; /&gt;);</span>
<span style="color: #339933;">                dp.addItem(&lt;product label=&quot;Product 3&quot; data=&quot;4&quot; /&gt;);</span>
<span style="color: #339933;">                dp.addItem(&lt;product label=&quot;Product 4&quot; data=&quot;1&quot; /&gt;);</span>
<span style="color: #339933;">                dp.addItem(&lt;product label=&quot;Product 5&quot; data=&quot;5&quot; /&gt;);</span>
<span style="color: #339933;">                dp.addItem(&lt;product label=&quot;Product 6&quot; data=&quot;9&quot; /&gt;);</span>
&nbsp;
<span style="color: #339933;">                pieSeries = new PieSeries();</span>
<span style="color: #339933;">                pieSeries.field = &quot;@data&quot;;</span>
<span style="color: #339933;">                pieSeries.nameField = &quot;@label&quot;;</span>
<span style="color: #339933;">                pieSeries.filters = [];</span>
&nbsp;
<span style="color: #339933;">                pieChart = new PieChart();</span>
<span style="color: #339933;">                pieChart.dataProvider = dp;</span>
<span style="color: #339933;">                pieChart.showDataTips = true;</span>
<span style="color: #339933;">                pieChart.percentWidth = 100;</span>
<span style="color: #339933;">                pieChart.percentHeight = 100;</span>
<span style="color: #339933;">                pieChart.series = [pieSeries];</span>
&nbsp;
<span style="color: #339933;">                legend = new Legend();</span>
<span style="color: #339933;">                legend.dataProvider = pieChart;</span>
<span style="color: #339933;">                legend.direction = TileDirection.HORIZONTAL;</span>
<span style="color: #339933;">                legend.percentWidth = 100;</span>
<span style="color: #339933;">                legend.setStyle(&quot;horizontalGap&quot;, 100);</span>
&nbsp;
<span style="color: #339933;">                var controlBar:ControlBar = new ControlBar();</span>
<span style="color: #339933;">                controlBar.percentWidth = 100;</span>
<span style="color: #339933;">                controlBar.addChild(legend);</span>
&nbsp;
<span style="color: #339933;">                panel = new Panel();</span>
<span style="color: #339933;">                panel.styleName = &quot;opaquePanel&quot;;</span>
<span style="color: #339933;">                panel.percentWidth = 100;</span>
<span style="color: #339933;">                panel.percentHeight = 100;</span>
<span style="color: #339933;">                panel.addChild(pieChart);</span>
<span style="color: #339933;">                panel.addChild(legend);</span>
<span style="color: #339933;">                addChild(panel);</span>
&nbsp;
<span style="color: #339933;">                var legendItemCSS:CSSStyleDeclaration;</span>
<span style="color: #339933;">                legendItemCSS = StyleManager.getStyleDeclaration(&quot;LegendItem&quot;);</span>
<span style="color: #339933;">                legendItemCSS.setStyle(&quot;fontWeight&quot;, &quot;normal&quot;);</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="new">For an example of changing the <code>fontWeight</code> style on the MX Legend control in Flex 4, see <a href="http://blog.flexexamples.com/2010/02/23/setting-the-font-weight-on-the-mx-legend-control-in-flex-4/">&#8220;Setting the font weight on the MX Legend control in Flex 4&#8243;</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the font weight on a charting Legend control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/09/25/setting-the-font-weight-on-a-charting-legend-control-in-flex/',contentID: 'post-807',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'fontWeight',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/09/25/setting-the-font-weight-on-a-charting-legend-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Toggling data tip targets on a PieChart in Flex</title>
		<link>http://blog.flexexamples.com/2008/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 05:19:59 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[showDataTips]]></category>
		<category><![CDATA[showDataTipTargets]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/">&#8220;Toggling data tips on a PieChart in Flex&#8221;</a>, we saw how you could toggle data tips on a Flex PieChart control by setting the showDataTips property.</p> <p>The following example shows how you can toggle data tip targets on a Flex PieChart control by setting the showDataTipTargets style.</p> <p>Full code after [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/">&#8220;Toggling data tips on a PieChart in Flex&#8221;</a>, we saw how you could toggle data tips on a Flex PieChart control by setting the <code>showDataTips</code> property.</p>
<p>The following example shows how you can toggle data tip targets on a Flex PieChart control by setting the <code>showDataTipTargets</code> style.</p>
<p>Full code after the jump.</p>
<p><span id="more-796"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTipTargets_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieChart_showDataTipTargets_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="showDataTipTargets:"
                labelPlacement="left"
                selected="true" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                showDataTips="true"
                showDataTipTargets="{checkBox.selected}"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTipTargets_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTipTargets_test/bin/main.html" width="100%" height="600"></iframe></p>
<p>You can also set the <code>showDataTipTargets</code> style in an external .CSS file or &lt;mx:Style /&gt; block, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTipTargets_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieChart_showDataTipTargets_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        PieChart {
            showDataTipTargets: false;
        }
    &lt;/mx:Style&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                showDataTips="true"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p>Or, you can set the <code>showDataTipTargets</code> style using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTipTargets_test/bin/srcview/source/main3.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieChart_showDataTipTargets_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function checkBox_change(evt:Event):void {
                pieChart.setStyle("showDataTipTargets", checkBox.selected);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="showDataTipTargets:"
                labelPlacement="left"
                selected="true"
                change="checkBox_change(event);" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                showDataTips="true"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTipTargets_test/bin/srcview/source/main4.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieChart_showDataTipTargets_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.charts.Legend;
            import mx.charts.PieChart;
            import mx.charts.series.PieSeries;
            import mx.collections.XMLListCollection;
            import mx.containers.ApplicationControlBar;
            import mx.containers.ControlBar;
            import mx.containers.Panel;
            import mx.containers.TileDirection;
            import mx.controls.ButtonLabelPlacement;
            import mx.controls.CheckBox;

            private var dp:XMLListCollection;
            private var checkBox:CheckBox;
            private var pieChart:PieChart;
            private var pieSeries:PieSeries;

            private function init():void {
                var productsXML:XML = &lt;products&gt;
                        &lt;product label="Product 1" data="3" /&gt;
                        &lt;product label="Product 2" data="1" /&gt;
                        &lt;product label="Product 3" data="4" /&gt;
                        &lt;product label="Product 4" data="1" /&gt;
                        &lt;product label="Product 5" data="5" /&gt;
                        &lt;product label="Product 6" data="9" /&gt;
                    &lt;/products&gt;;
                dp = new XMLListCollection(productsXML.product);

                checkBox = new CheckBox();
                checkBox.label = "showDataTipTargets:";
                checkBox.labelPlacement = ButtonLabelPlacement.LEFT;
                checkBox.selected = true;
                checkBox.addEventListener(Event.CHANGE, checkBox_change);

                var appControlBar:ApplicationControlBar;
                appControlBar = new ApplicationControlBar();
                appControlBar.dock = true;
                appControlBar.addChild(checkBox);
                addChildAt(appControlBar, 0);

                pieSeries = new PieSeries();
                pieSeries.field = "@data";
                pieSeries.nameField = "@label";
                pieSeries.filters = [];

                pieChart = new PieChart();
                pieChart.dataProvider = dp;
                pieChart.showDataTips = true;
                pieChart.setStyle("showDataTipTargets", true);
                pieChart.percentWidth = 100;
                pieChart.percentHeight = 100;
                pieChart.series = [pieSeries];

                var legend:Legend = new Legend();
                legend.dataProvider = pieChart;
                legend.direction = TileDirection.HORIZONTAL;
                legend.setStyle("horizontalGap", 100);
                legend.percentWidth = 100;

                var panelControlBar:ControlBar = new ControlBar();
                panelControlBar.percentWidth = 100;
                panelControlBar.addChild(legend);

                var panel:Panel = new Panel();
                panel.styleName = "opaquePanel";
                panel.percentWidth = 100;
                panel.percentHeight = 100;
                panel.addChild(pieChart);
                panel.addChild(panelControlBar);
                addChild(panel);
            }

            private function checkBox_change(evt:Event):void {
                pieChart.setStyle("showDataTipTargets", checkBox.selected);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Toggling data tip targets on a PieChart in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/',contentID: 'post-796',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'showDataTips,showDataTipTargets',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Toggling data tips on a PieChart in Flex</title>
		<link>http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 05:08:14 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[showDataTips]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can toggle data tips on a Flex PieChart control by setting the showDataTips property.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTips_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/ --&#62; &#60;mx:Application name="PieChart_showDataTips_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:XMLListCollection id="dp"&#62; &#60;mx:source&#62; &#60;mx:XMLList&#62; &#60;product label="Product 1" data="3" /&#62; &#60;product label="Product 2" data="1" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can toggle data tips on a Flex PieChart control by setting the <code>showDataTips</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-795"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTips_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieChart_showDataTips_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="showDataTips:"
                labelPlacement="left"
                selected="true" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                showDataTips="{checkBox.selected}"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTips_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTips_test/bin/main.html" width="100%" height="600"></iframe></p>
<div span="googleAdsLeaderboard">
<script type="text/javascript"><!--
google_ad_client = "pub-3325829455487492";
/* 728x90, created 7/15/09 */
google_ad_slot = "6403511741";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<br />
</div>
<p>You can also set the <code>showDataTips</code> using ActionScript, as seen in the following example:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieChart_showDataTips_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function checkBox_change(evt:Event):void {
                pieChart.showDataTips = checkBox.selected;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="showDataTips:"
                labelPlacement="left"
                selected="true"
                change="checkBox_change(event);" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieChart_showDataTips_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.charts.Legend;
            import mx.charts.PieChart;
            import mx.charts.series.PieSeries;
            import mx.collections.XMLListCollection;
            import mx.containers.ApplicationControlBar;
            import mx.containers.ControlBar;
            import mx.containers.Panel;
            import mx.containers.TileDirection;
            import mx.controls.ButtonLabelPlacement;
            import mx.controls.CheckBox;

            private var dp:XMLListCollection;
            private var checkBox:CheckBox;
            private var pieChart:PieChart;
            private var pieSeries:PieSeries;

            private function init():void {
                var productsXML:XML = &lt;products&gt;
                        &lt;product label="Product 1" data="3" /&gt;
                        &lt;product label="Product 2" data="1" /&gt;
                        &lt;product label="Product 3" data="4" /&gt;
                        &lt;product label="Product 4" data="1" /&gt;
                        &lt;product label="Product 5" data="5" /&gt;
                        &lt;product label="Product 6" data="9" /&gt;
                    &lt;/products&gt;;
                dp = new XMLListCollection(productsXML.product);

                checkBox = new CheckBox();
                checkBox.label = "showDataTips:";
                checkBox.labelPlacement = ButtonLabelPlacement.LEFT;
                checkBox.selected = true;
                checkBox.addEventListener(Event.CHANGE, checkBox_change)

                var appControlBar:ApplicationControlBar;
                appControlBar = new ApplicationControlBar();
                appControlBar.dock = true;
                appControlBar.addChild(checkBox);
                addChildAt(appControlBar, 0);

                pieSeries = new PieSeries();
                pieSeries.field = "@data";
                pieSeries.nameField = "@label";
                pieSeries.filters = [];

                pieChart = new PieChart();
                pieChart.dataProvider = dp;
                pieChart.showDataTips = true;
                pieChart.percentWidth = 100;
                pieChart.percentHeight = 100;
                pieChart.series = [pieSeries];

                var legend:Legend = new Legend();
                legend.dataProvider = pieChart;
                legend.direction = TileDirection.HORIZONTAL;
                legend.setStyle("horizontalGap", 100);
                legend.percentWidth = 100;

                var panelControlBar:ControlBar = new ControlBar();
                panelControlBar.percentWidth = 100;
                panelControlBar.addChild(legend);

                var panel:Panel = new Panel();
                panel.styleName = "opaquePanel";
                panel.percentWidth = 100;
                panel.percentHeight = 100;
                panel.addChild(pieChart);
                panel.addChild(panelControlBar);
                addChild(panel);
            }

            private function checkBox_change(evt:Event):void {
                pieChart.showDataTips = checkBox.selected;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Toggling data tips on a PieChart in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/',contentID: 'post-795',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'showDataTips',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Animating a Flex PieChart control&#8217;s rotation when a user clicks on an item</title>
		<link>http://blog.flexexamples.com/2007/11/22/animating-a-flex-piechart-controls-rotation-when-a-user-clicks-on-an-item/</link>
		<comments>http://blog.flexexamples.com/2007/11/22/animating-a-flex-piechart-controls-rotation-when-a-user-clicks-on-an-item/#comments</comments>
		<pubDate>Thu, 22 Nov 2007 08:12:46 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[SeriesInterpolate]]></category>
		<category><![CDATA[easingFunction]]></category>
		<category><![CDATA[perWedgeExplodeRadius]]></category>
		<category><![CDATA[startAngle]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/22/animating-a-flex-piechart-controls-rotation-when-a-user-clicks-on-an-item/</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2007/11/07/rotating-a-flex-piechart-control-when-a-user-clicks-on-an-item/">&#8220;Rotating a Flex PieChart control when a user clicks on an item&#8221;</a>, we looked at changing a PieChart&#8217;s rotation when the user clicked on a pie wedge. In the following example, we look at how to add a nice animation effect with some easing to make the effect a bit [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2007/11/07/rotating-a-flex-piechart-control-when-a-user-clicks-on-an-item/">&#8220;Rotating a Flex PieChart control when a user clicks on an item&#8221;</a>, we looked at changing a PieChart&#8217;s rotation when the user clicked on a pie wedge. In the following example, we look at how to add a nice animation effect with some easing to make the effect a bit more smooth.</p>
<p>Full code after the jump.</p>
<p><span id="more-324"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_showDataEffect_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/11/22/animating-a-flex-piechart-controls-rotation-when-a-user-clicks-on-an-item/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.effects.easing.*;
            import mx.charts.series.items.PieSeriesItem;
            import mx.charts.events.ChartItemEvent;

            private function pieChart_itemClick(evt:ChartItemEvent):void {
                var item:PieSeriesItem = evt.hitData.chartItem as PieSeriesItem;
                var degrees:Number = radiansToDegrees(item.startAngle);
                var arr:Array = [];
                if (checkBox.selected) {
                    arr[item.index] = 0.2;
                }
                pieSeries.perWedgeExplodeRadius = arr;
                pieSeries.startAngle -= degrees;

                dp.refresh();
            }

            private function radiansToDegrees(radians:Number):Number {
                return radians * (180 / Math.PI);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="Use perWedgeExplodeRadius:"
                labelPlacement="left"
                selected="true" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:PieChart id="pieChart"
            dataProvider="{dp}"
            showDataTips="true"
            itemClick="pieChart_itemClick(event);"
            height="100%"
            width="100%"&gt;
        &lt;mx:series&gt;
            &lt;mx:PieSeries id="pieSeries"
                    field="@data"
                    nameField="@label"&gt;
                &lt;mx:showDataEffect&gt;
                    &lt;mx:SeriesInterpolate duration="1500"
                            easingFunction="{Elastic.easeOut}" /&gt;
                &lt;/mx:showDataEffect&gt;
                &lt;mx:filters&gt;
                    &lt;mx:DropShadowFilter /&gt;
                &lt;/mx:filters&gt;
            &lt;/mx:PieSeries&gt;
        &lt;/mx:series&gt;
    &lt;/mx:PieChart&gt;

    &lt;mx:Legend dataProvider="{pieChart}" direction="horizontal" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_showDataEffect_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PieSeries_showDataEffect_test/bin/main.html" width="100%" height="500"></iframe></p>
<p>But remember kids, just because you can add easing, doesn&#8217;t mean you always should! ;)</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Animating a Flex PieChart control\&#039;s rotation when a user clicks on an item on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/11/22/animating-a-flex-piechart-controls-rotation-when-a-user-clicks-on-an-item/',contentID: 'post-324',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'easingFunction,perWedgeExplodeRadius,startAngle',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/11/22/animating-a-flex-piechart-controls-rotation-when-a-user-clicks-on-an-item/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Displaying a PieSeries item&#8217;s data when a user clicks an item in a Flex PieChart control</title>
		<link>http://blog.flexexamples.com/2007/11/15/displaying-a-pieseries-items-data-when-a-user-clicks-an-item-in-a-flex-piechart-control/</link>
		<comments>http://blog.flexexamples.com/2007/11/15/displaying-a-pieseries-items-data-when-a-user-clicks-an-item-in-a-flex-piechart-control/#comments</comments>
		<pubDate>Thu, 15 Nov 2007 15:40:47 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[PieSeries]]></category>
		<category><![CDATA[PieSeriesItem]]></category>
		<category><![CDATA[itemClick]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/15/displaying-a-pieseries-items-data-when-a-user-clicks-an-item-in-a-flex-piechart-control/</guid>
		<description><![CDATA[<p>The following example shows how you can display the selected pie series item when the user clicks a wedge in a PieChart control.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_itemClick_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/11/15/displaying-a-pieseries-items-data-when-a-user-clicks-an-item-in-a-flex-piechart-control/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.controls.Alert; import mx.charts.series.items.PieSeriesItem; import mx.charts.events.ChartItemEvent; private function pieChart_itemClick(evt:ChartItemEvent):void [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can display the selected pie series item when the user clicks a wedge in a PieChart control.</p>
<p>Full code after the jump.</p>
<p><span id="more-301"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_itemClick_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/11/15/displaying-a-pieseries-items-data-when-a-user-clicks-an-item-in-a-flex-piechart-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Alert;
            import mx.charts.series.items.PieSeriesItem;
            import mx.charts.events.ChartItemEvent;

            private function pieChart_itemClick(evt:ChartItemEvent):void {
                var psi:PieSeriesItem = evt.hitData.chartItem as PieSeriesItem;
                Alert.show("data=" + psi.item.@data + "\n" + "percentValue=" + psi.percentValue.toFixed(1) + "%", "label=" + psi.item.@label);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

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

    &lt;mx:PieChart id="pieChart"
            dataProvider="{dp.product}"
            itemClick="pieChart_itemClick(event);"
            showDataTips="true"
            height="100%"
            width="100%"&gt;
        &lt;mx:series&gt;
            &lt;mx:PieSeries id="pieSeries"
                    field="@data"
                    labelPosition="callout"&gt;
                &lt;mx:stroke&gt;
                    &lt;mx:Stroke color="black" weight="0" /&gt;
                &lt;/mx:stroke&gt;
                &lt;mx:filters&gt;
                    &lt;mx:Array /&gt;
                &lt;/mx:filters&gt;
            &lt;/mx:PieSeries&gt;
        &lt;/mx:series&gt;
    &lt;/mx:PieChart&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_itemClick_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PieSeries_itemClick_test/bin/main.html" width="100%" height="400"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Displaying a PieSeries item\&#039;s data when a user clicks an item in a Flex PieChart control on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/11/15/displaying-a-pieseries-items-data-when-a-user-clicks-an-item-in-a-flex-piechart-control/',contentID: 'post-301',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'itemClick',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/11/15/displaying-a-pieseries-items-data-when-a-user-clicks-an-item-in-a-flex-piechart-control/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

