如何在highcharts中对条形图值进行四舍五入
我想在图表中显示四舍五入的值 我不想使用工具提示解决方案,因为我已禁用它如何在highcharts中对条形图值进行四舍五入,highcharts,Highcharts,我想在图表中显示四舍五入的值 我不想使用工具提示解决方案,因为我已禁用它 var chartyaxis = { min: 0, title: { text: 'Scores' }, stackLabels: { enabled: true, style: { fontWeight: 'normal', color: (Highcharts.theme &&
var chartyaxis = {
min: 0,
title: {
text: 'Scores'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'normal',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'white',
}
}
}
如果我的图表的累积值为45.9,我需要将其四舍五入到50您可以使用
格式设置程序
选项:
并使用javascript数学对象对值进行四舍五入:
stackLabels: {
enabled: true,
style: {
fontWeight: 'normal',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'white',
},
formatter: function(){
return Math.ceil(this.total);
}
}