3 Replies Latest reply on Jan 25, 2010 2:09 PM by ramco9

    Chart Grouping

    ahess24

      Here's the scenario, I'm charting the results of a users reading level of a bunch of passages in different chapters.  I want to show a column for each passage's level clustered together within a chapter.  Then show a line chart on top of that that shows a single data point for the chapter overall average.  One chapter may have 5 passage results where another one may only have 2.  Something along the lines of the attached image.

       

      So, I can display the two charts with multiple axes just fine.  My problem is how to group the column chart by chapter.

       

      Thanks for in advance for any suggestions.

        • 1. Re: Chart Grouping
          ramco9 Level 1

          Hi,

           

          Please try to group it in this way.

           

           

           

          <?xml version="1.0"?>

           

          <mx:Application

           

          xmlns:mx="http://www.adobe.com/2006/mxml" >

           

          <mx:Script>

          <![CDATA[

           

          import mx.events.ItemClickEvent;

           

          import mx.collections.ArrayCollection;

           

          [

          Bindable]

           

          private var chap_data:ArrayCollection = new ArrayCollection( [

          { Chapter:

          "Ch.1", P1: 35, P2:42, P3: 29,P4:23,P5:15 },

          { Chapter:

          "Ch.2", P1: 32, P2:25, P3: 14 },

          { Chapter:

          "Ch.3", P1: 27, P2:27, P3: 38,P4:33} ]);

           

           

          ]]>

           

          </mx:Script>

           

           

          <mx:Panel height="90%" width="90%" layout="horizontal">

           

          <mx:ColumnChart id="chart"

          height="

          100%" width="100%"

          paddingLeft="

          5" paddingRight="5"

          showDataTips="

          true"

          dataProvider="

          {chap_data}" >

           

           

           

          <mx:horizontalAxis>

           

          <mx:CategoryAxis id="horizontalAxis" categoryField="Chapter"/>

           

          </mx:horizontalAxis>

           

           

          <mx:series>

           

          <mx:ColumnSeries

          xField="

          Chapter" yField="P1"

          displayName="

          P1"

           

          />

           

          <mx:ColumnSeries

          xField="

          Chapter" yField="P2"

          displayName="

          P2"

           

          />

           

          <mx:ColumnSeries

          xField="

          Chapter" yField="P3"

          displayName="

          P3"

           

          />

           

          <mx:ColumnSeries

          xField="

          Chapter" yField="P4"

          displayName="

          P4"

           

          />

           

          <mx:ColumnSeries

          xField="

          Chapter" yField="P5"

          displayName="

          P5"

           

          />

           

          </mx:series>

           

           

          </mx:ColumnChart>

           

           

           

           

          </mx:Panel>

          </mx:Application>

           

           

           

          Thank you

          Ram

          • 2. Re: Chart Grouping
            ahess24 Level 1

            Thanks for the input.  I tried something along those lines, but it wasn't working out.  Your example helped me work out exactly what I needed.

            • 3. Re: Chart Grouping
              ramco9 Level 1

                      Cool!!!