首页 文章

Highcharts Sunburst Chart Drillup

提问于
浏览
0

我试图捕捉Sunburst图表上的钻取事件,但我无法实现它 .

我将events对象添加到图表对象中,但仍然无法在函数中触发警报 .

我基本上希望在我们通过在向下钻取水平/水平之后单击右上方的按钮进行钻取时触发警报/ console.log .

这里有codepen供您参考 .

Highcharts.chart('container', {

      chart: {
        height: '100%',
        events: {
          drillup: function() {
            alert('Drilling up')
          }
        }
      },

      title: {
        text: 'World population 2017'
      },
      subtitle: {
        text: 'Source <href="https://en.wikipedia.org/wiki/List_of_countries_by_population_(United_Nations)">Wikipedia</a>'
      },
      series: [{
        type: "sunburst",
        data: data,
        allowDrillToNode: true,
        cursor: 'pointer',
        dataLabels: {
          format: '{point.name}',
          filter: {
            property: 'innerArcLength',
            operator: '>',
            value: 16
          }
        },
        levels: [{
          level: 1,
          levelIsConstant: false,
          dataLabels: {
            filter: {
              property: 'outerArcLength',
              operator: '>',
              value: 64
            }
          }
        }, {
          level: 2,
          colorByPoint: true
        },
        {
          level: 3,
          colorVariation: {
            key: 'brightness',
            to: -0.5
          }
        }, {
          level: 4,
          colorVariation: {
            key: 'brightness',
            to: 0.5
          }
        }]

      }],
      tooltip: {
        headerFormat: "",
        pointFormat: 'The population of <b>{point.name}</b> is <b>{point.value}</b>'
      }
    });

请指教 .

1 回答

相关问题