I was wondering if it is possible to dynamically add LineSeries to a LineChart component at run-time?
I'd like to create something like a stock chart where the user can select multiple stocks to display on the stock chart.

How would I format the arrayCollection being used as a dataProvider for the LineChart? My initial guess would be something like this, except it would be coming from a web service:
private var stocksAC:ArrayCollection = new ArrayCollection( [

{ Date: "2006-10-25", Stock1: 2000, Stock2: 150, Stock3: 450 },
{ Date: "2006-10-26", Stock1: 1000, Stock2: 200, Stock3: 600 },
{ Date: "2006-10-27", Stock1: 1500, Stock2: 500, Stock3: 300 },
{ Date: "2006-10-28", Stock1: 1800, Stock2: 120, Stock3: 900 },
{ Date: "2006-10-29", Stock1: 2400, Stock2: 575, Stock3: 500 } ]);
]]>
One issue I am having is how to dynamically add properties to the objects in the stocksAC arrayCollection. What do I do if I want to add a forth stock or fifth stock at runtime?

Another issue is how to add LineSeries at runtime?
<mx:LineChart id="linechart" dataProvider="{stocksAC}">

<mx:horizontalAxis>
<mx:CategoryAxis categoryField="Date"/>
</mx:horizontalAxis>

<mx:series>
<mx:LineSeries yField="Stock1" form="curve" displayName="Adobe"/>
<mx:LineSeries yField="Stock2" form="curve" displayName="Microsoft"/>
<mx:LineSeries yField="Stock3" form="curve" displayName="Apple"/>
</mx:series>
</mx:LineChart>
Again, how do I add a forth or fifth stock at runtime?

I hope this is clear enough.

Cheers,
BB

__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to