Interesting. Looks like showDataEffect is only triggered when the data
provider changes or when an element is added to a series, but not when
the series is added to the chart. A workaround is to define the line
series in MXML, but dont add the data provider until you click the
button.
 
-matt 
 


________________________________

        From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Nate Pearson
        Sent: Thursday, September 13, 2007 4:30 PM
        To: [email protected]
        Subject: [flexcoders] Re: How do I setStyle("showDataEffect",
interpolate) for a LineSeries?
        
        

        <?xml version="1.0" encoding="utf-8"?>
        <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
        layout="vertical">
        <mx:Script>
        <![CDATA[
        import mx.charts.series.LineSeries;
        import mx.collections.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'} ])
        
        private function addSeries():void{
        var myLineSeries:LineSeries = new LineSeries()
        myLineSeries.dataProvider = chartData
        myLineSeries.yField = "marginRevenue"
        myLineSeries.xField = "dateTime"
        myLineSeries.setStyle("showDataEffect", "interpolate")
        chart.series = [myLineSeries]
        
        }
        
        ]]>
        </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:Button label="Add Series" click="addSeries()"/>
        </mx:Application>
        
        --- In [email protected]
<mailto:flexcoders%40yahoogroups.com> , "Matt Horn" <[EMAIL PROTECTED]> wrote:
        >
        > can you post a complete code sample that illustrates this?
        > 
        > -matt 
        > 
        > > -----Original Message-----
        > > From: [email protected]
<mailto:flexcoders%40yahoogroups.com>  
        > > [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com> ] On Behalf Of Nate Pearson
        > > Sent: Thursday, September 13, 2007 2:48 PM
        > > To: [email protected]
<mailto:flexcoders%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]
<mailto:flexcoders%40yahoogroups.com>  
        > > <mailto:flexcoders%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]
<mailto:flexcoders%40yahoogroups.com>  
        > > > > <mailto:flexcoders%40yahoogroups.com>
        > > > > [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com>  
        > > > > <mailto:flexcoders%40yahoogroups.com> ] On Behalf Of
Nate Pearson
        > > > > Sent: Thursday, September 13, 2007 1:27 PM
        > > > > To: [email protected]
<mailto:flexcoders%40yahoogroups.com>  
        > > <mailto:flexcoders%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> >
        > > > >
<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