0 Replies Latest reply on Jan 8, 2010 10:40 AM by JeffBerney

    Dynamically Add Series to a flex chart

    JeffBerney

      Hello,

      Does any one know how to dynamically add series to an areachart? I'm trying to create a dashboard with this kind of chart http://www.meutzner.com/blog/attachments/360/Flex_Finance_Step5.html  but with multiple series. I have the xml like this..and I need to use the kwhsavs as the data points..

       

      I know I have to do it in the result handler..can someone help me out?.....thanks in advance.

       

      /**
               * Called when HTTPService call completes the data load of the XML chart info.
               */
                  private function dataResult(event:ResultEvent):void
                  {

       

                       var tmpData:ArrayCollection = event.result.root.program;
                       for each (var item in tmpData)
                       {
                               // Here new series here...


                       }
                  }
                 
              /**

       

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <root>
        <program programName="Series 1">
          <totkwhsavs date="2008-01-03" kwhsavs="47632.3200" />
          <totkwhsavs date="2008-01-04" kwhsavs="51418.5600" />
          <totkwhsavs date="2008-01-07" kwhsavs="170604.4800" />
          <totkwhsavs date="2008-01-08" kwhsavs="32632.3200" />
          <totkwhsavs date="2008-01-09" kwhsavs="61200.9600" />
          <totkwhsavs date="2008-01-10" kwhsavs="79312.3200" />
          <totkwhsavs date="2008-01-11" kwhsavs="35648.6400" />
          <totkwhsavs date="2008-01-14" kwhsavs="17688.9600" />
          <totkwhsavs date="2008-01-15" kwhsavs="37404.4800" />
          <totkwhsavs date="2008-01-16" kwhsavs="15341.7600" />
          <totkwhsavs date="2008-01-17" kwhsavs="107674.5600" />
          <totkwhsavs date="2008-01-18" kwhsavs="24521.6000" />
          <totkwhsavs date="2008-01-21" kwhsavs="6541.4400" />
          <totkwhsavs date="2008-01-22" kwhsavs="33707.5200" />
          <totkwhsavs date="2008-01-23" kwhsavs="48791.0400" />
          <totkwhsavs date="2008-01-24" kwhsavs="70316.1600" />
          <totkwhsavs date="2008-01-25" kwhsavs="37237.7600" />
          <totkwhsavs date="2008-01-28" kwhsavs="5273.2800" />
          <totkwhsavs date="2008-01-29" kwhsavs="51608.6400" />
          <totkwhsavs date="2008-01-30" kwhsavs="273521.2800" />
          <totkwhsavs date="2008-01-31" kwhsavs="262619.5200" />
          <totkwhsavs date="2008-02-01" kwhsavs="336914.8800" />
          <totkwhsavs date="2008-02-04" kwhsavs="126445.4400" />
          <totkwhsavs date="2008-02-05" kwhsavs="372644.1600" />
          <totkwhsavs date="2008-02-06" kwhsavs="157114.5600" />
          <totkwhsavs date="2008-02-07" kwhsavs="74941.4400" />
          <totkwhsavs date="2008-02-08" kwhsavs="36904.3200" />
          <totkwhsavs date="2008-02-11" kwhsavs="20378.8800" />
          <totkwhsavs date="2008-02-12" kwhsavs="31257.6000" />
          <totkwhsavs date="2008-02-13" kwhsavs="224701.4400" />
          <totkwhsavs date="2008-02-14" kwhsavs="229971.8400" />
          <totkwhsavs date="2008-02-15" kwhsavs="82936.3200" />
          <totkwhsavs date="2008-02-19" kwhsavs="71586.5600" />
          <totkwhsavs date="2008-02-20" kwhsavs="45050.8800" />
          <totkwhsavs date="2008-02-21" kwhsavs="399826.5600" />
          <totkwhsavs date="2008-02-22" kwhsavs="86696.9600" />
          <totkwhsavs date="2008-02-25" kwhsavs="174406.0800" />
          <totkwhsavs date="2008-02-28" kwhsavs="52768.0000" />
          <totkwhsavs date="2008-03-04" kwhsavs="216846.7200" />
          <totkwhsavs date="2008-03-05" kwhsavs="205426.5600" />
          <totkwhsavs date="2008-03-06" kwhsavs="81350.4000" />
          <totkwhsavs date="2008-03-07" kwhsavs="75051.8400" />
          <totkwhsavs date="2008-03-13" kwhsavs="8718.7200" />
          <totkwhsavs date="2008-03-14" kwhsavs="8397.1200" />
          <totkwhsavs date="2008-03-17" kwhsavs="185443.2000" />
          <totkwhsavs date="2008-03-20" kwhsavs="6000.0000" />
          <totkwhsavs date="2008-03-24" kwhsavs="5782.0800" />
          <totkwhsavs date="2008-03-26" kwhsavs="75034.5600" />
          <totkwhsavs date="2008-03-27" kwhsavs="159776.6400" />
          <totkwhsavs date="2008-03-31" kwhsavs="1143795.8400" />
          <totkwhsavs date="2008-04-01" kwhsavs="52963.2000" />
          <totkwhsavs date="2008-04-08" kwhsavs="4000.0000" />
          <totkwhsavs date="2008-04-25" kwhsavs="50015.0400" />
          <totkwhsavs date="2008-05-08" kwhsavs="440999.0400" />
          <totkwhsavs date="2008-05-27" kwhsavs="7856.6400" />
          <totkwhsavs date="2008-05-28" kwhsavs="999.3600" />
          <totkwhsavs date="2008-06-02" kwhsavs="83316.4800" />
          <totkwhsavs date="2008-06-03" kwhsavs="14005.4400" />
          <totkwhsavs date="2008-06-04" kwhsavs="113183.0400" />
          <totkwhsavs date="2008-06-23" kwhsavs="6055.6800" />
          <totkwhsavs date="2008-06-26" kwhsavs="55369.9200" />
          <totkwhsavs date="2008-07-08" kwhsavs="105760.3200" />
          <totkwhsavs date="2008-07-11" kwhsavs="167619.8400" />
          <totkwhsavs date="2008-07-17" kwhsavs="113564.1600" />
          <totkwhsavs date="2008-07-18" kwhsavs="23229.1200" />
          <totkwhsavs date="2008-07-30" kwhsavs="49492.8000" />
          <totkwhsavs date="2008-08-02" kwhsavs="111351.3600" />
          <totkwhsavs date="2008-08-08" kwhsavs="167619.8400" />
          <totkwhsavs date="2008-08-12" kwhsavs="2707.2000" />
          <totkwhsavs date="2008-08-26" kwhsavs="191064.9600" />
          <totkwhsavs date="2008-08-27" kwhsavs="3519.3600" />
          <totkwhsavs date="2008-08-29" kwhsavs="18752.6400" />
          <totkwhsavs date="2008-09-02" kwhsavs="22167.3600" />
          <totkwhsavs date="2008-09-04" kwhsavs="1082.8800" />
          <totkwhsavs date="2008-09-05" kwhsavs="587137.9200" />
          <totkwhsavs date="2008-09-09" kwhsavs="33824.6400" />
          <totkwhsavs date="2008-09-16" kwhsavs="22167.3600" />
          <totkwhsavs date="2008-09-17" kwhsavs="17763.8400" />
          <totkwhsavs date="2008-09-19" kwhsavs="8674.5600" />
          <totkwhsavs date="2008-09-24" kwhsavs="53396.1600" />
          <totkwhsavs date="2008-09-25" kwhsavs="10428.4800" />
          <totkwhsavs date="2008-10-01" kwhsavs="61750.0800" />
          <totkwhsavs date="2008-10-02" kwhsavs="107643.8400" />
          <totkwhsavs date="2008-10-03" kwhsavs="47462.4000" />
          <totkwhsavs date="2008-10-06" kwhsavs="4005.1200" />
          <totkwhsavs date="2008-10-07" kwhsavs="39736.3200" />
          <totkwhsavs date="2008-10-09" kwhsavs="9152.6400" />
          <totkwhsavs date="2008-10-10" kwhsavs="2616.0000" />
          <totkwhsavs date="2008-10-13" kwhsavs="8268.4800" />
          <totkwhsavs date="2008-10-14" kwhsavs="138812.1600" />
          <totkwhsavs date="2008-10-15" kwhsavs="28195.2000" />
          <totkwhsavs date="2008-10-17" kwhsavs="175518.7200" />
          <totkwhsavs date="2008-10-22" kwhsavs="37278.7200" />
          <totkwhsavs date="2008-10-28" kwhsavs="33956.1600" />
          <totkwhsavs date="2008-10-29" kwhsavs="17937.6000" />
          <totkwhsavs date="2008-10-30" kwhsavs="264252.4800" />
          <totkwhsavs date="2008-10-31" kwhsavs="9727.6800" />
          <totkwhsavs date="2008-11-03" kwhsavs="51020.1600" />
          <totkwhsavs date="2008-11-20" kwhsavs="5414.4000" />
          <totkwhsavs date="2008-11-21" kwhsavs="14672.6400" />
          <totkwhsavs date="2008-11-25" kwhsavs="5414.4000" />
          <totkwhsavs date="2008-12-01" kwhsavs="2165.7600" />
          <totkwhsavs date="2008-12-03" kwhsavs="10558.0800" />
          <totkwhsavs date="2008-12-05" kwhsavs="292814.4000" />
          <totkwhsavs date="2008-12-08" kwhsavs="342307.2000" />
          <totkwhsavs date="2008-12-09" kwhsavs="2707.2000" />
          <totkwhsavs date="2008-12-11" kwhsavs="4005.1200" />
          <totkwhsavs date="2008-12-16" kwhsavs="108993.6000" />
          <totkwhsavs date="2008-12-17" kwhsavs="7841.2800" />
          <totkwhsavs date="2008-12-18" kwhsavs="206042.8800" />
          <totkwhsavs date="2008-12-19" kwhsavs="163659.8400" />
          <totkwhsavs date="2008-12-22" kwhsavs="97653.1200" />
          <totkwhsavs date="2008-12-23" kwhsavs="161386.5600" />
          <totkwhsavs date="2008-12-26" kwhsavs="525004.8000" />
          <totkwhsavs date="2008-12-27" kwhsavs="95824.3200" />
          <totkwhsavs date="2008-12-29" kwhsavs="280452.4800" />
          <totkwhsavs date="2008-12-30" kwhsavs="442554.2400" />
          <totkwhsavs date="2008-12-31" kwhsavs="4610.8800" />
        </program>
        <program programName="Series 2">
          <totkwhsavs date="2008-07-01" kwhsavs="5283.9000" />
          <totkwhsavs date="2008-07-23" kwhsavs="17469.5700" />
          <totkwhsavs date="2008-07-30" kwhsavs="22569.0800" />
          <totkwhsavs date="2008-07-31" kwhsavs="13742.0100" />
          <totkwhsavs date="2008-08-01" kwhsavs="36402.7500" />
          <totkwhsavs date="2008-08-02" kwhsavs="61254.7100" />
          <totkwhsavs date="2008-08-18" kwhsavs="9888.1200" />
          <totkwhsavs date="2008-08-19" kwhsavs="30139.8300" />
          <totkwhsavs date="2008-08-20" kwhsavs="52721.6500" />
          <totkwhsavs date="2008-08-21" kwhsavs="5217.2100" />
          <totkwhsavs date="2008-08-25" kwhsavs="163535.8300" />
          <totkwhsavs date="2008-09-03" kwhsavs="18812.8000" />
          <totkwhsavs date="2008-09-04" kwhsavs="87868.2000" />
          <totkwhsavs date="2008-09-05" kwhsavs="65277.9300" />
          <totkwhsavs date="2008-09-09" kwhsavs="40875.8200" />
          <totkwhsavs date="2008-09-11" kwhsavs="64145.5300" />
          <totkwhsavs date="2008-09-12" kwhsavs="2064.9600" />
          <totkwhsavs date="2008-09-16" kwhsavs="7529.4100" />
          <totkwhsavs date="2008-09-17" kwhsavs="3012.8600" />
          <totkwhsavs date="2008-09-19" kwhsavs="21610.4900" />
          <totkwhsavs date="2008-09-20" kwhsavs="6932.5400" />
          <totkwhsavs date="2008-09-22" kwhsavs="7721.2100" />
          <totkwhsavs date="2008-09-23" kwhsavs="40967.6000" />
          <totkwhsavs date="2008-09-24" kwhsavs="75629.6900" />
          <totkwhsavs date="2008-09-25" kwhsavs="3022.6500" />
          <totkwhsavs date="2008-09-26" kwhsavs="85524.6500" />
          <totkwhsavs date="2008-09-27" kwhsavs="54166.3200" />
          <totkwhsavs date="2008-10-01" kwhsavs="87857.8100" />
          <totkwhsavs date="2008-10-02" kwhsavs="44671.7400" />
          <totkwhsavs date="2008-10-03" kwhsavs="28834.2800" />
          <totkwhsavs date="2008-10-06" kwhsavs="91743.7100" />
          <totkwhsavs date="2008-10-07" kwhsavs="20846.7800" />
          <totkwhsavs date="2008-10-08" kwhsavs="72984.9000" />
          <totkwhsavs date="2008-10-09" kwhsavs="107800.3700" />
          <totkwhsavs date="2008-10-10" kwhsavs="35978.6200" />
          <totkwhsavs date="2008-10-13" kwhsavs="13388.2900" />
          <totkwhsavs date="2008-10-14" kwhsavs="117283.5600" />
          <totkwhsavs date="2008-10-15" kwhsavs="26121.6000" />
          <totkwhsavs date="2008-10-16" kwhsavs="4479.6800" />
          <totkwhsavs date="2008-10-20" kwhsavs="12263.6000" />
          <totkwhsavs date="2008-10-21" kwhsavs="10964.9100" />
          <totkwhsavs date="2008-10-22" kwhsavs="17431.6800" />
          <totkwhsavs date="2008-10-29" kwhsavs="11556.2800" />
          <totkwhsavs date="2008-10-30" kwhsavs="17684.6600" />
          <totkwhsavs date="2008-10-31" kwhsavs="15702.8400" />
          <totkwhsavs date="2008-11-04" kwhsavs="53668.5300" />
          <totkwhsavs date="2008-11-05" kwhsavs="52350.2000" />
          <totkwhsavs date="2008-11-06" kwhsavs="57828.7900" />
          <totkwhsavs date="2008-11-11" kwhsavs="31006.9100" />
          <totkwhsavs date="2008-11-13" kwhsavs="48291.9000" />
          <totkwhsavs date="2008-11-20" kwhsavs="78897.6500" />
          <totkwhsavs date="2008-11-24" kwhsavs="23127.2300" />
          <totkwhsavs date="2008-11-25" kwhsavs="78861.3600" />
          <totkwhsavs date="2008-11-26" kwhsavs="11158.7800" />
          <totkwhsavs date="2008-12-01" kwhsavs="25061.2300" />
          <totkwhsavs date="2008-12-03" kwhsavs="25387.5800" />
          <totkwhsavs date="2008-12-04" kwhsavs="39855.6600" />
          <totkwhsavs date="2008-12-05" kwhsavs="10968.9500" />
          <totkwhsavs date="2008-12-16" kwhsavs="17024.3800" />
          <totkwhsavs date="2008-12-19" kwhsavs="35257.8500" />
        </program>
        <program programName="Series 3">
          <totkwhsavs date="2008-09-29" kwhsavs="33088.1500" />
          <totkwhsavs date="2008-09-30" kwhsavs="22931.1500" />
          <totkwhsavs date="2008-10-01" kwhsavs="56942.0000" />
          <totkwhsavs date="2008-10-02" kwhsavs="26399.0000" />
          <totkwhsavs date="2008-10-03" kwhsavs="26060.4500" />
          <totkwhsavs date="2008-10-06" kwhsavs="25107.6000" />
          <totkwhsavs date="2008-10-07" kwhsavs="40643.3900" />
          <totkwhsavs date="2008-10-08" kwhsavs="79733.4300" />
          <totkwhsavs date="2008-10-09" kwhsavs="62522.1000" />
          <totkwhsavs date="2008-10-10" kwhsavs="39355.0000" />
          <totkwhsavs date="2008-10-13" kwhsavs="128959.1700" />
          <totkwhsavs date="2008-10-14" kwhsavs="70101.0600" />
          <totkwhsavs date="2008-10-15" kwhsavs="38892.3700" />
          <totkwhsavs date="2008-10-16" kwhsavs="64203.1500" />
          <totkwhsavs date="2008-10-17" kwhsavs="70063.9100" />
          <totkwhsavs date="2008-10-18" kwhsavs="23487.7900" />
          <totkwhsavs date="2008-10-20" kwhsavs="93303.6400" />
          <totkwhsavs date="2008-10-21" kwhsavs="132008.0000" />
          <totkwhsavs date="2008-10-22" kwhsavs="73830.8600" />
          <totkwhsavs date="2008-10-23" kwhsavs="21890.0000" />
          <totkwhsavs date="2008-10-24" kwhsavs="40209.0000" />
          <totkwhsavs date="2008-10-28" kwhsavs="35039.6600" />
          <totkwhsavs date="2008-10-29" kwhsavs="148992.5000" />
          <totkwhsavs date="2008-10-30" kwhsavs="62943.6000" />
          <totkwhsavs date="2008-10-31" kwhsavs="57227.5000" />
          <totkwhsavs date="2008-11-03" kwhsavs="6973.7500" />
          <totkwhsavs date="2008-11-04" kwhsavs="3172.0000" />
          <totkwhsavs date="2008-11-05" kwhsavs="107385.5100" />
          <totkwhsavs date="2008-11-06" kwhsavs="95859.0000" />
          <totkwhsavs date="2008-11-07" kwhsavs="23940.0000" />
          <totkwhsavs date="2008-11-08" kwhsavs="2256.0000" />
          <totkwhsavs date="2008-11-12" kwhsavs="54702.0000" />
          <totkwhsavs date="2008-11-13" kwhsavs="37358.1500" />
          <totkwhsavs date="2008-11-14" kwhsavs="23471.6000" />
          <totkwhsavs date="2008-11-17" kwhsavs="146144.9000" />
          <totkwhsavs date="2008-11-21" kwhsavs="63987.7800" />
          <totkwhsavs date="2008-11-24" kwhsavs="66608.7100" />
          <totkwhsavs date="2008-11-25" kwhsavs="51839.6200" />
          <totkwhsavs date="2008-11-26" kwhsavs="25777.0950" />
          <totkwhsavs date="2008-12-01" kwhsavs="37789.4200" />
          <totkwhsavs date="2008-12-02" kwhsavs="25056.3000" />
          <totkwhsavs date="2008-12-03" kwhsavs="36452.6500" />
          <totkwhsavs date="2008-12-04" kwhsavs="30799.7500" />
          <totkwhsavs date="2008-12-05" kwhsavs="21878.9100" />
          <totkwhsavs date="2008-12-06" kwhsavs="18583.0000" />
          <totkwhsavs date="2008-12-08" kwhsavs="25552.6400" />
          <totkwhsavs date="2008-12-09" kwhsavs="97217.9900" />
          <totkwhsavs date="2008-12-10" kwhsavs="84285.9600" />
          <totkwhsavs date="2008-12-11" kwhsavs="29488.8000" />
          <totkwhsavs date="2008-12-12" kwhsavs="13433.6300" />
        </program>
        <program programName="Series 4">
          <totkwhsavs date="2008-01-10" kwhsavs="192711.6750" />
          <totkwhsavs date="2008-01-16" kwhsavs="47435.5450" />
          <totkwhsavs date="2008-01-25" kwhsavs="42353.9250" />
          <totkwhsavs date="2008-01-29" kwhsavs="97847.8450" />
          <totkwhsavs date="2008-02-06" kwhsavs="106005.5750" />
          <totkwhsavs date="2008-02-07" kwhsavs="100189.7250" />
          <totkwhsavs date="2008-02-08" kwhsavs="67175.9400" />
          <totkwhsavs date="2008-02-18" kwhsavs="47212.8100" />
          <totkwhsavs date="2008-02-19" kwhsavs="47212.8100" />
          <totkwhsavs date="2008-02-27" kwhsavs="41060.1700" />
          <totkwhsavs date="2008-03-18" kwhsavs="160624.4700" />
          <totkwhsavs date="2008-03-20" kwhsavs="190567.2250" />
          <totkwhsavs date="2008-03-31" kwhsavs="113977.6800" />
          <totkwhsavs date="2008-04-09" kwhsavs="113977.6800" />
          <totkwhsavs date="2008-04-10" kwhsavs="122362.9500" />
          <totkwhsavs date="2008-04-15" kwhsavs="1154678.0460" />
          <totkwhsavs date="2008-04-28" kwhsavs="373095.0400" />
          <totkwhsavs date="2008-05-01" kwhsavs="179670.3000" />
          <totkwhsavs date="2008-05-02" kwhsavs="179670.3000" />
          <totkwhsavs date="2008-06-27" kwhsavs="987469.3110" />
          <totkwhsavs date="2008-06-30" kwhsavs="619132.6150" />
          <totkwhsavs date="2008-07-04" kwhsavs="99837.4600" />
          <totkwhsavs date="2008-07-11" kwhsavs="35544.5500" />
          <totkwhsavs date="2008-07-15" kwhsavs="142191.3850" />
          <totkwhsavs date="2008-07-16" kwhsavs="267963.6250" />
          <totkwhsavs date="2008-07-17" kwhsavs="179670.3000" />
          <totkwhsavs date="2008-07-18" kwhsavs="181073.0250" />
          <totkwhsavs date="2008-07-21" kwhsavs="100189.7250" />
          <totkwhsavs date="2008-07-23" kwhsavs="285445.3350" />
          <totkwhsavs date="2008-07-25" kwhsavs="85032.5900" />
          <totkwhsavs date="2008-07-31" kwhsavs="190181.5650" />
          <totkwhsavs date="2008-08-01" kwhsavs="66917.1450" />
          <totkwhsavs date="2008-08-02" kwhsavs="50481.8250" />
          <totkwhsavs date="2008-08-04" kwhsavs="101596.6100" />
          <totkwhsavs date="2008-08-14" kwhsavs="82165.2600" />
          <totkwhsavs date="2008-08-15" kwhsavs="41948.9950" />
          <totkwhsavs date="2008-08-19" kwhsavs="517683.2010" />
          <totkwhsavs date="2008-08-21" kwhsavs="59952.7930" />
          <totkwhsavs date="2008-08-22" kwhsavs="517683.2010" />
          <totkwhsavs date="2008-08-29" kwhsavs="115995.9250" />
          <totkwhsavs date="2008-09-22" kwhsavs="1363410.4460" />
          <totkwhsavs date="2008-09-23" kwhsavs="130221.7600" />
          <totkwhsavs date="2008-09-24" kwhsavs="82165.2600" />
          <totkwhsavs date="2008-09-25" kwhsavs="70834.1000" />
          <totkwhsavs date="2008-09-29" kwhsavs="313580.8270" />
          <totkwhsavs date="2008-09-30" kwhsavs="41948.9950" />
          <totkwhsavs date="2008-10-01" kwhsavs="120869.1520" />
          <totkwhsavs date="2008-10-08" kwhsavs="41575.7350" />
          <totkwhsavs date="2008-10-23" kwhsavs="27624.5000" />
          <totkwhsavs date="2008-11-05" kwhsavs="121396.2650" />
          <totkwhsavs date="2008-11-06" kwhsavs="120869.1520" />
          <totkwhsavs date="2008-11-07" kwhsavs="70834.1000" />
          <totkwhsavs date="2008-11-11" kwhsavs="1037228.5230" />
          <totkwhsavs date="2008-11-12" kwhsavs="584143.5000" />
          <totkwhsavs date="2008-11-14" kwhsavs="138229.3520" />
          <totkwhsavs date="2008-11-17" kwhsavs="382103.4810" />
          <totkwhsavs date="2008-11-20" kwhsavs="339721.4770" />
          <totkwhsavs date="2008-11-24" kwhsavs="211180.9280" />
        </program>
      </root>