4 Replies Latest reply on Nov 30, 2009 1:57 AM by Subeesh Arakkan

    AreaChart

    Chintanhg

      how to put another areaseries in areachart?

        • 1. Re: AreaChart
          Subeesh Arakkan Level 4

          Hi,

           

          Check this

           

          <mx:Script><![CDATA[
               import mx.collections.ArrayCollection;
               [Bindable]
               public var expenses:ArrayCollection = new ArrayCollection([
                  {Month:"Jan", Profit:2000, Expenses:1500},
                  {Month:"Feb", Profit:1000, Expenses:200},
                  {Month:"Mar", Profit:1500, Expenses:500}
               ]);
            ]]></mx:Script>
               <mx:AreaChart id="myChart" dataProvider="{expenses}" showDataTips="true">
                  <mx:horizontalAxis>
                     <mx:CategoryAxis
                          dataProvider="{expenses}"
                          categoryField="Month"
                     />
                  </mx:horizontalAxis>
                  <mx:series>
                     <mx:AreaSeries
                          xField="Month"
                          yField="Profit"
                          displayName="Profit"
                     />
                     <mx:AreaSeries
                          xField="Month"
                          yField="Expenses"
                          displayName="Expenses"
                     />
                  </mx:series>
               </mx:AreaChart>

          • 2. Re: AreaChart
            Chintanhg Level 1

            I know this, but how to fetch real time data and put into area series of areachart ? like google finance charts providing

            • 3. Re: AreaChart
              Subeesh Arakkan Level 4

              Hi,

               

              series property of the chart is an array. To add Series Items dynamically, you just need to push them to the array

               

                          var areaSeries:AreaSeries = new AreaSeries();
                          areaSeries.dataProvider = 'your dataprovider';
                          areaSeries.xField = 'your x field';
                          areaSeries.y = 'your y field';
                         
                          myChart.series.push(areaSeries);

              • 4. Re: AreaChart
                Chintanhg Level 1

                thanx, i'll try it