2 Replies Latest reply on Mar 24, 2008 1:55 PM by devonsam

    HttpService, DataBinding and Charts

    RT2008
      I am sort of a newbie with flex - and havent understood the data binding in Flex properly. Hoping to get some pointers here:

      I have a chart of the following type:

      <mx:ColumnChart
      id="myChart"
      dataProvider="{srv.lastResult.X.Y}"
      showDataTips="true"
      width="95%" height="95%">

      <mx:horizontalAxis>
      <mx:CategoryAxis
      categoryField="First"
      />
      </mx:horizontalAxis>

      <mx:series>
      <mx:ColumnSeries
      xField="First"
      yField="Second"
      />
      </mx:series>
      </mx:ColumnChart>

      and this gets populated by an httpservice as follows:
      <mx:HTTPService id="srv" url=" http://localhost:8180/Main">
      <mx:request>
      <param1>one</param1>
      </mx:request>
      </mx:HTTPService>

      so far so good, This works aok.

      However, in my application I need to be able to refresh this chart dynamically.
      For this I am using HttpService in the actionscript:
      service = new HTTPService();
      service.url = " http://localhost:8180/Main";
      service.addEventListener("result", httpResult);
      service.addEventListener("fault", httpFault);
      service.send(parameters);

      now, in the result handler ..
      public function httpResult(event:ResultEvent):void {
      var result:Object = event.result;

      now here i am not sure how to access the result object to bind this to the "myChart" above. Any pointers here will be appreciated ...

      }