3 Replies Latest reply on Feb 26, 2009 5:29 AM by Newsgroup_User

    Dynamic LineSeries creation

    fusi0n89
      I have a xml file like
      <xvalues>
      <xvalue x="4" y1="1" y2="4" />
      <xvalue x="3" y1="2" y2="2" />
      <xvalue x="2" y1="3" y2="5" />
      <xvalue x="1" y1="1" y2="9" />
      </xvalues>

      That I want to import into a DataGrid and then use those columns to add LineSeries to a empty LineChart. The DataGrid will create all the columns for me and the xml will have a variable amount of y# fields. The only way I can find of adding a LineSeries is hardcoding it. I've attached my mxml file with a commented out attempt at pushing series onto the stack. If anyone has any idea how to do this please let me know.
        • 1. Re: Dynamic LineSeries creation
          Level 7

          "fusi0n89" <webforumsuser@macromedia.com> wrote in message
          news:go4tc2$jo3$1@forums.macromedia.com...
          >I have a xml file like
          > <xvalues>
          > <xvalue x="4" y1="1" y2="4" />
          > <xvalue x="3" y1="2" y2="2" />
          > <xvalue x="2" y1="3" y2="5" />
          > <xvalue x="1" y1="1" y2="9" />
          > </xvalues>
          >
          > That I want to import into a DataGrid and then use those columns to add
          > LineSeries to a empty LineChart. The reason is its the DataGrid will
          > create all
          > the columns for me and the xml will have a variable amount of y# fields.
          > The
          > only way I can find of adding a LineSeries is hardcoding it. I've attached
          > my
          > mxml file with a commented out attempt at pushing series onto the stack.
          > If
          > anyone has any idea how to do this please let me know.

          Maybe this will help:
          http://flexdiary.blogspot.com/2008/08/charting-example.html


          • 2. Re: Dynamic LineSeries creation
            fusi0n89 Level 1
            Thanks, I'd seen that but thought it was just applying series to different axis not dynamically creating them from the xml. Now that I've changed the structure of my xml to suit this, lines are using the segment form. Flex builder doesn't recognize:
            series.form = "curve"; //error!
            Is there another way to get the curve form?
            • 3. Re: Dynamic LineSeries creation
              Level 7

              "fusi0n89" <webforumsuser@macromedia.com> wrote in message
              news:go56ld$mp$1@forums.macromedia.com...
              > Thanks, I'd seen that but thought it was just applying series to different
              > axis
              > not dynamically creating them from the xml. Now that I've changed the
              > structure
              > of my xml to suit this, lines are using the segment form. Flex builder
              > doesn't
              > recognize:
              > series.form = "curve"; //error!
              > Is there another way to get the curve form?

              I think it's a style. So either use CSS or series.setStyle('form',
              'curve');