Hi, I have to add Series dynamically to my Column Chart. Also if possible I would like to change horizontalAxis dynamically. I am loading the data as Model in xml file. Please reply.
<------testGraph.mxml--------> <?xml version="1.0" encoding="iso-8859-1"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" initialize="initChart();"> <mx:Script> <![CDATA[ import mx.charts.series.ColumnSeries; import mx.charts.chartClasses.Axis; import mx.charts.AxisRenderer; import mx.charts.CategoryAxis; //import mx.charts.ColumnChart; import mx.charts.*; var dataSet : Array; var horizontalField : Array; function initChart(){ dataSet = stateData.state; } function addSeries() { estateTrendChart.series.removeAll(); var columnSeries = new ColumnSeries(); columnSeries.yField = dataSet.medianPrice; columnSeries.xField = dataSet.endDate; estateTrendChart.series.addItem(columnSeries); } ]]></mx:Script> <mx:Model id="stateData" source="StateSFRMedianPrice.xml"> </mx:Model> <mx:Script source="chartFunctions.as" ></mx:Script> <mx:ColumnChart id="estateTrendChart" dataProvider="{dataSet}" showDataTips="true" width="80%" height="80%"> <mx:horizontalAxis> <mx:CategoryAxis dataProvider="{dataSet}" categoryField="endDate" name="Month" /> </mx:horizontalAxis> <mx:verticalAxis> <mx:LinearAxis name="Price" /> </mx:verticalAxis> <mx:series > <mx:Array> </mx:Array> </mx:series> </mx:ColumnChart> <mx:Button label="Clean" click="addSeries();"> </mx:Button> </mx:Application> <-----StateSFRMedianPrice.xml------> <?xml version="1.0" encoding="utf-8"?> <data> <state> <name>California</name> <period>Monthly</period> <endDate>Jan-03</endDate> <medianPrice>450000</medianPrice> </state> <state> <name>California</name> <period>Monthly</period> <endDate>Feb-03</endDate> <medianPrice>480000</medianPrice> </state> <state> <name>California</name> <period>Monthly</period> <endDate>Mar-03</endDate> <medianPrice>550000</medianPrice> </state> <state> <name>California</name> <period>Monthly</period> <endDate>Apr-03</endDate> <medianPrice>500000</medianPrice> </state> <state> <name>California</name> <period>Monthly</period> <endDate>May-03</endDate> <medianPrice>500000</medianPrice> </state> <state> <name>California</name> <period>Monthly</period> <endDate>Jun-03</endDate> <medianPrice>500000</medianPrice> </state> <state> <name>California</name> <period>Monthly</period> <endDate>Jul-03</endDate> <medianPrice>360000</medianPrice> </state> <state> <name>California</name> <period>Monthly</period> <endDate>Aug-03</endDate> <medianPrice>700000</medianPrice> </state> <state> <name>California</name> <period>Monthly</period> <endDate>Sep-03</endDate> <medianPrice>450000</medianPrice> </state> <state> <name>California</name> <period>Monthly</period> <endDate>Oct-03</endDate> <medianPrice>400000</medianPrice> </state> <state> <name>California</name> <period>Monthly</period> <endDate>Nov-03</endDate> <medianPrice>350000</medianPrice> </state> <state> <name>California</name> <period>Monthly</period> <endDate>Dec-03</endDate> <medianPrice>300000</medianPrice> </state> </data> ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/