Thank you for the suggestion,

I'm a newbie to Flex, and put together the following before I
saw your suggestion:

private function myWriteFillFunction(element:ChartItem,
index:Number):IFill {
        var c:SolidColor = new SolidColor(0x888888);
        var item:Object = new Object();       
        var wperlev:int = mySchoolData[index].wps07;
        
        if (wperlev == 1) 
            return c;
        if (wperlev == 2) 
            c.color = 0xFFFF00;
        if (wperlev == 3) 
                c.color = 0x00FF00;
        if (wperlev == 4) 
                c.color = 0x0000FF;
        return c;
    }
        
This correctly colors the dots of the plotChart in one of four
different colors depending upon the value of the field wps07. 
Your example seems to avoid all the stuff with the index, which
caused me a lot of problems. My dataProvider to my series has
values that are null. When filterData is set to true (which it is
by default for the plotSeries) the data passed to the plotChart
excludes the null values (which is good), but then when the index
is used to color the points, it is off because is includes the null
values. 

I find working with data in Flex to be extremely cumbersome compared
to what I've experienced working with statistical analysis software
(e.g., R) Hopefully, I just need to learn more about the manner in
which one manipulates data in Flex/Actionscript.

Thank you for your help 

--- In [email protected], Christophe Jolif <[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> Not tested at all, but I would in my fill function:
> 
> 1/ get the original item:
> 
> var data:Object = item.item;
> 
> 2/ get the value in the  field I'm interested in:
> 
> var value:Object = data.myfield;
> 
> 3/ do whatever coloring I want to do with it.
> 
> Is that what you are doing and is failing?
> -- 
> Christophe
> ILOG Elixir
> http://flex.ilog.com
> 
> picklzzz wrote:
> > Hello,
> > 
> > I'm attempting to write a fillFunction for use with a plotChart that
> > color codes dots based upon the value on a third field.
> > 
> > For example, a plot chart of individual's heights (xField) verus
> > weight (yField) color coded by ethnicity. 
> > 
> > The examples provided in the Flex documentation use values of the
> > xField or yField to control color selection. How does one use the
> > value of a third variable to control color selection?
> > 
> > I have created something that "kind of" works, but I have an
> > AdvancedDataGrid displaying the data and when I sort in the
> > AdvancedDataGrid, it messes up the index I use to color the dots.
> > 
> > If anyone else has worked through this, I'd appreciate any insights
> > you can offer.
> > 
> > 
> > 
> > --
> > Flexcoders Mailing List
> > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> > Yahoo! Groups Links
> > 
> > 
> > 
> > 
> >
>


Reply via email to