簡體   English   中英

是否可以在Flex中將圖表圖例添加為單獨的自定義組件?

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

我試圖將圖例添加為彈性圖表中的單獨組件。 實際上我的意圖是,當用戶從圖例中選擇項目時,應突出顯示對應的圖表項目。 這可能嗎 ?

有可能的。 您只需要向圖例添加事件偵聽器,並突出顯示事件處理程序上的相應圖表項即可。

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

這是有關如何創建單獨的圖例控件的教程: 創建自定義圖例控件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM