Adnan
Adnan

Reputation: 2996

How to get current level on drilldown event in Highcharts treemap?

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?

Upvotes: 1

Views: 2672

Answers (1)

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

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/

Upvotes: 2

Related Questions