1 Reply Latest reply on Sep 1, 2010 3:59 AM by rootsounds

    Drawing TrendLines in Line Chart

    Sen Imagines Level 1

      Hi,

       

      I am using a Line Chart in one of my projects.

      I use a HTTPService to fetch XML Data to feed the chart.

       

      <mx:HTTPService id="myServ" url="ChartData.xml" result="myResultHandler(event)"/>

       

      I draw two trend lines over the chart based on the max & min values for a specified node in the XML data

       

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

      <nodes>

          <node month="Jan-10">

             <expenses>20</expenses>       

          </node>

          <node month="Feb-10">

             <expenses>30</expenses>       

          </node>

          <node month="Mar-10">

              <expenses>80</expenses>       

          </node>

          <node month="Mar-10">

              <expenses>20</expenses>       

          </node>

      </nodes>
      I use the expense node in determining the max & min value for the chart.
      I determine the max & min values & draw the lines in the result handler function:
      If i use result Format = "e4x", I am able to iterate the data as XML List Collection, but when I get the data as ActionScript objects, I am not able to iterate the XML data.
      public function drawLine(event:Event):void
      {
           myChartCanvas.clear();
           myChartCanvas.lineStyle(2, 0x000000, 1);
           myChartCanvas.moveTo('Jan-10', 50);
           myChartCanvas.lineTo('Aug-10', 70);
      }
      How can i iterate the nodes in AS3 object format to find the max & min nodes & draw the trend lines ?
      - Sen