An alternative to a custom renderer is to use a stacked chart and 
apply a little bit of data trickery.

Doug


<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"; 
width="100%" height="100%">

    <mx:Script>

        <![CDATA[
            var data = [
                {name: "A", totalGreen: 0, totalRed: 66},
                {name: "B", totalGreen: 40, totalRed: 0},
                {name: "C", totalGreen: 30, totalRed: 0},
                {name: "D", totalGreen: 0, totalRed: 22},
                {name: "E", totalGreen: 0, totalRed: 50},
                {name: "F", totalGreen: 10, totalRed: 0}
            ]
        ]]>

    </mx:Script>

    <mx:Panel width="100%" height="100%" title="Chart">
        <mx:ColumnChart width="100%" height="100%" 
dataProvider="{data}" type="stacked">

            <mx:horizontalAxis>
                <mx:CategoryAxis dataProvider="{data}" 
categoryField="name"/>
            </mx:horizontalAxis>

            <mx:series>
                <mx:Array>
                    <mx:ColumnSeries yField="totalGreen">
                        <mx:fill>
                            <mx:LinearGradient>
                                <mx:entries>
                                    <mx:Array>
                                        <mx:GradientEntry 
color="#008000"/>
                                    </mx:Array>
                                </mx:entries>
                            </mx:LinearGradient>
                        </mx:fill>
                    </mx:ColumnSeries>
                    <mx:ColumnSeries yField="totalRed">
                        <mx:fill>
                            <mx:LinearGradient>
                                <mx:entries>
                                    <mx:Array>
                                        <mx:GradientEntry 
color="#C00000"/>
                                    </mx:Array>
                                </mx:entries>
                            </mx:LinearGradient>
                        </mx:fill>
                    </mx:ColumnSeries>
                </mx:Array>
            </mx:series>

        </mx:ColumnChart>
    </mx:Panel>

</mx:Application>


--- In [email protected], "Sauro, Nick" <[EMAIL PROTECTED]> wrote:
>
> Hello all, I was just hoping someone could point me towards some
> resources that explain how to create a custom renderer component 
for a
> chart. I need to create a Column Chart whose column colors are 
different
> depending on the value (positive or negative).
> 
>  
> 
> I've been searching, and haven't had much luck.
> 
>  
> 
> Thanks.
> 
>  
> 
> Nick
>







--
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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to