Treemap Squarified ItemSelected event does NOT return value that created a square

errorimg.jpg I built a treemap of dozens of squares, many have truncated text "tex..." or no text at all. The tool tips display the name that created the square in full. When the ItemSelected is fired on these smaller squares the ItemSelectedEventArgs has the truncated value for the selected item. Is ths functionality correct? If so how do you get the value that created the square when the square is selected? version 26.1.39


1 Reply

IR Indumathi Ravi Syncfusion Team June 28, 2024 12:41 PM UTC

Hi Dominic,


Currently, when a TreeMap item is selected, the truncated text is retrieved in the “ItemSelected” event. However, to obtain the full text, you can utilize the “OnItemClick” event, which triggers when the TreeMap item is clicked. This event provides access to the data bound to the TreeMap item through the “Item” property in its event argument. You can retrieve the necessary value from the returned object in this event handler. Please find the code snippet for the same below.


Code Snippet:

<SfTreeMap>

    <TreeMapEvents ItemSelected="ItemSelect" OnItemClick="ItemClick"></TreeMapEvents>

</SfTreeMap>

 

public void ItemClick(ItemClickEventArgs args)

{

    ItemName = args.Item["Country"].ToString();

}


You can find the sample from the below link.

https://www.syncfusion.com/downloads/support/directtrac/general/ze/TreeMap-1374381761


Please let us know if you need any further assistance.


Loader.
Up arrow icon