Thursday, September 10, 2009

Whats new in charts in Flex 4

I have already discussed about few of the enchancements done in Charts for Flex4, in my earlier posts. Direct links to those posts can be found below.

Apart from the above two enhancements, support is also provided for custom filter functions on the chart series. 2 new properties filterDataValues and filterFunction have been added to series.

3. filterDataValues: If filterFuction is set, filterDataValues and filterData are ignored. If filterDataValues property is set to none, series will not filter its data before displaying. If filterDataValues is set to nulls, series filters data like null, undefined, or NaN before displaying. If this property is set to outsideRange, series filters its data like null, undefined, or NaN and also the values that are outside the range of the chart axes. If you know that all of the data in the series is valid, you can set this to none to improve performance.

4. filterFunction: Specifies a method that returns the array of chart items in the series, that are to be displayed. If this property is set, the return value of the custom filter function takes precedence over the filterDataValues andfilterData properties. But if it returns null, then filterDataValues and filterData will be prefered in that order.

The custom filterFunction has the following signature:

     function_name (cache:Array):Array { ... }
Below is an example of custom filter function:

public function myFilterFunction(cache:Array):Array {
var filteredCache:Array=[];
var n:int = cache.length;
for(var i:int = 0; i < n; i++){
var item:ColumnSeriesItem = ColumnSeriesItem(cache[i]);
if(item.yNumber > 0 && item.yNumber < 700)
return filteredCache;

5. If you are working with Data Centric applications, binding data to charts has been made very simple in Flash Builder 4. I am going to talk about this in my future posts. Watch out this space for more on DataCentricDevelopment support for Charts.

6. Apart from the enhancements mentioned above, there have been a lot of bug fixes. Please use this link to log\ serach for bugs.


No comments:

Post a Comment