开发者

Flex 4, dynamic chart

I have multiple pieCharts in my flex app and when the user clicks a pie wedge in any of them I use the perWedgeExplodeRadius to p开发者_StackOverflow社区ull it away and highlight it. Pretty basic stuff... but now i'd like the previously clicked pieChart to close back up when another pieChart is clicked and this is where I'm running into issues. How can I identify the last pieSeries? This is what I have that does not work.

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
}


ANSWER:

//
    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;
    //
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜