0 Replies Latest reply on Nov 25, 2010 3:57 AM by Sen Imagines

    Non uniform intervals in the X-axis of LineChart

    Sen Imagines Level 1

      Hi,

       

      I am using a Flex3 Line chart which takes data from an External XML file.

      chartScreenShot.jpg

      But I dont get the DataTip points correctly if i give some numeric values in the X values and

      even then, the values in the X-axis starts from the "0"th position and the interval between the "0"th & 1st value (in X axis) is half of the others (shown in red bar in the attached image) and also for the last one.

       

      How to have the uniform intervals in the X-axis so that the DataTip shows correct values as in the data?

       

      Below is the MXML & the XML I use:

       

      The MXML:

      -------------------------

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" backgroundColor="0xFFFFFF" creationComplete="fetchData();">

       

       

      <mx:HTTPService id="myServ" url="TempChartData.xml" fault="faultHandler(event)"/>

       

       

      <mx:Script>

      <![CDATA[

           import mx.controls.Alert;

           import mx.rpc.events.*;    

           import mx.controls.ToolTip;

       

       

          

           //Trigger the HTTPService to fetch data from the back-end

           public function fetchData():void

           {

                myServ.send();

           }

       

           public function faultHandler(event:FaultEvent):void

           {

                Alert.show(event.fault.message);

           }

       

      ]]>

      </mx:Script>

       

       

       

      <mx:LineChart id="myChart" width="100%" height="100%" showDataTips="true" dataProvider="{myServ.lastResult.tasks.task}">

       

           <mx:horizontalAxis>

                <mx:CategoryAxis id="myHorzAxis" categoryField="name" title="My Tasks"/>

           </mx:horizontalAxis>

       

          

           <mx:verticalAxis>

                <mx:LinearAxis title="My Data Values"/>

           </mx:verticalAxis>

       

       

           <mx:horizontalAxisRenderers>

                <mx:AxisRenderer axis="{myHorzAxis}" labelRotation="45"/>

           </mx:horizontalAxisRenderers>

       

          

           <mx:series>

                <mx:LineSeries id="myLineSeries1" xField="name" yField="Value">

                </mx:LineSeries>

       

       

           </mx:series>

       

      </mx:LineChart>

       

       

      </mx:Application>

       

      TempChartData.XML

      -----------------------------------

       

      <?xml version="1.0" encoding="utf-8"?>

      <tasks usl="25" lsl="-75">

          <task name="1">

              <Value>-115</Value>       

          </task>

          <task name="2">

              <Value>-112</Value>       

          </task>

          <task name="3">

              <Value>-100</Value>       

          </task>   

          <task name="4">

              <Value>0</Value>       

          </task>

          <task name="5">

              <Value>-74</Value>       

      </task>

          <task name="6">

          <Value>0</Value>

          </task>

          <task name="7">

          <Value>-67</Value>

          </task>

      </tasks>