0 Replies Latest reply on Feb 5, 2012 8:18 AM by Greglim1

    flex mobile charting issue

    Greglim1

      I tried to create column chart using the data model from the previous view, I used var object to transfer the data but the chart does not work. Help PLEASEEEEEE  and if you have tips for passing data to a view please.

       

       

       

       

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx"
        backgroundColor="#adacac" title="ColumnChart"
        xmlns:charts="mx.charts.*"
        xmlns:series="mx.charts.series.*"
        xmlns:Legend="mx.Legend.*">
      <fx:Declarations>

       
      </fx:Declarations> 
       
       
       
       
      <fx:Script>
        <![CDATA[
        
                  import mx.charts.ColumnChart;
         import mx.collections.*;
        
         [Bindable]
         public var myAC:ArrayCollection = new ArrayCollection([
          {Month:"January", Profit:30},
          {Month:"February", Profit:50},
          {Month:"March", Profit:70},
          {Month:"April", Profit:90}
         ]);
         private function setTitles():void {
          la1.title="{data.Yaxis}";
         }
        
         private function updateChart ():void {
          myAC.getItemAt(0).litres = Number("{data.Ydata1}");
          myAC.getItemAt(1).litres = Number("{data.Ydata2}");
          myAC.getItemAt(2).litres = Number("{data.Ydata3}");
          myAC.getItemAt(3).litres = Number("{data.Ydata4}");
          myAC.getItemAt(0).Month =("{data.Xdata1}");
          myAC.getItemAt(1).Month =("{data Xdata2}");
          myAC.getItemAt(2).Month =("{data Xdata3}");
          myAC.getItemAt(3).Month =("{data Xdata4}");
         }

        ]]>


      </fx:Script>


      <s:Panel title="{data.TitleText}" x="28" y="59" width="265" height="273" >

           <charts:ColumnChart id="myChart" x="10" y="14" width="244" height="216" dataProvider="{myAC}"
               showDataTips="true" type="clustered">
            <charts:horizontalAxis>
             <charts:CategoryAxis title="{data.Xaxis}" categoryField="Month" dataProvider="{myAC}" />
            </charts:horizontalAxis>
            <charts:verticalAxis>
             <charts:LinearAxis id="la1"/>
              </charts:verticalAxis>
                 <charts:series>
             <series:ColumnSeries dataProvider="{myAC}" yField="Profit" xField="Month" displayName="{data.label}" />
                 </charts:series>
           </charts:ColumnChart>
        <charts:Legend x="174" y="26" width="29" height="30" dataProvider="{myChart}"/>
        </s:Panel>
      </s:View>