Apologies for bumping this old thread, but I'm banging my head against a wall 
at the moment and cant figure this out.

The original thread deals with assigning a single line series to a chart in AS, 
which I have managed to get working with no problems. But I cant replicate it 
for multiple series.

I've managed to get the chart to actually display multiple series, but there is 
no animation at all.

If anyone has any hints or tips, that would be greatly appreciated.

private function createChart():void {
  var mySeries:Array = new Array();

  var rearrangeData:SeriesInterpolate = new SeriesInterpolate();                
        
  rearrangeData.duration = 2000;                                
                                                
  for(var item:String in model.bank_summary_chart[0]) {
                                                        
        var myLineSeries:LineSeries = new LineSeries();
        myLineSeries.yField = item;
        myLineSeries.xField = 'date_trans';
        myLineSeries.displayName = item;
        myLineSeries.setStyle('form','curve');
        myLineSeries.setStyle("showDataEffect", rearrangeData);                 
        
        //myChart.series = [myLineSeries] //This only works for a single series
        mySeries.push(myLineSeries); //So, gather up all the series and push to 
an array instead
        
  }
  
  //Note that this next line is different
  //Use the array as the chart series
  //but now we lose all animation!
  myChart.series = [mySeries]; 
  callLater(setDataProvider, []);
}

private function setDataProvider():void {
        myChart.dataProvider = model.bank_summary_chart;
}

--- In flexcoders@yahoogroups.com, "Patrick Driggett" <pdrigg...@...> wrote:
>
> Glad you got it working.
> 
> -Patrick
> 
> On 9/14/07, Nate Pearson <napearso...@...> wrote:
> >
> >   Anything for you Ely ;).
> >
> > I tried three methods, here's what I found.
> >
> > 1) I tried what Ely said. He was right, it didn't interpolate the
> > first time it was added but did after the data changed. This is how
> > the framework is supposed to act.
> >
> > 2) I tried myLineSeries.setStyle("interpolateValues", true). It
> > didn't work. Again, this is how the framework is supposed to act.
> >
> > 3) I tried what Patrick suggested, adding empty data then changing
> > the data provider to get the effect i was looking for. I used
> > callLater and ("showDataEffect", new SeriesInterpolate()) and it
> > worked! wOO wOO!
> >
> > Here's the code for all three methods. Thanks so much for the help guys.
> >
> > -Nate
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > layout="vertical">
> > <mx:Script>
> > <![CDATA[
> > import mx.charts.effects.SeriesInterpolate;
> > import mx.charts.series.LineSeries;
> > import mx.collections.ArrayCollection;
> >
> > [Bindable]private var emptyChartData:ArrayCollection = new
> > ArrayCollection();
> > [Bindable]private var chartData:ArrayCollection = new
> > ArrayCollection([{marginRevenue: '0', dateTime: 'Jan 06'},
> > {marginRevenue: '155', dateTime: 'Feb 06'},
> > {marginRevenue: '200', dateTime: 'Mar 06'},
> > {marginRevenue: '223', dateTime: 'Apr 06'},
> > {marginRevenue: '350', dateTime: 'May 06'} ]);
> >
> > [Bindable]private var chartData2:ArrayCollection = new
> > ArrayCollection([{marginRevenue: '0', dateTime: 'Jan 06'},
> > {marginRevenue: '75', dateTime: 'Feb 06'},
> > {marginRevenue: '188', dateTime: 'Mar 06'},
> > {marginRevenue: '200', dateTime: 'Apr 06'},
> > {marginRevenue: '366', dateTime: 'May 06'} ]);
> >
> > private function addSeriesEly():void{
> > var myLineSeries:LineSeries = new LineSeries()
> > myLineSeries.dataProvider = chartData
> > myLineSeries.yField = "marginRevenue"
> > myLineSeries.xField = "dateTime"
> > myLineSeries.setStyle("showDataEffect", new
> > SeriesInterpolate())
> > chart.series = [myLineSeries]
> > }
> >
> > private function changeDataEly():void{
> > var myLineSeries:LineSeries = LineSeries(chart.series.pop())
> > myLineSeries.dataProvider = chartData2
> > }
> >
> > //Patric interpolate
> > private function addSeriesPatrick():void{
> > var myLineSeries:LineSeries = new LineSeries()
> > myLineSeries.dataProvider = chartData
> > myLineSeries.yField = "marginRevenue"
> > myLineSeries.xField = "dateTime"
> > myLineSeries.setStyle("interpolateValues", true)
> > chart.series = [myLineSeries]
> > }
> >
> > //Call later method
> > private function addSeriesCallLater():void{
> > var myLineSeries:LineSeries = new LineSeries()
> > myLineSeries.dataProvider = emptyChartData;
> > myLineSeries.yField = "marginRevenue"
> > myLineSeries.xField = "dateTime"
> > myLineSeries.setStyle("showDataEffect", new
> > SeriesInterpolate())
> > chart.series = [myLineSeries]
> > callLater(addChartData, [])
> > }
> > private function addChartData():void{
> > var myLineSeries:LineSeries = LineSeries(chart.series.pop())
> > myLineSeries.dataProvider = chartData
> >
> > }
> >
> > ]]>
> > </mx:Script>
> > <mx:LineChart id="chart" dataProvider="{chartData}" width="100%"
> > height="100%" showDataTips="true" >
> > <mx:seriesFilters>
> > <mx:Array/>
> > </mx:seriesFilters>
> >
> > <mx:horizontalAxis>
> > <mx:CategoryAxis categoryField="dateTime" />
> > </mx:horizontalAxis>
> >
> > </mx:LineChart>
> > <mx:HBox>
> > <mx:Label text="Ely's Test"/>
> > <mx:Button label="Add Series" click="addSeriesEly()"/>
> > <mx:Button label="Change Data" click="changeDataEly()"/>
> > </mx:HBox>
> >
> >
> > <mx:HBox>
> > <mx:Label text="Patrick's Method #1"/>
> > <mx:Button label="Add Series" click="addSeriesPatrick()"/>
> > </mx:HBox>
> >
> > <mx:HBox>
> > <mx:Label text="Patrick's Method #2 + Call Later"/>
> > <mx:Button label="Add Series" click="addSeriesCallLater()"/>
> > </mx:HBox>
> >
> > </mx:Application>
> >
> > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, "Ely
> > Greenfield" <egreenfi@> wrote:
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Nate...do me a favor, and try a test.
> > >
> > > 1) Create a lineseries in actionscript
> > >
> > > 2) Set its showDataEffect to interpolate (using the second approach
> > > you describe below...something like
> > > mySeries.setSTyle("showDataEffect",new SeriesInterpolate());
> > >
> > > 3) Give it some data
> > >
> > > 4) Add it to a chart
> > >
> > > 5) Now add a button to your app. When the button is clicked, give
> > > the series some new data.
> > >
> > >
> > >
> > > See if it interpolates on click. I suspect that our series are set to
> > > not run the showDataEffect on the first data (this is the general policy
> > > of the framework...show effects aren't run when a component is first
> > > shown).
> > >
> > >
> > >
> > > Ely.
> > >
> > >
> > >
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com><mailto:
> > flexcoders% <flexcoders%25>40yahoogroups.com>
> > >
> > > > [mailto:flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>
> > > <mailto:flexcoders% <flexcoders%25>40yahoogroups.com> ] On Behalf Of
> > Nate Pearson
> > > > Sent: Thursday, September 13, 2007 2:48 PM
> > > > To: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com> <mailto:
> > flexcoders% <flexcoders%25>40yahoogroups.com>
> > > > Subject: [flexcoders] Re: How do I setStyle("showDataEffect",
> > > > interpolate) for a LineSeries?
> > > >
> > > > I don't get an error. It just doesn't work. I'm adding and
> > > > removing series and they just pop up instead of that nice
> > > > interpolate feature
> > > >
> > > > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>
> > > <mailto:flexcoders% <flexcoders%25>40yahoogroups.com>
> > > > <mailto:flexcoders% <flexcoders%25> 
> > > > <mailto:flexcoders%<flexcoders%25>25>
> > 40yahoogroups.com> , "Matt
> > > Horn" <mhorn@> wrote:
> > > > >
> > > > > This should work:
> > > > > > myLineSeries.setStyle("showDataEffect", "interpolate")
> > > > >
> > > > > Please post the error your getting and a complete code sample that
> > > > > shows the error.
> > > > >
> > > > > -matt
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>
> > > <mailto:flexcoders% <flexcoders%25>40yahoogroups.com>
> > > > > > <mailto:flexcoders% <flexcoders%25> 
> > > > > > <mailto:flexcoders%<flexcoders%25>25>
> > 40yahoogroups.com>
> > > > > > [mailto:flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>
> > > <mailto:flexcoders% <flexcoders%25>40yahoogroups.com>
> > > > > > <mailto:flexcoders% <flexcoders%25> 
> > > > > > <mailto:flexcoders%<flexcoders%25>25>
> > 40yahoogroups.com> ] On
> > > Behalf Of Nate Pearson
> > > > > > Sent: Thursday, September 13, 2007 1:27 PM
> > > > > > To: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>
> > > <mailto:flexcoders% <flexcoders%25>40yahoogroups.com>
> > >
> > > > <mailto:flexcoders% <flexcoders%25> 
> > > > <mailto:flexcoders%<flexcoders%25>25>
> > 40yahoogroups.com>
> > > > > > Subject: [flexcoders] How do I setStyle("showDataEffect",
> > > > > > interpolate) for a LineSeries?
> > > > > >
> > > > > > I learned that showDataEffect is a style not a property
> > > > from Ely's
> > > > > > post (http://tech.groups.yahoo.com/group/flexcoders/message/49710
> > > > > > <http://tech.groups.yahoo.com/group/flexcoders/message/49710 >
> > > > > > <http://tech.groups.yahoo.com/group/flexcoders/message/49710
> > > > > > <http://tech.groups.yahoo.com/group/flexcoders/message/49710 > > )
> > > > > >
> > > > > > Now I can't figure out the correct way to set it.
> > > > > >
> > > > > > Here's what I've tried:
> > > > > > mxml:
> > > > > > <mx:SeriesInterpolate id="interpolate" elementOffset="10"/>
> > > > > >
> > > > > > script:
> > > > > > var myLineSeries:LineSeries = new LineSeries()
> > > > > >
> > > > > > myLineSeries.dataProvider = graphData.getItemAt(0)
> > > > > > myLineSeries.yField = "marginDollars"
> > > > > > myLineSeries.xField = "dateTime"
> > > > > > myLineSeries.setStyle("showDataEffect", interpolate)
> > > > > >
> > > > > > chart.series = [myLineSeries]
> > > > > >
> > > > > > That didn't work, so I added this code:
> > > > > > var myInterpolate:SeriesInterpolate = new SeriesInterpolate()
> > > > > > myLineSeries.setStyle("showDataEffect", myInterpolate)
> > > > > >
> > > > > > no joy...so i tried it like this too, even though it didn't make
> > > > > > sense to me:
> > > > > > myLineSeries.setStyle("showDataEffect", "interpolate")
> > > > > >
> > > > > > surprise surprise, that didn't work either!
> > > > > >
> > > > > > Any help is greatly appreciated!
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > > Nate
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
> >  
> >
>


Reply via email to