0 Replies Latest reply on Feb 27, 2007 3:38 AM by themd99

    DataProvider in Linechart from Button

    themd99
      Hi again,


      I have a code that gets the data from a combobox and assigns it as a dataprovider in a linechart component.


      Actionscript:

      private function dgClick(item:Object):void{
      linechart1.dataProvider = item;
      linechart1.visible = true;
      }

      The Combobox: ( I am using this to see if the variable is passing. Just a test.)
      <mx:ComboBox id="cb" dataProvider="{selectedNode.@chart}"/>

      The Button:
      <mx:Button x="176" y="16" width="52" icon="@Embed(source='images/chart.png')" toolTip="Please press to see the chart." height="27" click="dgClick(cb.selectedItem)"/>
      -----------------------------------------
      <mx:ViewStack x="280" y="241" id="viewstack1" width="470" height="226">
      <mx:Canvas id="acibadem" label="Acibadem" width="100%" height="100%">
      <mx:Legend dataProvider="{linechart1}"/>
      <mx:LineChart id="linechart1" height="166" x="129" width="261" y="10" visible="false" >
      <mx:horizontalAxis>
      <mx:CategoryAxis categoryField="Month"/>
      </mx:horizontalAxis>
      <mx:series>
      <mx:LineSeries yField="Profit" form="curve" displayName="Profit"/>
      <mx:LineSeries yField="Expenses" form="curve" displayName="Expenses"/>
      <mx:LineSeries yField="Amount" form="curve" displayName="Amount"/>
      </mx:series>
      </mx:LineChart>
      </mx:Canvas>
      </mx:ViewStack>

      What happens or should happen is that;

      I want my combobox to get a value for chart from my xml and assign this value to my linechart1 as a dataprovider with a click of a button.