[英]extra tooltip for displaying yAxis values on right side
我想在我的图表中显示一个额外的工具提示,以显示yAxis
值。 我在谈论的这些工具提示已在许多ohlc图表中看到。 出于演示目的,我使用了绘画工具。
如果您在右侧看到主工具提示,则还有另一个工具提示正在显示yAxis
值。 我们如何才能在Highcharts中做到相同。 我有以下代码。
Highcharts.chart('container', {
title: {
text: 'Non-snapped crosshair'
},
xAxis: {
crosshair: {
snap: false
}
},
yAxis: {
crosshair: {
snap: false
},
opposite: true
},
tooltip: {
borderWidth: 1,
shape: 'rect',
positioner: function () {
return { x: 0, y: 0 };
},
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
注意:为了使十字准线跟随鼠标指针,我将两个轴上的crosshair
snap
属性设置为false。
可以使用highstock
源代码和十字线的label
属性:
yAxis: {
crosshair: {
snap: false,
label: {
enabled: true,
format: '{value:.2f}'
}
},
...
},
现场演示: https : //jsfiddle.net/BlackLabel/yz4b6cus/
API参考: https : //api.highcharts.com/highstock/xAxis.crosshair.label
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.