I had the same thing. I believe it is due to the interpolate effect not liking stacked or 100% charts. When you change the type, the effect runs and that is what is blowing up. I had this problem with both area and column charts. I added code to remove the effect before changing to a stack or 100% type and that fixed it.
--- In flexcoders@yahoogroups.com, Guido <[EMAIL PROTECTED]> wrote: > > Hi, fellow coders! > > I'm having an issue with an AreaChart when changing its *type* property. > > There's a ComboBox that lets the user select how it wishes to see the > AreaChart (either *overlaid*, *stacked* or *100%*). > > The method for this is as simple as: > > areaChart.type = comboBox.selectedItem.data; > > (I've debugged it and data holds the proper string required by the type > property). > > My code is as follows: > > > <mx:AreaChart id="areaChart" > > dataTipFunction="chartDataTipRender" > > height="100%" > > showDataTips="true" > > width="100%"> > > <mx:horizontalAxis> > > <mx:CategoryAxis categoryField="{dataSet.keyFieldName}" > > dataProvider="{dataSet.dataSet}" > > labelFunction="{dataSet.labelFunction}"/> > > </mx:horizontalAxis> > > <mx:verticalAxis> > > <mx:LinearAxis > > minimum="{verticalAxisMinimum}" > > maximum="{verticalAxisMaximum}"/> > > </mx:verticalAxis> > > <mx:series> > > <mx:AreaSeries > > alpha="0.8" > > dataProvider="{dataSet.dataSet}" > > displayName="{dataSet.dataSource.name}" > > form="curve" > > showDataEffect="interpolate" > > xField="{dataSet.keyFieldName}" > > yField="{dataSet.valueFieldName}"/> > > </mx:series> > > </mx:AreaChart> > > > <mx:SeriesInterpolate id="interpolate" elementOffset="10"/> > > > You might wonder why I want to stack or overlay the chart, since it has only > one series... well, the thing is more series may be added in runtime, and so > it comes to play the area chart type feature. > > > So, whenever I change the AreaChart's type property, I get the following > error and stack trace: > > TypeError: Error #1009: Cannot access a property or method of a null object > reference. > at mx.charts.chartClasses::Series/mx.charts.chartClasses:Series::stripNaNs > () > at mx.charts.series::AreaSeries/mx.charts.series:AreaSeries::updateFilter() > at > mx.charts.chartClasses::Series/mx.charts.chartClasses:Series::validateTransform > () > at mx.charts.chartClasses::Series/getRenderDataForTransition() > at mx.charts.effects.effectClasses::SeriesInterpolateInstance/play() > at mx.effects::EffectInstance/startEffect() > at mx.effects.effectClasses::ParallelInstance/play() > at mx.charts.chartClasses::ChartBase/::advanceEffectState() > at > mx.charts.chartClasses::ChartBase/mx.charts.chartClasses:ChartBase::updateDisplayList > () > at > mx.charts.chartClasses::CartesianChart/mx.charts.chartClasses:CartesianChart::updateDisplayList > () > at mx.core::UIComponent/validateDisplayList() > at mx.managers::LayoutManager/::validateDisplayList() > at mx.managers::LayoutManager/::doPhasedInstantiation() > at Function/http://adobe.com/AS3/2006/builtin::apply() > at mx.core::UIComponent/::callLaterDispatcher2() > at mx.core::UIComponent/::callLaterDispatcher() > at flash.utils::Timer/flash.utils:Timer::_timerDispatch() > at flash.utils::Timer/flash.utils:Timer::tick() > > > And... I don't understand why, since I'm already seeing the chart as it is > when I make the change to the type property. I mean, it works perfectly up > to the moment I try to change this property, then it blows up. > > BTW, I'm using Flex 2. > > > Any help on this one? > > Thanks in advance!! > > Guido. >