Flex图表中堆叠系列中的错误

时间:2010-02-18 11:47:02

标签: flex actionscript-3 actionscript flex3

我认为Flex图表存在漏洞。

“DATETIME AXIS在某些情况下不支持系列堆叠,而线性轴和类别工作在相似的条件下工作”

当每个系列都有其独立的数据提供者时,会发生“群集”和“堆叠”类型。如果为数据提供者分配了图表本身,它将正常工作。

下面的代码工作正常 (1)'c.dataprovider = annualdata; '没有评论 (2)'series1.dataProvider = annualData2;'被评论。 (3)'series2.dataProvider = annualData2;'被评论

但是,如果使用类别轴或线性轴,那么代码工作正常,无论我们如何分配数据提供者。代码粘贴在下面供您参考。

“这是一个错误的错误,还是我错过了什么?”

我非常需要它,请帮忙。

提前致谢。

=============================================== ===========

  

 [Bindable]
 private var yearlyData1:ArrayCollection = new ArrayCollection([
    {month:"January", revenue:120, costs:45, id:1,
        overhead:102, oneTime:23, date:new Date(2010,1,19,1,1,1)},
    {month:"February", revenue:108, costs:42, id:2,
        overhead:87, oneTime:47, date:new Date(2010,1,19,1,1,2)},
    {month:"March", revenue:150, costs:82, id:3,
        overhead:32, oneTime:21, date:new Date(2010,1,19,1,1,3)},
    {month:"April", revenue:170, costs:44, id:4,
        overhead:68, date:new Date(2010,1,19,1,1,4) }
 ]);

 [Bindable]
 private var yearlyData2:ArrayCollection = new ArrayCollection([
    {month:"January", revenue:120, costs:45, id:1,
        overhead:102, oneTime:23, date:new Date(2010,1,19,1,1,1)},
    {month:"February", revenue:108, costs:42, id:2,
        overhead:87, oneTime:47, date:new Date(2010,1,19,1,1,2)},
    {month:"March", revenue:150, costs:82, id:3,
        overhead:32, oneTime:21, date:new Date(2010,1,19,1,1,3)},
    {month:"April", revenue:170, costs:44, id:4,
        overhead:68, date:new Date(2010,1,19,1,1,4) }
 ]);

var c:ChartBase = new CartesianChart();

 private function initApp():void {

//取消注释后这将正常工作 // c.dataProvider = annualData1;

    var hAxis:DateTimeAxis = new DateTimeAxis();
    CartesianChart(c).horizontalAxis = hAxis;

    var vAxis:LinearAxis = new LinearAxis();
    CartesianChart(c).verticalAxis = vAxis;


    var mySeries:Array = new Array();
    panel2.addChild(c);


    var innerSet:ColumnSet = new ColumnSet();
    innerSet.type = "stacked";
    var series1:Series = new ColumnSeries();
    // This will work fine when commented
    series1.dataProvider = yearlyData1;
    ColumnSeries(series1).xField = "date";
    ColumnSeries(series1).yField = "costs";
    ColumnSeries(series1).displayName = "Costs";
    ColumnSeries(series1).horizontalAxis = hAxis;
    ColumnSeries(series1).verticalAxis = vAxis;


    var series2:Series = new ColumnSeries();
    // This will work fine when commented
    series2.dataProvider = yearlyData2;
    ColumnSeries(series2).xField = "date";
    ColumnSeries(series2).yField = "oneTime";
    ColumnSeries(series2).displayName = "One-Time Costs";
    ColumnSeries(series2).horizontalAxis = hAxis;
    ColumnSeries(series2).verticalAxis = vAxis;


    innerSet.horizontalAxis = hAxis;
    innerSet.verticalAxis = vAxis;


    innerSet.series.push(series1);
    innerSet.series.push(series2);

    c.series.push(innerSet);
    var l:Legend = new Legend();
    l.dataProvider = c;
    panel2.addChild(l);

 }

]]>

  

=============================================== ===========

0 个答案:

没有答案