1 Reply Latest reply on Apr 22, 2010 12:03 PM by matthew horn

    updating data for a chart

    JockMahon Level 1

      I have the following example , when the NS value changes the

      chart  does not update. If the refresh is put back in then it works. Is this normal or is it the way iv done it. also how would this

      work if the data provider was in a model object. ie the data was updating automaticallywithout user interaction. would i have to still call the refresh

      from somewhere

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               width="100%" height="100%">
         
         
          <fx:Script>
              <![CDATA[         
                  import mx.collections.ArrayCollection;
                 
                  private var tmp:uint = 10;
                 
                  [Bindable]
                  private var orders:ArrayCollection = new ArrayCollection( [
                      { Supplier: tmp    , Orders: tmp } ]);
                 
                  protected function ssd_changeHandler(event:Event):void
                  {
                      orders.getItemAt(0).Orders = ssd.value;
                     
                      //orders.refresh();
                         
                  }
                 
              ]]>
          </fx:Script>   
         
         
          <s:layout>
              <s:VerticalLayout/>
          </s:layout>
         
          <mx:ColumnChart id="column"
                          height="50%"
                          width="50%"
                          paddingLeft="5"
                          paddingRight="5"
                          showDataTips="true"
                          dataProvider="{orders}"  >               
              <mx:horizontalAxis>
                  <mx:CategoryAxis categoryField="Supplier"/>
              </mx:horizontalAxis>
             
              <mx:series>
                  <mx:ColumnSeries
                      xField="Supplier"
                      yField="Orders"
                      displayName="Orders"/>
                 
              </mx:series>
          </mx:ColumnChart>
         
          <s:NumericStepper id="ssd" value="10" maximum="100" change="ssd_changeHandler(event)"/>

       

         
      </s:Application>