title: How do I make a Flex Chart refresh whenever data is added to its dataProvider?
body: <p>Now I must be missing something here, as this seems a very basic issue that would be addressed in any "Getting started with Flex charting" tutorial. However, all that I could find was hints that the chart should update automatically whenever the dataProvider changes. Mind you, hints.</p>
  
  <p>This is my markup:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" title="econemon Sensor Simulator"&gt;
      &lt;!-- ... --&gt;
      &lt;mx:Script source="SimulatorFunctions.as" /&gt;
      &lt;mx:HDividedBox left="0" top="0" bottom="0" right="0"&gt;
          &lt;!-- ... --&gt;
          &lt;mx:VDividedBox width="75%" height="100%"&gt;
              &lt;mx:PlotChart width="100%" height="33%" dataProvider="{xmlDataTest}"&gt;
                  &lt;mx:horizontalAxis&gt;
                      &lt;mx:DateTimeAxis dataUnits="seconds" displayLocalTime="true" parseFunction="dtFromUnixtime"/&gt;
                  &lt;/mx:horizontalAxis&gt;
                  &lt;mx:series&gt;
                      &lt;mx:LineSeries xField="dt" yField="fltValue" displayName="Testkurve" /&gt;
                  &lt;/mx:series&gt;
              &lt;/mx:PlotChart&gt;
              &lt;mx:Panel width="100%" height="66%"&gt;
                  &lt;mx:Button label="Start" click="vDataStart()" /&gt;
                  &lt;mx:Button label="Stop" click="vDataStop()" /&gt;
              &lt;/mx:Panel&gt;
          &lt;/mx:VDividedBox&gt;
      &lt;/mx:HDividedBox&gt; 
  &lt;/mx:WindowedApplication&gt;
  </code></pre>
  
  <p>And this is part of my ActionScript:</p>
  
  <pre><code>[Bindable]
  public var xmlDataTest:Array = [
          { dt: "1230908694", fltValue: "50.4" },
          // ...
          { dt: "1230909594", fltValue: "35.4" }
  ]
  
  public var dflt:Number = 10.0;
  public var timData:Timer = new Timer(3000);
  
  // ...
  
  public function vDataStart():void
  {
      if (!timData.running) {
          timData.addEventListener(TimerEvent.TIMER, vAppendDatum);
          timData.start();
      }
  }
  
  public function vDataStop():void
  {
      if (timData.running) {
          timData.stop();
      }
  }
  
  public function vAppendDatum(evt:Event):void
  {
      var dtNew:String;
      var fltNew:String;
      var fltT: Number;
      dtNew = String(Number(xmlDataTest[xmlDataTest.length - 1].dt) + 100);
      fltT = Number(xmlDataTest[xmlDataTest.length - 1].fltValue);
      if (fltT &lt; 10.0 || fltT &gt; 70) {
          dflt *= -1;
      }
      fltNew = String(fltT + dflt);
      xmlDataTest.push({ dt: dtNew, fltValue: fltNew });
      //trace("Datenpunkte: " + xmlDataTest.length);
  }
  </code></pre>
  
  <p>On clicking the "Start" button, the data array is extended every 3 seconds, but the chart on the screen remains the same.</p>