Alright, I'm getting close but having issues.....well it actually taking my changes, ironically enough. My guess is because I'm not altering the _renderData in the actual graph since it's extended....but here, maybe you can explain where I went wrong. No matter how I change _renderData, it never effects the actual graph.



package com.rsi.briefingbook.view.chart {
    import mx.charts.series.LineSeries;
    import mx.charts.series.renderData.LineSeriesRenderData;
    import mx.charts.series.items.LineSeriesItem;
    import mx.charts.chartClasses.CartesianTransform;
    import mx.collections.CursorBookmark;
   

    public class FilteredLineSeries extends LineSeries {       
       
        private var _renderData:LineSeriesRenderData;   
        private var _xField:String = "";
        private var _yField:String = "";
       
        override protected function updateFilter():void {
            _renderData.filteredCache = _renderData.cache;
           
            for(var i:int = 0; i < _renderData.filteredCache.length; i++) {
                var temp:LineSeriesItem = _renderData.filteredCache[i];
                trace(temp);
            }
            super.updateFilter();
        }
       
        override protected function updateData():void {
            var renderDataType:Class = this.renderDataType;
            _renderData= new renderDataType();
   
            _renderData.cache = [];
            if (dataProvider)
            {           
                cursor.seek(CursorBookmark.FIRST);
                var i:int = 0;
                var itemClass:Class = itemType;
                while (!cursor.afterLast)
                {
                    _renderData.cache[i] = new itemClass(this,cursor.current,i);
                    i++;
                    cursor.moveNext();
                }
   
                cacheDefaultValues(_yField,_renderData.cache,"yValue");
                cacheIndexValues(_xField,_renderData.cache,"xValue");
            }
   
            _renderData.validPoints = _renderData.cache.length;
            super.updateData();
        }
    }
}

On 10/19/06, Jonathan Miranda <[EMAIL PROTECTED]> wrote:
Remind me to buy you a drink at MAX :) Thanks Ely, I'll get cracking on subclassing lineSeries I guess since this is pretty elaborate


On 10/19/06, Ely Greenfield <[EMAIL PROTECTED]> wrote:

 
 
Hi Jon. Unfortunately, there's nothing in charts that will do what you want.  What you're looking for is basically a pivot (well...if you're looking for just one brand it's a filter, but if you're looking for one series per brand it's more of a pivot), and charts don't support that out of the box.
 
You have three options:
 
1) prefilter the data yourself, the manual way
 
2) subclass lineSeries, add a 'filterField' and 'filterValue' property, and override the updateFilter function to filter on those values.
 
3) write a pivot class that accepts parameters on what to filter on, what to create multiple series on, what to aggregate on, and have it spit out a set of series with custom dataproviders assigned.
 
 
I've got a skunkworks version of #3 I've been tooling around with for a little while, but it's not ready for the outside world yet.  In the meantime, try #1 or #2.
 
Ely.
 


From: [EMAIL PROTECTED]ups.com [mailto:flexcoders@ yahoogroups.com] On Behalf Of Jonathan Miranda
Sent: Wednesday, October 18, 2006 4:25 PM
To: [EMAIL PROTECTED]ups.com
Subject: [flexcoders] Filters for multiple LineSeries in a LineChart - Calling ChartMan Ely!

Heh, maybe he'll see this before MAX :)

Anyways, here's my question - I've done this before, but I can't
remember how nor find the code. I've got a data set like the
following:

Month.....Dollar.....Category.....Brand
..Jan.........500..........IT.............Blue
..Feb.........700..........JO.............Red
..Mar.........600..........AC.............Blue
..Jan.........100..........IT.............Green
..Feb.........200..........JO.............Red
..Mar.........300..........AC.............Blue

ok so, Month will be my x-axis. Dollar will be my y-axis, tallied up.
I want the entire LineChart to filter on Category (assuming I'll just
need to sort this based on altering the dataProvider itself)...but my
problem is I need a LineSeries for each Brand.

So my first guess was....

<mx:series>
..<mx:Array>
....<mx:Repeater dataProvider={uniqueBrandList}>
......<mx:LineSeries .....>
....</mx:Repeater>
..</mx:Array>
</mx:series>

Which does give me the lines I need, but I need some way to have a
LineSeries only show data where brand=uniqueBrandList.selectedItem.
What's the filter mechanism for a LineSeries besides the yField? Is
there some trick in that field or is there a property/function I'm
missing on how I can only show data where Brand=X? I thought "hey, use
filters" but that's the Effects, not for data :)

Any help would be nice....
-Jon Miranda



__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to