2 Replies Latest reply on Feb 10, 2012 1:33 AM by SharadForum

    Is Stacked Bar/Column chart Supports Multiseries..?

    Subin_5574
      Hi All
      Is Stacked Bar/Column chart Supports Multiseries..?
      I was trying to build a Stacked Bar chart .And add a line series to it But when i run this I'm getting an error
      like this
      "ReferenceError: Error #1056: Cannot create property offset on mx.charts.series.LineSeries."

      Here is My Code
      ------------------------------------------------------
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
      <![CDATA[
      import mx.collections.ArrayCollection;
      [Bindable]
      public var netPrByQtrData:ArrayCollection=new ArrayCollection
      ([
      {quarter:"Q4 05", bottom:88.89, middle:11.11, top:0.00, netPromoter:-88.89},
      {quarter:"Q1 06", bottom:80.00, middle:10.00, top:10.00, netPromoter:-70.00},
      {quarter:"Q2 06", bottom:16.67, middle:50.00, top:33.33, netPromoter:16.67},
      {quarter:"Q3 06", bottom:28.57, middle:28.57, top:42.86, netPromoter:14.29},
      {quarter:"Q4 06", bottom:80.00, middle:20.00, top:0.00, netPromoter:-80.00},
      {quarter:"Q1 07", bottom:80.00, middle:0.00, top:20.00, netPromoter:-60.00},
      {quarter:"Q2 07", bottom:60.00, middle:20.00, top:20.00, netPromoter:-40.00},
      {quarter:"Q3 07", bottom:80.00, middle:0.00, top:20.00, netPromoter:-60.00}
      ]);
      ]]>
      </mx:Script>
      <mx:Panel title="Net Promoter By Quarters" width="500" height="350" x="31" y="34">
      <mx:ColumnChart id="mychart"
      dataProvider="{netPrByQtrData}"
      showDataTips="true"
      height="250"
      width="450" type="stacked">

      <mx:horizontalAxis>
      <mx:CategoryAxis categoryField="quarter"/>
      </mx:horizontalAxis>

      <mx:series>
      <mx:ColumnSeries
      yField="bottom"
      xField="quarter"
      displayName="Bottom" >
      </mx:ColumnSeries>
      <mx:ColumnSeries
      yField="middle"
      xField="quarter"
      displayName="Middle" >
      </mx:ColumnSeries>
      <mx:ColumnSeries
      yField="top"
      xField="quarter"
      displayName="Top" >
      </mx:ColumnSeries>
      <mx:LineSeries
      yField="netPromoter"
      xField="quarter"
      displayName="Net Promoter" >
      </mx:LineSeries>
      </mx:series>
      </mx:ColumnChart>
      <mx:Legend dataProvider="{mychart}" direction="horizontal"/>
      </mx:Panel>
      </mx:Application>
      -------------------------------------------------------------------------
      If I omit type="stacked" from

      <mx:ColumnChart id="mychart"
      dataProvider="{netPrByQtrData}"
      showDataTips="true"
      height="250"
      width="450" type="stacked">

      The code will work perfectly..But unfortunately its not a Stacked Chart...

      Is there any solution for this....Please reply your valuable suggestions ASAP.....

      Thanks in Advance..
      Subin



        • 1. Re: Is Stacked Bar/Column chart Supports Multiseries..?
          davidmedifit Level 1
          Hi Subin - I think the problem is that "stacked" can only be used with "AreaChart, BarChart, and ColumnChart", according to the Flex 2 documentation, and you are trying to apply this to a line chart.

          I tried creating a second series, but had no luck that way either - sorry, I'm out of answers for this one.

          If you find an answer, maybe you could post back.

          Cheers,

          Davo
          • 2. Re: Is Stacked Bar/Column chart Supports Multiseries..?
            SharadForum

            Hello,

             

            In Flex Builder 4 and Above.

             

            For composite charts with Multiple column series and line series,

            Remove type = “stacked” property from Column Chart.

            and Add columnset like.

             

            <mx:series>

                <mx:ColumnSet type="stacked">

                   <mx:ColumnSeries yField="aSales" displayName="A Sales" />

                   <mx:ColumnSeries yField="bSales" displayName="B Sales" />

                </mx:ColumnSet>

                <mx:LineSeries yField="total" displayName="Total Sales"/>

            </mx:series>

             

            Cheers,

            SaM.