Sorry, forgot to mention that I realize it might be a difference that in the
mxml code some properties ar bound because of the curly braces, and that
doesn't happen when assigning the property in AS. But still, the objects
assigned to these properties do not change overtime, and that's why I don't
thik it could be a cause for this to fail.

Thanks

On Feb 19, 2008 6:37 PM, Guido <[EMAIL PROTECTED]> wrote:

> Has anyone had this problem?
>
> I mean, that when changing the 'type' property for an AreaChart only the
> "first" series (first meaning, the only one declared in MXML, whereas
> secondary would mean ones added on AS).
>
> My mxml code was posted earlier on this thread, but I'm posting a new
> version, reduced, leaving out any properties that are non-critical, so as to
> see which ones are causing this not to work.
>
> MXML code:
>
>
> <mx:AreaSeries id="primaryAreaSeries"
>
>       alpha="0.8"
>
>       dataProvider="{dataSet.dataSet}"
>
>       xField="{dataSet.keyFieldName}"
>
>       yField="{dataSet.valueFieldName}"/>
>
> Now, this is how I'm creating aditional AreaSeries in AS:
>
> *private* *static* 
> *function*produceAreaSeries(dSet:DataSetVO,numDataSets:Number):AreaSeries
>
> {
>
>       *var* *series* : AreaSeries = *new* AreaSeries;
>
>       series.alpha = 0.40;
>
>       series.setStyle(*"areaFill"*,colors.getItemAt(numDataSets));
>
>       series.dataProvider = dSet.dataSet;
>
>       series.xField = dSet.keyFieldName;
>
>       series.yField = dSet.valueFieldName;
>
>       *return* series;
>
> }
>
> I add the series to the chart like this:
>
>
> *private* *function* addAreaChartSeries(newSeries : Series) : *void*
>
> {
>
>       *var* chartSeries : Array;
>
>
>
>       *//Add series to chart.*
>
>       chartSeries = areaChart.series;
>
>       chartSeries.push(newSeries);
>
>       areaChart.series = chartSeries;
>
> }
>
> I've also tried adding them this way:
>
>
> *private* *function* addAreaChartSeries(newSeries : Series) : *void*
>
> {
>
>       *//Add series to chart.*
>
>       areaChart.series.push(newSeries);
>
> }
>
> but decided to stick to the former because this one didn't get the
> interpolation effect to trigger.
>
> I've tried this same thing with a hardcoded set of data, and when doing it
> this way, it DOES work. I do not see the difference between these two
> approaches (ok, the areaFill style, buy I really don't think that should
> make any difference, should it?). The hardcoded version is (yes, I used the
> exact same code in the examples, don't blame me :) ) :
>
> 'First' series in the chart:
>
>  <mx:AreaSeries
>
>       alpha="0.8"
>
>       dataProvider="{sampleData1}"
>
>       xField="Month"
>
>       yField="Profit"/>
>
> Additional series generation:
>
>
> *var* as1:AreaSeries = *new* AreaSeries();
>
> as1.alpha = 0.7;
>
> as1.dataProvider = *this*.sampleData2;
>
> as1.xField = *'Month'*;
>
> as1.yField = *'Expenses'*;
>
>
>
>
>
> *var* as2:AreaSeries = *new* AreaSeries();
>
> as2.alpha = 0.6;
>
> as2.dataProvider = *this*.sampleData3;
>
> as2.xField = *'Month'*;
>
> as2.yField = *'Amount'*;
>
>
>
> areaChart.series.push(as1);
>
> areaChart.series.push(as2);
>
> asddas
> Well, that's it. I'be been pounding my head into this for quite a while
> now, and I really can't see where it's wrong, or where's the difference. I'd
> really appreciate if anyone could try this, or if someone at Adobe knows
> there is a bug in AreaChart's type switching with dynamic series.
>
> Thanks in advance,
>
> Guido.
>
> On Feb 14, 2008 4:15 PM, Guido <[EMAIL PROTECTED]> wrote:
>
> > Hi, and thank you guys for answering.
> >
> > I've tried removing the interpolation effect, and it doesn't blow up
> > anymore, although it still doesn't work properly.
> >
> > When changing the AreaChart's type, only the series defined in mxml (i.e. as
> > in the sample code I sent) gets either stacked or 100%'ed.
> >
> > This means:
> >
> > Overlaid: it's all properly displayed.
> > Stacked: displayed almost exactly as in overlaid type, only first series
> > looks darker (i believe its alpha property is changed by Flex).
> > 100%: first series is displayed as the only series, covering the whole
> > chart.
> >
> > It seems like a very weird bug; I haven't been able to work this around.
> > I've tried completely changing the series property of the area chart, and
> > assigning to it a whole new array, but I can't tell where it is failing. The
> > only difference between working and non-working series is that the working
> > one is declared in mxml, whereas additional series are built in AS.
> >
> > Does anyone have any idea on this one? I can send screenshots to be more
> > explainatory.
> >
> > Thanks in advance.
> >
> > Guido.
> >
> >   On Wed, Feb 13, 2008 at 5:38 PM, jer_ela <[EMAIL PROTECTED]> wrote:
> >
> > >   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 <flexcoders%40yahoogroups.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<http://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.
> > > >
> > >
> > >  
> > >
> >
> >
>

Reply via email to