Glad you got it working.
-Patrick
On 9/14/07, Nate Pearson <[EMAIL PROTECTED]> 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 [email protected] <flexcoders%40yahoogroups.com>, "Ely
> Greenfield" <[EMAIL PROTECTED]> 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: [email protected] <flexcoders%40yahoogroups.com><mailto:
> flexcoders% <flexcoders%25>40yahoogroups.com>
> >
> > > [mailto:[email protected] <flexcoders%40yahoogroups.com>
> > <mailto:flexcoders% <flexcoders%25>40yahoogroups.com> ] On Behalf Of
> Nate Pearson
> > > Sent: Thursday, September 13, 2007 2:48 PM
> > > To: [email protected] <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 [email protected] <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: [email protected] <flexcoders%40yahoogroups.com>
> > <mailto:flexcoders% <flexcoders%25>40yahoogroups.com>
> > > > > <mailto:flexcoders% <flexcoders%25>
> > > > > <mailto:flexcoders%<flexcoders%25>25>
> 40yahoogroups.com>
> > > > > [mailto:[email protected] <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: [email protected] <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
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> >
>
>
>