flex - How can I use filterFunction in ColumnSeries -
i have set of data following:
[bindable] public var loc:arraycollection = new arraycollection([ {date:"2002", close:41.87, loc: "location 01"}, {date:"2003", close:45.74, loc: "location 01"}, {date:"2004", close:42.77, loc: "location 01"}, {date:"2005", close:48.06, loc: "location 01"}, {date:"2006", close:48.06, loc: "location 01"}, {date:"2002", close:157.59, loc: "location 02"}, {date:"2003", close:160.3, loc: "location 02"}, {date:"2004", close:150.71, loc: "location 02"}, {date:"2005", close:156.88, loc: "location 02"}, ]); and i'd create chart following, in each location displayed in different color , grouped each year: 
i thinking must use "mx:columnseries" tag , use "filterfunction" property define how filter data each location separate series, don't know how that. anyboy have recommendation or sample code creating such charts? thank you
here example:
private function filterseries1(cache:array):array { var filteredcache:array = []; (var i:int = 0; < cache.length; i++) { var item:columnseriesitem = columnseriesitem(cache[i]); if(item.item.loc == "location 01") filteredcache.push(item); } return filteredcache; } private function filterseries2(cache:array):array { var filteredcache:array = []; (var i:int = 0; < cache.length; i++) { var item:columnseriesitem = columnseriesitem(cache[i]); if(item.item.loc == "location 02") filteredcache.push(item); } return filteredcache; } and:
<mx:series> <mx:columnseries yfield="close" xfield="date" labelposition="outside" filterfunction="{filterseries1}"/> <mx:columnseries yfield="close" xfield="date" labelposition="outside" filterfunction="{filterseries2}"/> </mx:series>
Comments
Post a Comment