Wednesday, September 1, 2010

XML Data Passing To Chart

<mx:HTTPService id="re"  url="E:\prabu\data.xml"/>
      <mx:Model id="results" source="data.xml"/>
<mx:Panel id="pan" title="Line Chart" x="69.5" y="93">
     <mx:LineChart id="chart" dataProvider="{results.result}" showDataTips="true" >
     
        <mx:horizontalAxis>
           <mx:CategoryAxis categoryField="month"/>
        </mx:horizontalAxis>
        <mx:series>
           <mx:LineSeries yField="Weekone" displayName="Weekone"/>
           <mx:LineSeries yField="Weektwo" displayName="Weektwo"/>
           <mx:LineSeries yField="Weekthree" displayName="Weekthree"/>
        </mx:series>
     </mx:LineChart>
     <mx:Legend dataProvider="{chart}" height="30"/>
  </mx:Panel>

<mx:Label x="518" y="193" text="Week-three :" fontWeight="bold" fontSize="14" color="#877A7A"/>
<mx:TextArea id="tex1" text="{ObjectUtil.toString(re.lastResult.data.result[0].Weekone)}" x="627" y="131" width="80" height="23" fontWeight="bold" color="#06434E"/>
<mx:Label x="529" y="130" text="Week-one :" fontWeight="bold" fontSize="14" color="#877A7A"/>
<mx:TextArea text="{ObjectUtil.toString(re.lastResult.data.result[0].Weektwo)}" x="627" y="162" width="80" height="23" fontWeight="bold" color="#06434E"/>
<mx:Label x="528" y="163" text="Week-two :" fontWeight="bold" fontSize="14" color="#877A7A"/>
<mx:TextArea text="{ObjectUtil.toString(re.lastResult.data.result[0].Weekthree)}" x="627" y="193" width="80" height="23" fontWeight="bold" color="#06434E"/> <mx:Label x="516" y="323" text="Week-three :" fontWeight="bold" fontSize="14" color="#877A7A"/> <mx:TextArea text="{ObjectUtil.toString(re.lastResult.data.result[1].Weekone)}" x="627" y="261" width="80" height="23" fontWeight="bold" color="#06434E"/> <mx:Label x="528" y="260" text="Week-one :" fontWeight="bold" fontSize="14" color="#877A7A"/> <mx:TextArea text="{ObjectUtil.toString(re.lastResult.data.result[1].Weektwo)}" x="627" y="292" width="80" height="23" fontWeight="bold" color="#06434E"/> <mx:Label x="526" y="293" text="Week-two :" fontWeight="bold" fontSize="14" color="#877A7A"/> <mx:TextArea text="{ObjectUtil.toString(re.lastResult.data.result[1].Weekthree)}" x="627" y="323" width="80" height="23" fontWeight="bold" color="#06434E"/> <mx:Label x="531" y="93" text="Month : Jan-01/2010" fontSize="14" fontWeight="bold"/> <mx:Label x="514" y="463" text="Week-three :" fontWeight="bold" fontSize="14" color="#877A7A"/> <mx:TextArea text="{ObjectUtil.toString(re.lastResult.data.result[2].Weekone)}" x="627" y="401" width="80" height="23" fontWeight="bold" color="#06434E"/> <mx:Label x="528" y="400" text="Week-one :" fontWeight="bold" fontSize="14" color="#877A7A"/> <mx:TextArea text="{ObjectUtil.toString(re.lastResult.data.result[2].Weektwo)}" x="627" y="432" width="80" height="23" fontWeight="bold" color="#06434E"/> <mx:Label x="526" y="433" text="Week-two :" fontWeight="bold" fontSize="14" color="#877A7A"/> <mx:TextArea text="{ObjectUtil.toString(re.lastResult.data.result[2].Weekthree)}" x="627" y="463" width="80" height="23" fontWeight="bold" color="#06434E"/> <mx:Label x="533" y="229" text="Month : Feb-01/2010" fontSize="14" fontWeight="bold"/>


<mx:Label x="527" y="369" text="Month : Aug-01/2010" fontSize="14" fontWeight="bold"/>


<------XML DATA-------->

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

    <result month="Jan-01">
        <Weekone>7684</Weekone>
        <Weektwo>3102</Weektwo>
        <Weekthree>3571</Weekthree>
    </result>
  
    <result month="Feb-01">
        <Weekone>1569</Weekone>
        <Weektwo>8836</Weektwo>
        <Weekthree>2804</Weekthree>
    </result>
  
    <result month="Aug-01">
        <Weekone>4532</Weekone>
        <Weektwo>6435</Weektwo>
        <Weekthree>5337</Weekthree>
    </result>
  
</data>

OUT PUT






No comments:

Post a Comment