1 Reply Latest reply on Jul 23, 2012 3:56 PM by tjnelso

    Utterly Confused About Usefulness of Actionscript

    tjnelso Level 1

      I am utterly confused. I am trying to create series dynamically, meaning that I will have a dataset that looks SOMETHING like the following:

       

       

      [Bindable]

      private var arrayOne:ArrayCollection = new ArrayCollection([

      {time:1,day:3,typeA:{wip:10,proj:15},typeB:{wip:15,proj:9},typeC:{wip:20,proj:20}},

      {time:1,day:2,typeA:{wip:12,proj:14},typeB:{wip:13,proj:12},typeC:{wip:12,proj:17}},

      {time:1,day:1,typeA:{wip:15,proj:14},typeB:{wip:12,proj:10},typeC:{wip:5,proj:9}},

      ]);

       

       

      BUT, the only thing I know for sure is that there will be a time and day value. TypeA, TypeB, and TypeC are product types, and they MIGHT or MIGHT NOT be in my dataset, simply depending on the result of a SQL query. So I need to be able to create chart series for typeA, typeB, and/or typeC (or any other type that I may not even know about yet) given that they appear in my dataset.

       

      I know I need to use dataFunction, since I actually need to access the 'wip' for any given product type. I have found out that 'item' is the row of the data array that is currently being accessed, so in my dataFunction I need to return something like 'item.(series).wip'. But that isn't allowed.

       

      private function dataFunc(series:Series, item:Object, fieldName:String):object

      {

                if(fieldName == "yValue")

                {

                     return item.(series).wip

                 }

      }

       

      I am dealing with a dataset like the one I posted at the top of this post BUT I don't know what my product types will be, they could be anything. Yet I need to create a series for each product type. Actionscript seems incapable of handling this as far as I have seen thus far. I hope I am incorrect. If anyone can help please chime in!