How do I access an array of objects of arrays?

208 views Asked by At

I have a chart and am trying to display the "volume" in a line chart as the primary series & the "temp" as a column chart as the secondary series...(the "compound" will be shown in the datatip):

[{date=Tue Feb 08 19:00:00 EST 2011, volume=1200, 1={temp=-50, compound=helium}, 0={temp=-45, compound=oxygen}}]

I can get the "volume" series to display fine, but cannot get the "temp" series to display...how do I access them? Right now I have:

<mx:ColumnSeries id="secondSeries" xField="date" yField="temp"> 
1

There are 1 answers

5
Frank On BEST ANSWER

i don't know which datatpype your Object is.

I use an Array for example. Check this Code:

<fx:Script>
        <![CDATA[

            private var obj:Array = [{date:"Tue Feb 08 19:00:00 EST 2011", volume:"1200", 1:{temp:"-50", compound:"helium"}, 0:{temp:"-45", compound:"oxygen"}}];


            private function onInit() :void
            {
                trace (obj[0].date);
                trace (obj[0][1].temp);

            }
        ]]>
    </fx:Script>

Let me know, if you're using another Datatype.

BR Frank