Search code examples
highchartstreemap

Initialize Highcharts treemap at specific drilldown level


Using this fiddle as an example.

I cannot find a way to default to a certain level and selection: in the linked example, if I wanted to start drilled-down into South-East Asia, how could I do so? (as if I had clicked South-East Asia once it loaded)

Highcharts.chart('container', {
        series: [{
            type: 'treemap',
            layoutAlgorithm: 'squarified',
            allowDrillToNode: true,
            animationLimit: 1000,
            dataLabels: {
                enabled: false
            },
            levelIsConstant: false,
            levels: [{
                level: 1,
                dataLabels: {
                    enabled: true
                },
                borderWidth: 3
            }],
            data: points
        }]
    });

Solution

  • As I understood - you would like to trigger a drilldown event on the initial load, am I right? If yes, here is a demo with the example how to achieve it.

      if (Highcharts.isString(drillId)) {
        series.setRootNode(drillId, true, {
          trigger: 'click'
        });
      }