开发者

Bug in stacked series in Flex Charting

I think there is bug in Flex charting.

"DATETIME AXIS DOES NOT SUPPORT SERIES STACKING IN CERT开发者_C百科AIN CASES WHILE LINEAR AXIS AND CATEGORY WORKS FINE IN SIMILAR CONDITIONS"

This happens for 'clustered' and 'stacked' types when each series has its individual data provider. If data provider is assigned with chart itself it will work fine.

Below code works fine when (1)'c.dataprovider = yearlydata; ' is uncommented (2)'series1.dataProvider = yearlyData2;' is commented. (3)'series2.dataProvider = yearlyData2;' is commented

However if category axis or linear axis is used then the code works fine, no matter how do we assign the data providerThe code is pasted below for your reference.

"IS IT A BUG IN FLEX OR AM I MISSING SOMETHING" ??

I need it desperately, please help.

Thanks in advance.

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

 [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 {

// This will work fine when uncommented // c.dataProvider = yearlyData1;

    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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜