0 Replies Latest reply on Jan 16, 2008 10:17 AM by echovalley1

    Chart bindable not working?

      I am new to flex, here is my testing program for real-time charting. It simulates a JFreeChart TimeSeries, the series shifts left one point per second. The setInterval works, getData works, however, the chart is not refreshing. Could you advise? Thanks,
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" initialize="initApp()">
      var results: Array;

      var call:uint = 0;
      var interval: Number=1000;

      function initApp():void {
      results=new Array();
      for (var i:int=0; i<20; i++) {
      var tm:Date = new Date();
      results.push({time: tm, value: 20000+Math.round(Math.random()*10000)});

      call=setInterval(getData, interval);
      function getData():void {
      // In a real life scenario, you could poll the server here, or use an XMLSocket or Flash Communication Server
      // approach to push data from the server to the client.
      var tm2:Date = new Date();
      var sizeOfresult:uint = results.push({time: tm2, value: 20000+Math.round(Math.random()*10000)});



      <mx:LineChart id="chart" dataProvider="{results}" showDataTips="true" width="100%" height="100%">

      <mx:CategoryAxis dataProvider="{results}" categoryField="time"/>


      <mx:LineSeries dataProvider="{results}" yField="value" displayName="Total"/>