Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 12-04-2009, 05:21 PM   #1
nxfxcom
Registered User
 
Join Date: Dec 2009
Posts: 2
Default Pie Chart Color from XML

Hello,

i am working on a Dashboard Application, the legend would in be in JSP/HTML and the Chart itself in flex, now my questions is how can i define the slice color from XML ?

Thank you
nxfxcom is offline   Reply With Quote
Old 12-04-2009, 06:52 PM   #2
nxfxcom
Registered User
 
Join Date: Dec 2009
Posts: 2
Default

Below is my current code

Code:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="srv.send()" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #FFFFFF]" borderColor="#FFFFFF">
  <mx:Script><![CDATA[
  	import mx.collections.ListCollectionView;
    import mx.utils.ArrayUtil;
  
 
  ]]>
  </mx:Script>

  <mx:HTTPService id="srv" url="../xml/sourcesPie.xml" resultFormat="e4x" />

  <mx:XMLListCollection id="myAC" source="{srv.lastResult.entry}" />
  
  
   <mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%" title="Sources" horizontalAlign="left">
        <mx:HBox width="100%" height="100%">
  
  
  
  <mx:PieChart id="myChart" dataProvider="{myAC}" showDataTips="false" width="100%" height="100%">
     <mx:series>
        <mx:PieSeries field="views" fontSize="13" labelPosition="insideWithCallout" displayName="views" name="views" nameField="source"  />
     </mx:series>
  </mx:PieChart>

  
  
   <mx:Legend dataProvider="{myChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    width="20%" />
                    
                    
                    
                    
                      <mx:DataGrid dataProvider="{myAC}">
  	<mx:columns>
  		<mx:DataGridColumn headerText="Source" dataField="source"/>
  		<mx:DataGridColumn headerText="Views" dataField="views"/>
  		<mx:DataGridColumn headerText="%" dataField="perc"/>
  	</mx:columns>
  </mx:DataGrid>
  
                    
                    
                    
        </mx:HBox>
      
    </mx:Panel>

  
  
</mx:Application>


And then my xml, i want the pie charts to get the right color as defined in XML

Code:
<entries>
	<entry>
		<source>Monster</source>
		<views>68</views>
		<perc>54</perc>
		<color>#123412</color>
	</entry>
	<entry>
		<source>LocalHires</source>
		<views>1232</views>
		<perc>3</perc>
		<color>#123412</color>
	</entry>
	<entry>
		<source>Yahoo</source>
		<views>54</views>
		<perc>45</perc>
		<color>#123412</color>
	</entry>
	<entry>
		<source>Craigslist</source>
		<views>3195</views>
		<perc>22</perc>
		<color>#123412</color>
	</entry>
	<entry>
		<source>Google</source>
		<views>1228</views>
		<perc>18</perc>
		<color>#123412</color>
	</entry>
</entries>
nxfxcom is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:57 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.