代码如下
chart: {
type: "funnel",
marginBottom: 25,
backgroundColor: "transparent",
events: {
load: function() {
var chart = this;
Highcharts.each(chart.series[0].data, function(p, i) {
chart.options.labels.items.push({
html: "less confident" + i,
style: { left: 550, top: 50 }
});
p.dataLabel.attr({
x: (chart.plotWidth - chart.plotLeft) / 2,
"text-anchor": "middle"
});
});
}
}
},
答案 0 :(得分:0)
我看到你正在尝试为每个点添加标签。 Highcharts为这个名为数据标签:https://api.highcharts.com/highcharts/series.line.dataLabels
构建了功能另一种方法是使用SVGRenderer.label
:https://api.highcharts.com/class-reference/Highcharts.SVGRenderer#label