0 Replies Latest reply on Jan 2, 2008 1:45 PM by nahrendt

    Auto Refresh Web Services

    nahrendt
      I'm trying to get a pie chart which automatically refreshes and gets new data from a webservice. Currently, we just have a sample webservice which spits out a random array of numbers. I can get the chart to display these, but not to refresh itself. I found a code online for an auto-refreshing clock, but can't seem to plug in my own data to get it to work. Currently, it displays the initial chart, then after the set time (in this case 2 seconds), it disappears and will not return. <flexed: autorefresher refers to the actionscript file.

      I'd appreciate any help, as I've just recently started learning flex, and don't have a lot of coding experience.
      Here is the code:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" initialize="initView()" xmlns:flexed="flexed.utils.*" width="611" height="446" creationComplete="csSer.GetSummaryStatsIntArray.send()">
      <mx:Script>
      <![CDATA[

      private var dt:PieChart = new PieChart();

      //Getting the current time and setting it to the label.
      //Starting the Autorefresher
      private function initView():void{
      exampleAutoRefresh.start();
      }

      //Function to execute on each autorefresh.
      private function rfrshPie():void{
      dt = new PieChart();
      chartPie.dataProvider = dt.dataProvider = "{csSer.GetSummaryStatsIntArray.lastResult}";
      }

      ]]>
      </mx:Script>

      <mx:WebService id="csSer"
      wsdl=" http://todd/CallSummaryWebService/Service.asmx?wsdl"
      useProxy="false">

      <mx:operation name="GetSummaryStatsIntArray" xmlns=" http://tempuri.org/">
      <mx:request xmlns="">
      </mx:request>
      </mx:operation>
      </mx:WebService>

      <flexed:AutoRefresher id="exampleAutoRefresh" delay="2000" refreshFunction="rfrshPie" />

      <mx:PieChart id="chartPie"
      dataProvider="{csSer.GetSummaryStatsIntArray.lastResult}"
      showDataTips="true"
      width="306" x="226" height="283" y="55">

      <mx:series>
      <mx:PieSeries id="pieS" labelPosition="inside" field=""/>
      </mx:series>

      </mx:PieChart>
      </mx:Application>