3 Replies Latest reply on Apr 12, 2011 8:04 AM by mazhar.ali

    Error while compiling charts

    sudeepcm

      Hi,

      I am new to the flex . Started using today. I just tried to compile the following code using command line.

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top"
          horizontalAlign="center" backgroundGradientColors="[0x000000,0x323232]" paddingTop="0" viewSourceURL="srcview/index.html">
         
          <mx:Script>
              <![CDATA[

              import mx.collections.ArrayCollection;

              [Bindable]
              private var expensesAC:ArrayCollection = new ArrayCollection( [
                  { Month: "Jan", Profit: 2000, Expenses: 1500, Amount: 450 },
                  { Month: "Feb", Profit: 1000, Expenses: 200, Amount: 600 },
                  { Month: "Mar", Profit: 1500, Expenses: 500, Amount: 300 },
                  { Month: "Apr", Profit: 1800, Expenses: 1200, Amount: 900 },
                  { Month: "May", Profit: 2400, Expenses: 575, Amount: 500 } ]);
              ]]>
          </mx:Script>
         
          <mx:Panel title="AreaChart Control" layout="horizontal" color="0xffffff" borderAlpha="0.15" width="600" height="240"
               paddingTop="10" paddingRight="5" paddingBottom="10" paddingLeft="5" horizontalAlign="center">
              
              <mx:AreaChart id="Areachart" color="0x323232" height="100%"
                   showDataTips="true" dataProvider="{expensesAC}">
                      
                  <mx:horizontalAxis>
                      <mx:CategoryAxis categoryField="Month"/>
                  </mx:horizontalAxis>

                  <mx:series>
                      <mx:AreaSeries yField="Profit" form="curve" displayName="Profit"/>
                      <mx:AreaSeries yField="Expenses" form="curve" displayName="Expenses"/>
                      <mx:AreaSeries yField="Amount" form="curve" displayName="Amount"/>
                  </mx:series>
              </mx:AreaChart>
                 
              <mx:Legend dataProvider="{Areachart}" color="0x323232"/>
             
          </mx:Panel>
      </mx:Application>

       

      The command was ' mxmlc chart1.mxml '

       

      But i got the following compile time error :

       

      D:\sudeepcm\Frame Works\Adobe Flex\Study\Charts\chart1.mxml(23):  Error: Type was not found or was not a compile-time constant: AreaChart.

              <mx:AreaChart id="Areachart" color="0x323232" height="100%"

       

      I am using flex_sdk_3.5 and jdk 1.6. Pls help me.

       

      Thanks  in advance for ur help.

        • 1. Re: Error while compiling charts
          Gregory Lafrance Level 6

          If you are using just the SDK, and not Flex Builder 3 or Flash Builder 4, that's the problem, because the charting components do not ship with the sdk, you need to buy the professional version of the IDE.

           

          If this post answers your question or helps, please mark it as such.


          Greg Lafrance - Flex 2 and 3 ACE certified

          www.ChikaraDev.com

          Flex Training and Support Services

          • 2. Re: Error while compiling charts
            sudeepcm Level 1

            Thanks Greg for ur useful information ..

            • 3. Re: Error while compiling charts
              mazhar.ali

              hi iam new to flash builder i have mxml file and want to build swf application but an error occur please help me in this regard.

               

              error is " Error: Initializer
              for 'horizontalAxis': values of type mx.charts.chartClasses.IAxis cannot be rep

              resented in text.

               

                 <mx:LineChart id="myChart" showDataTips="true" width="578" heigh  t="290" x="0" y="0" horizontalAxis="_TrenVUR_CategoryAxis1_c()" series="  [_TrenVU R_LineSeries1_i()]" color="#001f85a7"  dataProvider='{myData}'/> "

               

               

              the mxml file code is as follow.

               

              <?xml version="1.0" encoding="UTF-8"?>
              <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="649" height="502" viewSourceURL="srcview/index.html" creationComplete="{InitTrend();}">
                  <mx:Script><![CDATA[
                       //Warning: in this unregistered version, no Flex Script will be  generated while exporting the Flex Project. Please purchase the full  version to get Flex Script at http://www.sothink.com/product/flashdecompiler/index.htm.

               

                  ]]></mx:Script>

               

                  <mx:Panel title="Trend Viewer" width="598" height="453" layout="absolute">
                       <mx:LineChart id="myChart" showDataTips="true" width="578"  height="290" x="0" y="0" horizontalAxis="_TrenVUR_CategoryAxis1_c()"  series="[_TrenVUR_LineSeries1_i()]" color="#001f85a7"  dataProvider='{myData}'/>
                      <mx:Grid id="frm" width="568" x="0" y="298" height="58">
                          <mx:GridRow width="100%" height="100%">
                              <mx:GridItem width="77" height="100%">
                                  <mx:Label text="Starting Date" textAlign="right"/>
                              </mx:GridItem>
                              <mx:GridItem width="100%" height="100%">
                                  <mx:Label text="Day:"/>
                                  <mx:ComboBox id="ddlDays" dataProvider='{arrDays}'/>
                              </mx:GridItem>
                              <mx:GridItem width="100%" height="100%">
                                  <mx:Label text="Month:"/>
                                  <mx:ComboBox id="ddlMonths" dataProvider='{arrMonths}'/>
                              </mx:GridItem>
                              <mx:GridItem width="101" height="100%">
                                  <mx:Label text="Year:"/>
                                  <mx:ComboBox id="ddlYear" dataProvider='{arrYears}'/>
                              </mx:GridItem>
                          </mx:GridRow>
                          <mx:GridRow width="100%" height="100%">
                              <mx:GridItem width="100%" height="100%">
                                  <mx:Label text="Ending Date"/>
                              </mx:GridItem>
                              <mx:GridItem width="100%" height="100%">
                                  <mx:Label text="Day:"/>
                                  <mx:ComboBox id="ddlDaysE" dataProvider='{arrDays}'/>
                              </mx:GridItem>
                              <mx:GridItem width="100%" height="100%">
                                  <mx:Label text="Month:"/>
                                  <mx:ComboBox id="ddlMonthsE" dataProvider='{arrMonths}'/>
                              </mx:GridItem>
                              <mx:GridItem width="100%" height="100%">
                                  <mx:Label text="Year:"/>
                                  <mx:ComboBox id="ddlYearE" dataProvider='{arrYears}'/>
                              </mx:GridItem>
                          </mx:GridRow>
                      </mx:Grid>
                      <mx:Grid x="134" y="364" height="25" width="371">
                          <mx:GridRow width="100%" height="100%">
                              <mx:GridItem width="40" height="100%">
                                  <mx:Label text="Prob:"/>
                              </mx:GridItem>
                              <mx:GridItem width="157" height="23">
                                  <mx:ComboBox id="ddlProb" dataProvider='{arrProbs}'/>
                              </mx:GridItem>
                              <mx:GridItem width="100%" height="100%"/>
                          </mx:GridRow>
                      </mx:Grid>
                      <mx:Grid x="69" y="388" height="25" width="436">
                          <mx:GridRow width="100%" height="100%">
                              <mx:GridItem width="182" height="100%"/>
                              <mx:GridItem width="100%" height="23">
                                  <mx:Button id="btnOK" label="OK" click="{Func_OK();}"/>
                              </mx:GridItem>
                              <mx:GridItem width="100%" height="100%"/>
                          </mx:GridRow>
                      </mx:Grid>
                  </mx:Panel>

               

              </mx:Application>

               

              regards mazhar