Go Back   CodingForums.com > :: Client side development > Flash & ActionScript > Adobe Flex

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-22-2012, 05:35 PM   PM User | #1
tnel
New to the CF scene

 
Join Date: Jul 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
tnel is an unknown quantity at this point
Need Help Understanding dataFunction

I'm confused as to how the dataFunction method works. Namely, I don't understand how to call the dataFunction. Here is my chart data, in the array named 'arrayOne'. I want the x-axis to populate with the 'day' items and I want stacked columns where each stacked column is the 'wip' item in a 'type' property. This would allow me to see the amount of wip corresponding to each part type on every day.

Code:
 
[Bindable] private var arrayOne:ArrayCollection = new ArrayCollection([ 
               {time:1,day:3,typeA:{wip:10,proj:15},typeB:{wip:15,proj:9},typeC:{wip:20,proj:20}}, 
               {time:1,day:2,typeA:{wip:12,proj:14},typeB:{wip:13,proj:12},typeC:{wip:12,proj:17}}, 
               {time:1,day:1,typeA:{wip:15,proj:14},typeB:{wip:12,proj:10},typeC:{wip:5,proj:9}}, ]);
In my init() function I have an arrayCollection called 'allSeries' that I'm using to create checkboxes for each part type. Since this array contains a list of all part types I would also like to use it to make a chart series for every element in the array. So I have a call to a function called 'updateChartSeries' that is defined to populate my column chart series with the elements of 'allSeries'.

Code:
protected function init():void 
{ 
      allSeries.addItem("TypeA");      //This is an array collection holding the series names 
      allSeries.addItem("TypeB"); 
      allSeries.addItem("TypeC"); 
      updateChartSeries(allSeries); 
}
The 'updateChartSeries' function is below. It takes an arrayCollection as a parameter, such as 'allSeries', and is suppose to create a column series for each element of the passed in arrayCollection. To do this it needs to recognize the part type name from my dataprovider table ('arrayOne') and assign the corresponding wip value as the column series yField. That's what I can't figure out how to do.

Code:
public function updateChartSeries(seriesArray:ArrayCollection):void 
{ 
     var mySeries:Array = new Array();  
 
     for(var i:int = 0; i < seriesArray.length; i++) 
     { 
          var legend:String = "part " + seriesArray[i].toString();  
 
          var col:ColumnSeries = new ColumnSeries(); 
          col.id = seriesArray[i].toString(); 
          col.displayName = legend; 
          col.filterData = false; 
          col.dataFunction = Function(dataFunc(col, seriesArray[i]));    //I don't know how to call the function here.  
 
          mySeries.push(col); 
     }  
 
     typeChart.series = mySeries; 
}   
 
private function dataFunc(series:Series, item:Object, fieldName:String):object 
{ 
      //I don't know what to put here! I think I want to return item.(seriesArray[i]).wip;  
}
tnel is offline   Reply With Quote
Reply

Bookmarks

Tags
datafunction

Jump To Top of Thread


Thread Tools
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 +1. The time now is 01:53 AM.


Advertisement
Log in to turn off these ads.