在Highcharts线性图中,我启用了格式化的工具提示和十字线。工具提示和十字准线之间的距离很大,因此会出现一个间隙(用红色标记):
设置
tooltip: {
distance: 1
}
从视觉上解决了问题,但随后出现编译器错误: 对象文字可能仅指定已知属性,并且在“工具提示选项”类型中不存在“距离”
有没有其他方法可以使工具提示和十字准线之间的距离最小?
这些是我关于工具提示的图表选项:
tooltip: {
headerFormat: '',
useHTML: true,
backgroundColor: null,
borderWidth: 0,
shadow: false,
shape: 'square',
pointFormatter: function() {
return '<div style="background-color:'+this.series.color+';color:white;padding:5px;font-size:12px;z-index:10">' + this.y.toLocaleString() + ' %</div>'
},
split: true,
crosshairs: {
color: '#333333',
dashStyle: 'solid',
width: 2,
},
},
答案 0 :(得分:0)
此空间是由padding
属性的默认值引起的,可以通过以下方式减小它:
tooltip: {
...,
padding: -8
}