【发布时间】:2020-07-15 19:36:30
【问题描述】:
我正在使用 highcharts-angular 库来渲染旭日形图。我能够通过使用单击事件深入了解并捕获事件。但是当我单击后退按钮时,我无法捕获向上钻取事件。我尝试使用钻取事件,但这似乎不起作用。
我也导入了向下钻取模块。下面是我的代码。
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;">
package.json
"highcharts": "^7.1.1",
"highcharts-angular": "^2.4.0",
我在这里有什么遗漏吗?请帮帮我。
【问题讨论】:
标签: highcharts event-handling angular7 drilldown angular2-highcharts