Flex 4,动态图表

时间:2011-05-11 18:29:08

标签: flex flex4 charts pie-chart

我在我的flex应用程序中有多个pieCharts,当用户点击其中任何一个的饼形楔时,我使用perWedgeExplodeRadius将其拉出并突出显示它。非常基本的东西......但是现在我希望之前点击的pieChart在点击另一个pieChart时关闭,这就是我遇到问题的地方。如何识别最后的pieSeries?这就是我所做的不起作用。

private var lastChartOpened:PieSeries;

private function pieChart_itemClick(evt:ChartItemEvent):void {
   if (lastChartOpened != null) {
      PieSeries(lastChartOpened).perWedgeExplodeRadius = arr;
   }
   lastChartOpened = evt.currentTarget as PieSeries;
   trace(lastChartOpened); // comes up as null
}

1 个答案:

答案 0 :(得分:0)

<强>解答:

//
    var pSeries:PieSeries;

    if (lastChartOpened != null) {
        PieSeries(lastChartOpened).perWedgeExplodeRadius = arrClose;
    }
    for each (pSeries in chart.series){
        lastChartOpened = pSeries;
    }
    PieSeries(pSeries).perWedgeExplodeRadius = arr;
    id = evt.hitData.chartItem.item.id;
    //