2 Replies Latest reply on Mar 10, 2010 5:15 PM by jdesko

    PLOTCHART -> axes problems

    akash87

      [Bindable]private var sampleData: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 }]);

       

       

       

      <mx:PlotChart  dataProvider="{sampleData}" includeIn="LoginState" id="plotchart1" right="21" bottom="37" left="21" top="89" showDataTips="true" preinitialize="plotchart1_preinitializeHandler(event)">

       

      <!--mx:horizontalAxis>                     <----- this doesnt display either

      <mx:LinearAxis title="XAXIS"/>

      </mx:horizontalAxis-->

       

      <mx:series>

      <mx:PlotSeries displayName="pc1" xField="Expenses" yField="Profit" />

      <mx:PlotSeries displayName="pc2" xField="Expenses" yField="Amount" />

      </mx:series>

      </mx:PlotChart>

      <mx:Legend includeIn="LoginState" dataProvider="{plotchart1}" width="184" height="28" right="10" top="53"/>

       

       

      chart.jpg

      as u can see, there are no numbers that are appearing in the axis!

      plz help

        • 1. Re: PLOTCHART -> axes problems
          jdesko Level 2

          Hello akash87;

           

          To use the code that you have shown if I

           

          1. remove references to states (not shown in code)

          2. remove preinitialize="plotchart1_preinitializeHandler(event) (not shown in code)

          3. uncomment out horizontalAxis

           

          Then everything looks good, see below. *note - my app was set with VerticalLayout so legend is at the bottom.

           

          Since all of your code doesn't seem to be shown, maybe the problem is in one of the three items above, or the code that is missing.

           

          John

           

          Picture 1.png

          • 2. Re: PLOTCHART -> axes problems
            jdesko Level 2

            In addition to my last post, below is the code that I used.

             

            John

             

             

            <?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">

             

             

            <s:layout>

            <s:VerticalLayout paddingLeft="20" paddingTop="20"/>

            </s:layout>

             

            <fx:Script>

            <![CDATA[

            import mx.collections.ArrayCollection;

             

            [Bindable]private var sampleData: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 }]);

             

            ]]>

            </fx:Script>

             

            <mx:PlotChart  dataProvider="{sampleData}"

               id="plotchart1" right="21" bottom="37" left="21" top="89"

               showDataTips="true">

             

            <mx:horizontalAxis>                  

            <mx:LinearAxis title="XAXIS"/>

            </mx:horizontalAxis>

             

            <mx:series>

            <mx:PlotSeries displayName="pc1" xField="Expenses" yField="Profit" />

            <mx:PlotSeries displayName="pc2" xField="Expenses" yField="Amount" />

            </mx:series>

            </mx:PlotChart>

            <mx:Legend dataProvider="{plotchart1}" width="184" height="28" right="10" top="53"/>

             

             

            </s:Application>