Apache flex 如何在flex中将columnSeries动态添加到柱状图?

Apache flex 如何在flex中将columnSeries动态添加到柱状图?,apache-flex,flex4,flex3,flex4.5,Apache Flex,Flex4,Flex3,Flex4.5,这是我的全部代码。我正在尝试阅读示例xmllist并动态绘制列系列。理论上我的代码是正确的,但实际上这不起作用。伙计们,你们能帮我解决这个问题吗 private var testXML:XML=<main> <data Country="USA" Gold1="10" Silver1="20" Bronze1="15"/> <data Co

这是我的全部代码。我正在尝试阅读示例xmllist并动态绘制列系列。理论上我的代码是正确的,但实际上这不起作用。伙计们,你们能帮我解决这个问题吗

private var testXML:XML=<main>
                                <data Country="USA" Gold1="10" Silver1="20" Bronze1="15"/>
                                <data Country="China" Gold="15" Silver="10" Bronze="25"/>
                            </main>;

protected function creationCompleteEvent(event:FlexEvent):void
    {
        var List:XMLList=testXML.children();

        var attr:XMLList=List.attributes();

        column.dataProvider=List; ///data provider

        cat.categoryField=attr[List[0].attributes().length()].name();

        for(var j:Number=0 ; j<List.length() ; j++)
        {
            var currentSeries:Array = column.series; 

            var columnSeries:ColumnSeries=new ColumnSeries();

            for(var i:Number=0;i<List[j].attributes().length();i++)
            {
                //Alert.show(List[j].attributes()[i].name());

                //Alert.show(attr[List[j].attributes().length()].name());


                //Alert.show(List[j].attributes()[i]);

                columnSeries.dataProvider=List;

                columnSeries.xField=attr[List[j].attributes().length()].name();
                columnSeries.yField=List[j].attributes()[i];
                columnSeries.displayName=List[j].attributes()[i].name().toString();


                currentSeries.push(columnSeries); 
            }

            column.series = currentSeries;  
        }

    }
private var testXML:XML=
;
受保护的函数creationCompleteEvent(事件:FlexEvent):无效
{
var List:XMLList=testXML.children();
var attr:XMLList=List.attributes();
column.dataProvider=List;///数据提供程序
cat.categoryField=attr[List[0].attributes().length()].name();

对于(var j:Number=0;jDid),您尝试使用mxml。您是否能够仅使用单个系列创建图表?