简体   繁体   中英

Is it possible to add chart legend as a seperate custom component in flex?

Im trying to add legend as a seperate component in flex charts. Actually my intention is , when user select item from legend .. corresponding chart item should be highlighted . Is this possible ?

It is possible. You just need to add an event listener to the legend and highlight the corresponding chart item on the event handler.

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

Here's a tutorial on how to create a separate legend control: Creating a custom Legend control

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM