【发布时间】:2013-11-25 10:18:40
【问题描述】:
我试图在弹性图表中添加图例作为单独的组件。其实我的意图是 当用户从图例中选择项目时.. 应突出显示相应的图表项目。 这可能吗?
【问题讨论】:
标签: actionscript-3 apache-flex flex4 flex3 flex4.5
我试图在弹性图表中添加图例作为单独的组件。其实我的意图是 当用户从图例中选择项目时.. 应突出显示相应的图表项目。 这可能吗?
【问题讨论】:
标签: actionscript-3 apache-flex flex4 flex3 flex4.5
这是可能的。您只需要在图例中添加一个事件侦听器,并在事件处理程序上突出显示相应的图表项。
// Assign an id to each legend item
<mx:LegendItem id="yourLegendItem" label="Your Label">
// Add a mouse click event listener to it
yourLegendItem.addEventListener(MouseEvent.CLICK, highlightYourChartItem);
// Handle the mouse clicks
function highlightYourChartItem(event:MouseEvent):void
{
// Code to highlight the item. You can add a glow, change the color, etc
}
这里有一个关于如何创建单独的图例控件的教程: Creating a custom Legend control
【讨论】: