HighCharts-Angular 7-Sunburst钻升事件未触发



Im使用highcharts角度库来渲染日光爆发图。我可以使用单击事件来深入查看并捕获事件。但当我点击后退按钮时,我无法捕捉到演练事件。我尝试使用drillup事件,但似乎不起作用。

我也导入了钻取模块。下面给出的是我的代码。

TS:

import HC_sunburst from 'highcharts/modules/sunburst';
import Drilldown from 'highcharts/modules/drilldown';
HC_sunburst(Highcharts);
HC_stock(Highcharts);
Drilldown(Highcharts);
highcharts1: typeof Highcharts = Highcharts;
chartOptions1: Highcharts.Options;
this.chartOptions1 =  {
chart: {
height: '100%'
},
title: {
text: ''
},
subtitle: {
text: ''
},
series: [{
type: 'sunburst',
data: sunburstSampleData,
allowDrillToNode: true,
cursor: 'pointer',
events: {
click: (e) => {
alert('drilldown');
},
drillup: (e) => {
alert('drillup');
}
},
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
}
}]
}]
};

HTML

<highcharts-chart *ngIf="chartOptions1"
[Highcharts]="highcharts1"
[options]="chartOptions1"
style="width: 100%; height: 500px; display: block;">

软件包.json

"highcharts": "^7.1.1",
"highcharts-angular": "^2.4.0",

我是不是遗漏了什么?请帮帮我。

它不起作用,因为series.events上没有drilldown()。要使其工作,您可以使用chart.events.drilldown/chart.events.drillup

API参考:
https://api.highcharts.com/highcharts/chart.events.drilluphttps://api.highcharts.com/highcharts/chart.events.drilldown

最新更新