1 Reply Latest reply on Dec 7, 2009 6:15 PM by Xanetia

    Using nested Objects in an arraycollection to populate a graph

    Xanetia

      Hi There.

       

      My problem is I have an collection of objects; x, and each object has a nested class; y, which has a few vars representing differing number values.

       

      x looks like:

       

       

      public class x

      {

           public var field1:int, field2:int, name:String;

           public var sub:y;

      }

       

       

      y looks like:

       

      public class y

      {

           public var field1:int, field2:int, field3:int;

      }

       

      Now I want to draw a graph as follows:

       

       

       

       

      <mx:ColumnChart x="167" y="10" id="columnchart1" type="stacked" dataProvider="{x}" width="533" height="413">

           <mx:horizontalAxis>

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

           </mx:horizontalAxis>

           <mx:series>

                <mx:ColumnSeries yField="field1"/>

                <mx:ColumnSeries yField="field2" />

                <mx:ColumnSeries yField="sub.field1" />

                <mx:ColumnSeries yField="sub.field2" />

                <mx:ColumnSeries yField="sub.field3" />

           </mx:series>

      </mx:ColumnChart>

       

       

      this should give me a stacked graph - the sub.field1 parts give an error:

       

      ReferenceError: Error #1069: Property sub.field1 not found on x and there is no default value.

       

      Any help much appreciated.

       

      ~Simeon