如何格式化Highcharts dataLabels小数点 [英] How to Format Highcharts dataLabels Decimal Points
本文介绍了如何格式化Highcharts dataLabels小数点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你可以看看这个例子,让我知道如何格式化要显示的dataLabels只有两位十进制数?
Can you please take a look at this example and let me know how I can format the dataLabels to be display only with two decimal numbers?
这里是我在系列中使用的numver格式
Here is the numver formats which I have in the series
series: [{
name: 'Tokyo',
data: [7.554555, 6.34345559, 9.5555, 14.5555, 18.4333433, 21.5555, 25.2, 26.5333333, 23.33333, 18.23243543, 13.776565669, 9.65454656]
}, {
name: 'London',
data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
}]
我想将它们呈现为7.55,6.34,9.55。谢谢
and I would like to present them like 7.55 , 6.34, 9.55 . Thanks
推荐答案
您需要结合 dataLabels
formatter and Highcharts.numberFormat :
You need to combine the dataLabels
formatter and Highcharts.numberFormat:
...
dataLabels: {
enabled: true,
formatter: function () {
return Highcharts.numberFormat(this.y,2);
}
}
...
请参阅 jsFiddle
这篇关于如何格式化Highcharts dataLabels小数点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文