首页 > 解决方案 > 如何使用 Highcharts 将文本放置在水平条形图数据点中以及在每个数据点下方添加文本?下面的例子:

问题描述

这就是我想要的,忽略顶部的指针。

标签: highcharts

解决方案


您可以使用该annotations模块:

annotations: [{
    labels: [{
        borderRadius: 0,
        padding: 20,
        backgroundColor: '#fff',
        style: {
            color: '#000'
        },
        point: {
            xAxis: 0,
            yAxis: 0,
            x: 0,
            y: 15
        },
        y: -130,
        text: 'Col de la Joux'
    }]
}]

现场演示:http: //jsfiddle.net/BlackLabel/eb9k5o7m/

API 参考: https ://api.highcharts.com/highcharts/annotations

文档: https ://www.highcharts.com/docs/advanced-chart-features/annotations-module


推荐阅读