<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Creating custom fills in a Flex PieChart control using the fillFunction property</title>
	<atom:link href="http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Sun, 12 Feb 2012 19:26:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Sherafudheen</title>
		<link>http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/comment-page-1/#comment-10019</link>
		<dc:creator>Sherafudheen</dc:creator>
		<pubDate>Tue, 04 Oct 2011 05:50:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/#comment-10019</guid>
		<description>First of all thanks for you all Mr. Cosmos and Peter for your help and i do the thinks based on that.

while going i found a small changes and its also working fine for the dynamic pie series color change.

I used  the same 

For setting the initial color :

private var pieColor:Array = [0x000000, 0x000000, 0x000000, 0x000000];
---------------------------------
(giving this pieColor as a fill color for my pieSeries like fills=”{pieColor}” ).
---------------------------------

there are 4 combo box in my application say an example : 


confidanceValuesList data provider is having a value [0,Empty] and [1,Full]
-----------------combo box change event ----------
protected function changeChargeTabCombo(event:IndexChangeEvent):void
			{
				var selectedItemIndex:int = event.currentTarget.selectedIndex;
				switch (selectedItemIndex){
					case 1:
				pieColor[0] = 0xCE1AC5;
				break;
			default:
			 pieColor[6] = 0xFFFFFF;
		}
		changeColor();
	}
-----------------------------------

private function changeColor():void{
     // making null need to set the fillFunction again
     pieSeries.fillFunction = null;
     pieSeries.fillFunction = pieSeries_fillFunc;
}

public function pieSeries_fillFunc(item:ChartItem, index:Number):IFill {
   var curItem:PieSeriesItem = PieSeriesItem(item);
return new SolidColor(pieColor[curItem.index], 1.0);
}

this will change the pie series color based on the combo value .. the same can do foe the other 4 combo box, 

dynamically we can change the pieSeries color ..</description>
		<content:encoded><![CDATA[<p>First of all thanks for you all Mr. Cosmos and Peter for your help and i do the thinks based on that.</p>
<p>while going i found a small changes and its also working fine for the dynamic pie series color change.</p>
<p>I used  the same </p>
<p>For setting the initial color :</p>
<p>private var pieColor:Array = [0x000000, 0x000000, 0x000000, 0x000000];<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
(giving this pieColor as a fill color for my pieSeries like fills=”{pieColor}” ).<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>there are 4 combo box in my application say an example : </p>
<p>confidanceValuesList data provider is having a value [0,Empty] and [1,Full]<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;combo box change event &#8212;&#8212;&#8212;-<br />
protected function changeChargeTabCombo(event:IndexChangeEvent):void<br />
			{<br />
				var selectedItemIndex:int = event.currentTarget.selectedIndex;<br />
				switch (selectedItemIndex){<br />
					case 1:<br />
				pieColor[0] = 0xCE1AC5;<br />
				break;<br />
			default:<br />
			 pieColor[6] = 0xFFFFFF;<br />
		}<br />
		changeColor();<br />
	}<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>private function changeColor():void{<br />
     // making null need to set the fillFunction again<br />
     pieSeries.fillFunction = null;<br />
     pieSeries.fillFunction = pieSeries_fillFunc;<br />
}</p>
<p>public function pieSeries_fillFunc(item:ChartItem, index:Number):IFill {<br />
   var curItem:PieSeriesItem = PieSeriesItem(item);<br />
return new SolidColor(pieColor[curItem.index], 1.0);<br />
}</p>
<p>this will change the pie series color based on the combo value .. the same can do foe the other 4 combo box, </p>
<p>dynamically we can change the pieSeries color ..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fabian</title>
		<link>http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/comment-page-1/#comment-8296</link>
		<dc:creator>Fabian</dc:creator>
		<pubDate>Wed, 01 Sep 2010 20:30:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/#comment-8296</guid>
		<description>Just found this sample of code and it was exactly what I needed for a test.
Thanks for sharing you flex code.</description>
		<content:encoded><![CDATA[<p>Just found this sample of code and it was exactly what I needed for a test.<br />
Thanks for sharing you flex code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/comment-page-1/#comment-1828</link>
		<dc:creator>Greg</dc:creator>
		<pubDate>Fri, 24 Apr 2009 09:23:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/#comment-1828</guid>
		<description>How can I create a pie chart that uses dynamic data from ArrayCollection ? (I have a web page that does a cycles between the stats and then on the endState it generates all information in one RichTextEditor and then just add the text information into the DataGrid (3 rows) and now I want to create a pieChart that will use the data from one row and then generate a pieChart.</description>
		<content:encoded><![CDATA[<p>How can I create a pie chart that uses dynamic data from ArrayCollection ? (I have a web page that does a cycles between the stats and then on the endState it generates all information in one RichTextEditor and then just add the text information into the DataGrid (3 rows) and now I want to create a pieChart that will use the data from one row and then generate a pieChart.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cosmoz</title>
		<link>http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/comment-page-1/#comment-1826</link>
		<dc:creator>cosmoz</dc:creator>
		<pubDate>Mon, 21 Jan 2008 11:13:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/#comment-1826</guid>
		<description>At last, I found another way to modified the fill color in runtime. (For Flex 2.0, if you have 3.0 then it&#039;s easier by use fillFunction)

The key is to define an Array to store the default color data.(any color)

eg.
&lt;pre class=&quot;code&quot;&gt;
private var pieColor:Array = [0x000000, 0x000000, 0x000000, 0x000000];
&lt;/pre&gt;

Then set it to PieSeries attributes : fills=&quot;{pieColor}&quot;

And replace each color in that array through the code!! That&#039;s it.

One thing is the number of data that I used hasn&#039;t change so I&#039;m not sure it will work for dynamic number of data.


The code is below is:
&lt;pre class=&quot;code&quot;&gt;
private var pieColor:Array = [0x000000, 0x000000, 0x000000, 0x000000];

private function changeColor():void{

pieColor[0] = getColor(&#039;red&#039;);
	pieColor[1] = getColor(&#039;amber&#039;);
	pieColor[2] = getColor(&#039;green&#039;);
	pieColor[3] = getColor(&#039;default&#039;);
}


private function getColor(color:String):uint {
	trace(&quot;--getColor--: &quot;   color);
	switch(color){
		case &quot;red&quot;:
			return 0xFF0000;
		case &quot;green&quot;:
			return 0x00FF00;
		case &quot;amber&quot;:
			return 0xFFCC00;
		default:
			return 0x8800CC;
	}
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>At last, I found another way to modified the fill color in runtime. (For Flex 2.0, if you have 3.0 then it&#8217;s easier by use fillFunction)</p>
<p>The key is to define an Array to store the default color data.(any color)</p>
<p>eg.</p>
<pre class="code">
private var pieColor:Array = [0x000000, 0x000000, 0x000000, 0x000000];
</pre>
<p>Then set it to PieSeries attributes : fills=&#8221;{pieColor}&#8221;</p>
<p>And replace each color in that array through the code!! That&#8217;s it.</p>
<p>One thing is the number of data that I used hasn&#8217;t change so I&#8217;m not sure it will work for dynamic number of data.</p>
<p>The code is below is:</p>
<pre class="code">
private var pieColor:Array = [0x000000, 0x000000, 0x000000, 0x000000];

private function changeColor():void{

pieColor[0] = getColor('red');
	pieColor[1] = getColor('amber');
	pieColor[2] = getColor('green');
	pieColor[3] = getColor('default');
}

private function getColor(color:String):uint {
	trace("--getColor--: "   color);
	switch(color){
		case "red":
			return 0xFF0000;
		case "green":
			return 0x00FF00;
		case "amber":
			return 0xFFCC00;
		default:
			return 0x8800CC;
	}
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: cosmoz</title>
		<link>http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/comment-page-1/#comment-1827</link>
		<dc:creator>cosmoz</dc:creator>
		<pubDate>Mon, 21 Jan 2008 08:11:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/#comment-1827</guid>
		<description>Is this &#039;fillFunction&#039; work only for Flex 3.0? And if it is any possible method to do the same in flex 2.0?

I&#039;m looking around the web and can not found the solution for flex 2.0.</description>
		<content:encoded><![CDATA[<p>Is this &#8216;fillFunction&#8217; work only for Flex 3.0? And if it is any possible method to do the same in flex 2.0?</p>
<p>I&#8217;m looking around the web and can not found the solution for flex 2.0.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

