Flex 4 / ILOG Elixir - 我需要帮助为Elixir Radar Chart添加动态系列

时间:2011-05-16 15:06:07

标签: actionscript-3 flex4 ilog ilog-elixir

我很难用ActionScript将RadarColumnSeries添加到我的雷达图表中。我已经搞砸了这么久,以至于我不确定我是否已经走上正轨了。请帮助,谢谢 -

以下是我在Flex4中使用的内容:

图表:

<ilog:RadarChart id="newChart" width="100%" height="100%"
            showDataTips="true" dataProvider="{xmlDataSource}"
            type="circular"
            columnWidthRatio="0.8" >
    <ilog:angularAxis>
        <ilog:AngularAxis dataProvider="{months}" displayName="Month" categoryField="fullDate" />
    </ilog:angularAxis>
</ilog:RadarChart>

月数组:

[January 2011, February 2011, March 2011, April 2011]

的XmlDataSource:

<root>
  <series id="Americas" name="Americas">
    <item total="2" year="2011" month="April" fullDate="April 2011"/>
    <item total="3" year="2011" month="February" fullDate="February 2011"/>
    <item total="2" year="2011" month="March" fullDate="March 2011"/>
  </series>
  <series id="Asia-Pacific" name="Asia-Pacific">
    <item total="2" year="2011" month="April" fullDate="April 2011"/>
    <item total="1" year="2011" month="January" fullDate="January 2011"/>
    <item total="1" year="2011" month="March" fullDate="March 2011"/>
  </series>
  <series id="EMEIA" name="EMEIA">
    <item total="1" year="2011" month="April" fullDate="April 2011"/>
    <item total="1" year="2011" month="February" fullDate="February 2011"/>
    <item total="3" year="2011" month="March" fullDate="March 2011"/>
  </series>
  <series id="Global" name="Global">
    <item total="3" year="2011" month="April" fullDate="April 2011"/>
    <item total="3" year="2011" month="March" fullDate="March 2011"/>
  </series>
</root>

的ActionScript:

private function createSeries():void {
                var s:RadarSeries;
                for each (var x:XML in xmlDataSource.series) {
                    var o:Object=new Object();
                    s = new RadarColumnSeries();
                    for each (var c:XML in x.item) {
                        s = new RadarColumnSeries();
                        //trace(x.@name + ": " + c.@total + " - " + c.@month + " - " + c.@year + " - " + c.@fullDate);
                        o = {name:x.@name, total:c.@total.toString(), month:c.@month, year:c.@year, fullDate:c.@fullDate};
                        dataSource.addItem(o);
                        s.dataProvider = o;
                        s.dataField = "total";
                        s.displayName = o.name;
                    }

                    columnSeries.push(s);
                    RadarColumnSeries(s).columnWidthRatio=0.80;
                }

                newChart.series = columnSeries;
            }

1 个答案:

答案 0 :(得分:0)