【问题标题】:Is it possible to add chart legend as a seperate custom component in flex?是否可以将图表图例添加为 flex 中的单独自定义组件?
【发布时间】:2013-11-25 10:18:40
【问题描述】:

我试图在弹性图表中添加图例作为单独的组件。其实我的意图是 当用户从图例中选择项目时.. 应突出显示相应的图表项目。 这可能吗?

【问题讨论】:

    标签: actionscript-3 apache-flex flex4 flex3 flex4.5


    【解决方案1】:

    这是可能的。您只需要在图例中添加一个事件侦听器,并在事件处理程序上突出显示相应的图表项。

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

    【讨论】:

      猜你喜欢
      • 2023-03-07
      • 1970-01-01
      • 1970-01-01
      • 2016-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多