Reputation: 41
I use multilevel treemap, based on this example: https://www.amcharts.com/demos/drill-down-treemap
It has a blue button on top right corner, that returns you to the top level.
If treemap has more, than two levels, blue button still returns you to the top level. Is it possible to go to previous level, not first?
My amcharts version is 4.
Upvotes: 2
Views: 502
Reputation: 6025
Yes, it is possible. You must first remove default "hit" events of zoomOutButton and then add another "hit" listener which would select currently selected items parent when clicked:
chart.zoomOutButton.events.off("hit");
chart.zoomOutButton.events.on("hit", ()=>{
chart.zoomToChartDataItem(chart.currentlyZoomed.parent);
})
Upvotes: 4