How to get current level on drilldown event in Hig

2019-03-04 11:20发布

问题:

Seems like drilldown event is not triggered in Highcharts Treemap. I need to perform some task like showing alert with current level number on drilldown and drillup events. How can this be done in Treemaps?

回答1:

At I see at this moment you can catch redraw event and prepare a simple "parser" which check id. Default structure of that is id_1 for first level, id_1_1 for second level. The simplest is use a split, and check length of array. Obviosuly this is very poor solution.

events: {
            redraw: function () {

                var rootNode = this.series[0].rootNode;

                if (rootNode === '') {
                    alert(' NO DRILLED - LEVEL 0 ')
                } else {
                    if (rootNode.split('_').length == 2) {
                        alert(' DRILLED - LEVEL 1');
                    } else if (rootNode.split('_').length >= 2) {
                        alert(' DRILLED - LEVEL 2');
                    }
                }

            }
        }

Example: http://jsfiddle.net/ghh1x7vt/1/