gpt4 book ai didi

javascript - Highcharts : trouble with axis Label

转载 作者:行者123 更新时间:2023-12-03 11:26:03 28 4
gpt4 key购买 nike

我无法解释这种行为:
有时,我的图表会显示带有大量小数的轴的第一个或最后一个标签。

enter image description here enter image description here

在我的图表选项中,yAxis 如下所示:

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
]

如何解决这个问题?任何帮助表示赞赏。

最佳答案

您没有提到标签的值应该是什么,因此它使用它们的原始值,该值可能是由除法生成的 float 。

我建议您手动处理标签,如下所示:

    labels: {
formatter: function () {
return Math.floor(this.value)
}
}

正如你所看到的,我使用floor()函数来删除小数。

关于javascript - Highcharts : trouble with axis Label,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26915299/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com