在yAxis Highcharts上显示PlotLine值

时间:2017-08-21 15:53:03

标签: javascript highcharts

我正在使用Highchart的Char Bar,我想知道是否有一种显示平均线(绘图线)值的方法,显示' yAxis '中的值或鼠标悬停显示一个对话框,其中包含绘图线的精确值。

我已经显示了平均线,但我无法读取图表上的 EXACT 值。

这是Highchart中的PlotLines

plotLines: [{
    color: 'red',
    value: avg, // Insert your average here
    width: '1',
    zIndex: 2 // To not get stuck below the regular plot lines
}]

enter image description here

1 个答案:

答案 0 :(得分:1)

您应该能够显示标签:

plotLines: [{
    color: 'red',
    value: avg, // Insert your average here
    width: '1',
    zIndex: 2, // To not get stuck below the regular plot lines
    label: {
        text: avg,
        textAlign: 'left',
        x: -40
    }
}]

Reference