0
我無法解釋此行爲:
有時,我的圖表顯示的軸的第一個或最後一個標籤有很多小數。Highcharts:使用軸的問題標籤
在我的圖形選項,這裏是y軸什麼樣子:
yAxis : [{
alternateGridColor: "white",
gridLineColor : "#E3E3E3",
lineWidth: 2,
tickLength : 5,
lineColor : '#A5A5A5',
tickWidth : 2,
tickLength : 5,
tickColor : '#A5A5A5',
labels : {
style : {
fontWeight : 'bold',
fontSize: '10px'
},
x : -labelMargin
},
tickPixelInterval: 20
},
//more axis
]
如何解決呢?任何幫助讚賞。
我已經添加了'format:'{value:.2f}''並且如預期的那樣,它可以防止這種奇怪的行爲再次出現。但是當軸顯示「更大」的值(我的意思是1,2,3)時,我不希望軸顯示小數。任何提示? – zbMax
我認爲你可以再次做數學運算。例如,根據我的答案,它應該是這樣的: 'return(this.value - Math.floor(this.value))'將小數分開。 – muradin
@zbMax使用[標籤格式化程序](http://api.highcharts.com/highcharts#yAxis.labels.formatter)和[Highcharts.numberFormat](http://api.highcharts.com/highcharts#Highcharts.numberFormat )支持任何檢查值的條件。 –