I have an issue, hoping that someone here can point me in right direction.  
Google searches have failed me...

I have line chart that I want to control dynamically and add/remove series.  I 
have seen the Flex cookbook code that does this with column charts, and I have 
been able get this to work with line charts just fine.

However, my situation is that I want to have different dataProviders for some 
of the series I add.  When I set the dataProvider dynamically, it appears to 
have no effect on the data (either the data does not show, or if there is a 
dataProvider associated with the chart, the series will pull data from that 
provider).  It's acting as if it is ignoring my attempts to change the 
dataProvider.

Here is some relevant sample code where I try to enhance the cookbook 
columnseries example to look at alternative source.  

    private function onComplete():void
    {
        //initialize our clustered ColumnSet
        columnSet = new ColumnSet();
        columnSet.type = "clustered";
    
        ....


        afternoonSeries = new ColumnSeries();
        afternoonSeries.yField = "afternoonRainfall";
        afternoonSeries.xField = "day";
        afternoonSeries.displayName = "Afternoon Rainfall";
        afternoonSeries.dataProvider = chartDP;  // I added this line to set a 
dataProvider

        duskSeries = new ColumnSeries();
        duskSeries.yField = "duskRainfall";
        duskSeries.xField = "day";
        duskSeries.displayName = "Dusk Rainfall";
        duskSeries.dataProvider = chartDPAlternative;   // I added this line to 
set a different dataProvider

        updateSeries();

    }


    private function updateSeries():void
    {
        //reinit columnSet
        columnSet.series = new Array();

        .... 
        columnSet.series.push(afternoonSeries);
        columnSet.series.push(duskSeries);

        .....


         // put columnSet in an array and set to
        // the chart's "series" attribute
        rainfallChart.series = [columnSet];
    }


Situation 1) My legend shows the two series, but no data is graphed

    <mx:ColumnChart id="rainfallChart" >
        <mx:horizontalAxis>
           <mx:CategoryAxis categoryField="day" />
        </mx:horizontalAxis>
        <mx:verticalAxis>
           <mx:LinearAxis minimum="0" maximum="14" />
        </mx:verticalAxis>
    </mx:ColumnChart>
    <mx:Legend dataProvider="{rainfallChart}" />


Or, Situation 2)  In the case below, I get data, but the data in the 2 series 
come strictly from chartDP

    <mx:ColumnChart id="rainfallChart" dataProvider="{chartDP}">
        <mx:horizontalAxis>
           <mx:CategoryAxis categoryField="day" />
        </mx:horizontalAxis>
        <mx:verticalAxis>
           <mx:LinearAxis minimum="0" maximum="14" />
        </mx:verticalAxis>
    </mx:ColumnChart>
    <mx:Legend dataProvider="{rainfallChart}" />



----------
So, when I try to attach a dataProvider dynamically to a series, is there some 
sort of invalidate event I am supposed to initiate?  Has anyone else tried 
dynamic replacement of dataProviders on series?

Thanks in advance for any help you may be able to provide.

Brad Wiederholt
[EMAIL PROTECTED]



-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line

For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------


Reply via email to