0 Replies Latest reply on Mar 27, 2008 11:09 AM by tguimond

    Linechart XML data from .net webservice


      Quite new to flex but think i am on the right track with this. I have been getting a strange error and hope someone can help me with it.

      I am putting together a linechart which shows the number of unique visitors on my site. It contains two datefields which the user enters the start and end date.

      I am receiving the xml data from my webservice which looks like this

      <result day="3/14/2008">
      <result day="3/13/2008">
      <result day="3/12/2008">
      <result day="3/11/2008">

      When i attempt to bind this as a string to my linechart i get this error "" ReferenceError: Error #1069: Property visitors not found on String and there is no default value.

      When i convert the string to XML i get no error but nothing appears on my line chart.

      My code is as follows:

      Attach Code:

      <?xml version="1.0"?>
      <!-- charts/XMLFileDataProvider.mxml -->
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" horizontalAlign="center" layout="vertical" verticalAlign="top">

      import mx.rpc.events.ResultEvent;
      import mx.collections.XMLListCollection;
      import mx.controls.Alert;
      import mx.controls.Label;
      import mx.containers.Canvas;
      import flash.external.*;
      import mx.core.Application;
      import mx.rpc.events.FaultEvent;
      import mx.controls.Text;


      private var myData:String;


      private var myXMLData:XML;

      private function resultHandler(event:ResultEvent):void {
      myData = event.result as String;
      myXMLData = new XML(myData);


      <mx:WebService id="statsService" wsdl=" http://localhost/sampleapp/ws/getXML.asmx?WSDL"
      <mx:operation name="getStatsByDayXML" result="resultHandler(event)">

      <mx:Canvas width="732" height="35">
      <mx:DateField x="69" id="dateFromTxt" y="10" width="174" showToday="true" enabled="true"/>
      <mx:Label x="0" y="14" text="Start Date" fontWeight="bold" color="#ffffff"/>
      <mx:Label x="266" y="14" text="End Date" fontWeight="bold" color="#ffffff"/>
      <mx:DateField id="dateToTxt" width="174" x="329" y="10" showToday="true" enabled="true"/>
      <mx:Button x="530" y="10" label="Get Stats" click="statsService.getStatsByDayXML()" />
      <mx:Panel title="CareerQuestions ::: Unique Visitors" width="735">
      <mx:LineChart name="visitors" dataProvider="{myData}" id="chart" height="265" width="692">
      <mx:CategoryAxis categoryField="day"/>
      <mx:LineSeries yField="visitors" displayName="Unique Visitors"/>
      <mx:Label text="{myData}" width="402" height="204" color="#ffffff"/>