5 Replies Latest reply on Feb 25, 2011 10:01 AM by Slewfoot303

    Charting Question: "Group By?"

    shawnyale Level 1
      Hi all,
      I came across a problem yesterday that, so far, I have been unable to solve. I'm wondering if I need to write my own handler. Here goes.

      I have a data set that looks like this:[
      {name="y2005", value="1.2", otherName="Texas"},
      {name="y2005", value="3", otherName="Ohio"},
      {name="y2005, value="2", otherName="Hawaii"},
      {name="y2006", value="1.2", otherName="Texas"},
      {name="y2006", value="3", otherName="Ohio"},
      {name="y2006, value="2", otherName="Hawaii"},
      {name="y2007", value="1.2", otherName="Texas"},
      {name="y2007", value="3", otherName="Ohio"},
      {name="y2007, value="2", otherName="Hawaii"}].

      I want to set my score value to be the yField and I want a unique series for each name value, however I want all of the values to be grouped by the otherName value. So in this instance, I would see in my chart a 3 series group for the axis value of Texas, a 3 series grouping for Ohio, and a 3 series group for Hawaii.

      I've already tried to use the categoryName property on the horizontal axis, but I'm getting multiple "otherName" labels on my horizontal axis. For example using this set, i would get Hawaii, 3 times on the axis, texas 3 times, and ohio 3 times, but the data is charted on the last instance of the names.

      Most data platforms have some kind of "group by" field, does this extend to the Charting components??

        • 1. Re: Charting Question: "Group By?"
          Level 7

          "shawn.yale" <syale@triad.rr.com> wrote in message
          news:ggjjv8$kt6$1@forums.macromedia.com...
          > Hi all,
          > I came across a problem yesterday that, so far, I have been unable to
          > solve.
          > I'm wondering if I need to write my own handler. Here goes.
          >
          > I have a data set that looks like this:[
          > {name="y2005", value="1.2", otherName="Texas"},
          > {name="y2005", value="3", otherName="Ohio"},
          > {name="y2005, value="2", otherName="Hawaii"},
          > {name="y2006", value="1.2", otherName="Texas"},
          > {name="y2006", value="3", otherName="Ohio"},
          > {name="y2006, value="2", otherName="Hawaii"},
          > {name="y2007", value="1.2", otherName="Texas"},
          > {name="y2007", value="3", otherName="Ohio"},
          > {name="y2007, value="2", otherName="Hawaii"}].
          >
          > I want to set my score value to be the yField and I want a unique series
          > for
          > each name value, however I want all of the values to be grouped by the
          > otherName value. So in this instance, I would see in my chart a 3 series
          > group
          > for the axis value of Texas, a 3 series grouping for Ohio, and a 3 series
          > group
          > for Hawaii.
          >
          > I've already tried to use the categoryName property on the horizontal
          > axis,
          > but I'm getting multiple "otherName" labels on my horizontal axis. For
          > example
          > using this set, i would get Hawaii, 3 times on the axis, texas 3 times,
          > and
          > ohio 3 times, but the data is charted on the last instance of the names.
          >
          > Most data platforms have some kind of "group by" field, does this extend
          > to
          > the Charting components??

          Flex has the GroupingCollection, which you _could_ use in this situation,
          but you could also try something kind of like this:
          http://flexdiary.blogspot.com/2008/08/charting-example.html


          • 2. Re: Charting Question: &quot;Group By?&quot;
            shawnyale Level 1
            Awesome Amy. Thank you! I will check both of those options out. I briefly glanced at the grouping collection but thought that perhaps there was functionality in the chart itself to handle this type of situation.

            Cheers!
            • 3. Re: Charting Question: &quot;Group By?&quot;
              Level 7

              "shawn.yale" <syale@triad.rr.com> wrote in message
              news:ggk3to$ae0$1@forums.macromedia.com...
              > Awesome Amy. Thank you! I will check both of those options out. I
              > briefly
              > glanced at the grouping collection but thought that perhaps there was
              > functionality in the chart itself to handle this type of situation.
              >
              > Cheers!

              Let me know how it goes :-)


              • 4. Charting Question: &quot;Group By?&quot;
                shawnyale Level 1
                I tried both of the approaches but Im still not getting what I expect.
                I used both the columnset and the groupingCollection but neither is showing me the data at all.

                Basically, I want to group my fields by name as my xField and my value is my yField but I want the groups to be colelcted and displayed based on the othername field.

                so in this example, I would have one block for texas, one for ohio, and one for hawaii and within each group I would be three individual graphs for the name.

                |y2005|y2006|y2007 |y2005|y2006|y2007 |y2005|y2006|y2007
                Texas | Ohio | Hawaii

                like that.

                Ive googled this to death. any help would be greatly appreciated. Even better if you can show me some code cause Im not sure where the groupingCollection goes in relation to the columnseries inside the mxml, and/or where the columnset goes.

                Thank you so much!
                • 5. Re: Charting Question: &quot;Group By?&quot;
                  Slewfoot303

                  Did you ever solve this problem, and if so, would you mind posting some details on how you accomplished this task?  I'm having the same problem now and would appreciate any guidance from the community if possible.