With Anychart 8.3+ I am using the TreeMap chart.listen('drillChange')
listener to obtain a clicked element's information.
Note: I needed to use e.current.get('name')
as shown in an example, instead of e.currentTarget
as per Treemap listen()
documentation. However the getDrillDownPath()
value seems to be one event-click behind. Why is this?
chart.listen("drillChange", function(e){
// get the drilldown path and convert it to a string
var text = printPath(chart.getDrilldownPath());
// set the chart title
chart.title().useHtml(true);
chart.title("Treemap: Interactivity (Drillchange)" +
"<br><br>currentTarget: " + e.currentTarget +
"<br><br>current.get('name'): " + e.current.get('name') +
"<br><br>Path: " + text
});
Below is a link to sample code, showing the undefined e.currentTarget
, the defined e.current.get('name')
, and the drilldown path value being one step behind.
https://playground.anychart.com/AeI6bUhK/7
Thanks in advance!