0
我有一个图表,其中有多个yAxes和标签重叠。我不能用不同的x值来实例化它们,因为我有一个可以打开和关闭轴的UI,因此会在其中一个标签上留下奇怪的间距。我想使用格式化程序来检测标签是否不是第一个标签,然后更改x值,但是我无法找到如何更改格式化程序回调中的值。下面是我的代码Highcharts:多重yAxes标签重叠
{
title: 'Count',
gridLineDashStyle: 'Dash',
gridLineColor: '#e8ebef',
showFirstLabel: false,
labels: {
enabled: true,
align: 'right',
x: 5,
y: 15,
style: {
fontFamily: fontFamily,
fontSize: '10px',
fontWeight: 'bold',
color: '#8596a5'
}
},
opposite: true,
allowDecimals: true,
min: 0,
minRange: 2 // Ensures flat charts don't show line at the bottom
},
{
title: 'Cost',
gridLineDashStyle: 'Dash',
gridLineColor: '#e8ebef',
showFirstLabel: false,
labels: {
enabled: true,
align: 'left',
x: 5,
y: 15,
style: {
fontFamily: fontFamily,
fontSize: '10px',
fontWeight: 'bold',
color: '#8596a5'
},
formatter: function() {
if (this.isFirst) { console.log("first") }
this.attr({ x:44 })
}
},
allowDecimals: true,
min: 0,
minRange: 2 // Ensures flat charts don't show line at the bottom
},
任何想法?
请将您的示例重新创建为jsfiddle.net上的实时演示 –