1 Reply Latest reply on Jun 23, 2010 10:28 AM by rtalton

    Selective lineChat itemRenderer

    yann_m

      Hi there,

       

      I'm encountering an issue representing data on a line chart. Precisely, I'd like to have some data points represented using an itemRenderer and others without any renderer. Having this piece of code:

       

       

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

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

       

           <mx:Script>

                <![CDATA[

                     [Bindable] var xml:XML = <root><point x="1" y="1" label="hello" /><point x="2" y="2" label="" /> </root>;

                ]]>

           </mx:Script>

       

       

      <mx:LineChart dataProvider="{xml.point}" height="100%" width="100%">

           <mx:series>

                <mx:Array>

                     <mx:LineSeries xField="@x" yField="@y" >

                          <mx:itemRenderer>

                                   <mx:Component>

                                         <mx:Canvas backgroundColor="blue" />

                                    </mx:Component>

                          </mx:itemRenderer>

                     </mx:LineSeries>

                </mx:Array>

           </mx:series>

      </mx:LineChart>

       

       

      </mx:Application>

       

       

      I'd like for instance to use my inline renderer for points that have a value for the attribute label. Is that achievable?

       

      Thank you in advance for your help.

        • 1. Re: Selective lineChat itemRenderer
          rtalton Level 4

          I don't know of any way of switching the LineSeries' itemRenderer based on the data provider's value.

           

          You can instead use a fillFunction to control how each LineSeries renders, returning different IFills depending on your data. Note that the fill you return can be a Solid Color with an alpha=0, which would effectively make it invisible, if that is what you want.