1 Reply Latest reply on Apr 7, 2011 3:25 AM by Tanu Jain

    Filtering Dynamic XML data in a Chart


      Hey, i was wondering if i could get some help. I am dynamically loading XML data and loading it into a chart. I am wondering how i could use a slider to change the data in the graph depending on the patent # and or the production # (I should be able to figure out the second one after i find out how to get the first one). Any Help is much appreciated. Thanks.


      This is what my xml looks like:




      <month> Jan </month>
      <patent> 10800 </patent>
      <productions> 210020 </productions>


      <month> Feb </month>
      <patent> 10800 </patent>
      <productions> 210020 </productions>


      <month> Mar </month>
      <patent> 10800 </patent>
      <productions> 210020 </productions>



      mxml looks like:


      <mx:HTTPService url="assets/test-data.xml" id="testData" result="xmlHandler(event)" resultFormat="e4x"/>





                           import mx.collections.ArrayCollection;

                           import mx.collections.ArrayList;

                           import mx.controls.Alert;

                           import mx.events.ListEvent;

                           import mx.rpc.events.ResultEvent;


                           import scripts.Item;

                           import scripts.ItemXmlLoad;


                           [Bindable]private var barChartInfo:XMLList;

                           [Bindable]private var lineChartInfo:XMLList;

                           [Bindable]private var pieChartInfo:XMLList;


                           private function xmlHandler(evt:ResultEvent):void


                                 barChartInfo = evt.result.itemCosts;

                                 lineChartInfo = evt.result.prospects;

                                 pieChartInfo = evt.result.expenses;






             <!-- Line Chart -->

             <mx:Panel horizontalAlign="center" title="Omega Prospect Sales" x="412.7" y="42.2" includeIn="graphs">


                    <mx:LineChart dataProvider="{lineChartInfo}" id="lineChart" showDataTips="true">


                                 <mx:CategoryAxis dataProvider="{lineChartInfo}" categoryField="month"/>



                                 <mx:LineSeries showDataEffect="{changeEffect}" yField="patent" displayName="Patent Sales"/>

                                 <mx:LineSeries showDataEffect="{changeEffect}" yField="production" displayName="Product Sales"/>



                    <mx:Legend dataProvider="{lineChart}" includeIn="graphs"/>