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

前端 未结 1 1346
孤街浪徒
孤街浪徒 2021-01-23 12:33

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

相关标签:
1条回答
  • 2021-01-23 12:46

    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/

    0 讨论(0)
提交回复
热议问题