forwarding...

Dimitrios Gianninas
Optimal Payments Inc.



-----Original Message-----
From: [EMAIL PROTECTED] on behalf of majid.tahir
Sent: Thu 5/31/2007 7:20 PM
To: [EMAIL PROTECTED]
Subject: Re: Dynamic LineSeries based upon Array Collection?
 
I am struggling with same issue.  I can dynamically create the series
in AS but it seems if I am changing the dataprovider then things dont
work.  

--- In flexcoders@yahoogroups.com, "tedgies" <[EMAIL PROTECTED]> wrote:
>
> Has anyone had any success in creating a chart with a series that 
> you can add to at runtime?  (Like Yahoo finance charts 2.0).  I 
> haven't yet seen an example where the LinSeries is based upon a 
> changing (growing) set of external xml data files.  Below i paste a 
> snippet where i try to for loop through an Array Collection and 
> create a separate httpservice call for each dataset (each baseball 
> player).  The httpservice URL is created dynamically based upon the 
> arraycollection.  I don't get any errors, but my chart will not 
> paint my data.  I think my problem is in:
> 
> newSeries.dataProvider = myService.lastResult.item;
> 
> thanks,
> Ted
> 
>   <mx:Script><![CDATA[
>       import mx.rpc.http.mxml.HTTPService;
>       import mx.charts.chartClasses.StackedSeries;
>       import mx.charts.chartClasses.Series;
>       import mx.events.IndexChangedEvent;
>       import mx.events.ListEvent;
>       import mx.utils.StringUtil;
>     import mx.controls.Alert;
>     import mx.charts.events.ChartItemEvent;
>     import mx.collections.ArrayCollection;
>     import mx.utils.ArrayUtil;
>     import mx.charts.series.LineSeries;
>     import mx.charts.DateTimeAxis;
>     import mx.charts.CategoryAxis;
> 
> [Bindable]
>         public var ItemsInChart:ArrayCollection = new ArrayCollection
> ([            
>               {playerName: "Babe_Ruth", playerID: "123456"},
>               {playerName: "Hank_Aaron", playerID: "123457"}]);
>           
>     public function initApp():void {     
>        //Loop through the ArrayCollection ItemsinChart and create 
> a new httpservice and line for each.
>                 var i:int;
>                 for (i = 0; i < ItemsInChart.length; i++) {
>                           var myService:HTTPService = new 
> HTTPService();
>                           var playerStr:String = 
> ItemsInChart.getItemAt(i).playerName;          
>                           myService.url = "assets/" + playerStr 
> + ".xml";
>                           myService.send();
>                
>          // Create the new series and set its properties.
>                var series:Array = myChart.series;
>                var newSeries:LineSeries = new LineSeries;
>                newSeries.dataProvider = myService.lastResult.item;
>                newSeries.xField = "Year";
>                newSeries.yField = "Home_Runs";
>                newSeries.displayName = "Home Runs for Baseball 
> Greats";
>                newSeries.name = "Home Runs";   
>              // Add the new series to the current Array of series.
>            series.push(newSeries);
>                myChart.series = series;
>             }
>     }        
>   ]]>
>        </mx:Script>
>



-- 
WARNING
-------
This electronic message and its attachments may contain confidential, 
proprietary or legally privileged information, which is solely for the use of 
the intended recipient.  No privilege or other rights are waived by any 
unintended transmission or unauthorized retransmission of this message.  If you 
are not the intended recipient of this message, or if you have received it in 
error, you should immediately stop reading this message and delete it and all 
attachments from your system.  The reading, distribution, copying or other use 
of this message or its attachments by unintended recipients is unauthorized and 
may be unlawful.  If you have received this e-mail in error, please notify the 
sender.

AVIS IMPORTANT
--------------
Ce message électronique et ses pièces jointes peuvent contenir des 
renseignements confidentiels, exclusifs ou légalement privilégiés destinés au 
seul usage du destinataire visé.  L'expéditeur original ne renonce à aucun 
privilège ou à aucun autre droit si le présent message a été transmis 
involontairement ou s'il est retransmis sans son autorisation.  Si vous n'êtes 
pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, 
veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses 
pièces jointes, de votre système.  La lecture, la distribution, la copie ou 
tout autre usage du présent message ou de ses pièces jointes par des personnes 
autres que le destinataire visé ne sont pas autorisés et pourraient être 
illégaux.  Si vous avez reçu ce courrier électronique par erreur, veuillez en 
aviser l'expéditeur.

Reply via email to