如何禁用Highcharts注释的拖动?

时间:2019-01-25 13:48:29

标签: highcharts

如何禁用拖动Highcharts注释?找不到任何选项。我试图将pointerEvents: none添加到chart -> annotations -> labelOptions -> style,但这没有帮助。

1 个答案:

答案 0 :(得分:2)

您可以在注释属性中设置draggable = ""

annotations: [{
    labels: [{
      point: 'max',
      text: 'Max'
    }],
    draggable: ""
}]

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


或在图表初始化之前添加以下行:

Highcharts.Annotation.prototype.defaultOptions.draggable = '';

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