1 Reply Latest reply on Sep 10, 2009 11:48 AM by babo_ya

    Help with Column Chart


      Hi everyone,


      Im creating a column chart binded to an array collection as shown below.



      <mx:ArrayCollection id="data">


      <mx:Object name="Jen P" location="Miami, FL" money="700" />

      <mx:Object name="Jen P" location="Miami, FL" money="1000" />

      <mx:Object name="John Doe" location="New York, NY" money="2000

      <mx:Object name="Jim Jones" location="Philadelphia, PA" money="5000" />

      <mx:Object name="Roberto Carlos" location="Chicago, IL" money="350" />

      <mx:Object name="Steve McDonald" location="Newark, NJ" money="60000" />





      As you can see, Jen P has multiple instance, but in my column chart I want to display just Jen P once, but with the overall total of her money = 1700 instead of having two instances of Jen P money like I currently displaying in my code . Can someone guide me in displaying Jen P once with the total instead of seperate instances.




      <mx:ColumnChart x="10" y="10" id="columnchart1" width="476" height="142" dataProvider="{data}">


      <mx:CategoryAxis categoryField="name" />


      <mx:series >

      <mx:ColumnSeries yField="phone" displayName="Jen P"/>



      <mx:Legend dataProvider="{columnchart1}" x="383" y="1"/>


      Best regards,















        • 1. Re: Help with Column Chart
          babo_ya Level 3

          Where are you getting this data? service?


          If this Object are dynamic than when you add them to the ArrayCollection if once already exists then add the MONEY?



          for example, let's say that you have a XML looks like this..













          var i:int;

          var len:int = xml.length();


          for(i = 0; i < len; i++)


               var d:Object = new Object();

               d.name = xml[i].name;

               d.money = xml[i].money;


               var j:int;

               var aryLen:int = ac.length;

               var found:Boolean = false;

               for(j = 0; j < aryLen; j++)


                    if(data.getItemAt[j].name == d.name)


                         data.getItemAt[j].money += d;

                         found = true;












          if it's not dynamic data just remove one and put 1700



          Hope this helps,