4 Replies Latest reply on Sep 23, 2010 4:27 AM by Sen Imagines

    Line Chart with nested <XML> nodes

    Sen Imagines Level 1

      Hi,

       

      I use a Flex 3 Line Chart.

      The chart gets its data from a remote XML file through <mx:HTTPService> as:

           <mx:HTTPService id="myServ" url="MyChartData.xml"/>

       

       

      I want the graph to be plotted for all nodes that come under each nodeset for <node> values:

      <nodes>

           <nodeset id="1">

                <node>

                <node>

           </nodeset>

           <nodeset id="2">

                <node>

                <node>

           </nodeset>

      </nodes>

       

      The chart is getting plotted when I use the dataProvider for only the first inner Node as:

      myServ.lastResult.nodes.nodeset[0].node

       

      How to get the chart plotted for all the inner nodes?

       

      The mxml:

      --------------------------

       

       

      <mx:LineChart id="myChart" width="100%" height="100%" showDataTips="true" dataProvider="{myServ.lastResult.nodes.nodeset.node}">

       

           <mx:horizontalAxis>

                <mx:CategoryAxis categoryField="period" title="Node Value"/>

           </mx:horizontalAxis>

       

          

           <mx:verticalAxis>

                <mx:LinearAxis title="Period"/>

           </mx:verticalAxis>

       

       

           <mx:series>

                <mx:LineSeries id="myLineSeries1" xField="period" yField="value"/>

           </mx:series>

       

      </mx:LineChart>

       

      The Sample XML:

      --------------------------

      <?xml version="1.0" encoding="utf-8"?>

      <nodes>

      <nodeset id="1">

          <node period="01">

              <value>-115</value>       

          </node>

          <node period="02">

              <value>-115</value>       

          </node>

          <node period="03">

              <value>-114</value>       

          </node>   

          <node period="04">

              <value>0</value>       

          </node>

      </nodeset>

      <nodeset id="2">   

          <node period="05">

              <value>-114</value>       

          </node>

          <node period="06">

          <value>0</value>

          </node>

          <node period="07">

          <value>0</value>

          </node>

          <node period="08">

          <value>0</value>

          </node>

      </nodeset>

      </nodes>