我们可以在时间轴图表的栏中显示文本吗?



我们可以在Highchart时间线栏内放置文本吗?作为参考,请查看所附快照的年份。[timeline_space][1][1]: https://i.stack.imgur.com/n1yvQ.jpg

您可以使用SVGRenderer工具来呈现这些标签。

演示:https://jsfiddle.net/BlackLabel/d60o35sL/

events: {
render() {
const chart = this;
chart.series[0].points.forEach(point => {
const x = point.plotX;
const y = point.plotY + chart.plotTop + point.graphic.height / 3;
if (point.customLabel) {
point.customLabel.destroy()
}

point.customLabel = chart.renderer
.text(
'test',
x,
y
)
.css({
color: 'white',
})
.add();
point.customLabel.toFront()
})
}
}
},

API: https://api.highcharts.com/class-reference/Highcharts.SVGRenderer文本

API: https://api.highcharts.com/highcharts/chart.events.render

最新更新