我试图对 Highcharts 图表中的堆积柱进行求和,以显示 $ 和逗号以分隔数千。
以下是摘录:
yAxis: {
stackLabels: {
enabled: true,
formatter: function() {
return 'Total: $' + this.total;
},
},
labels: {
format: '${value:,.0f}',
},
title: {
text: 'Total $'
},
},
Run Code Online (Sandbox Code Playgroud)
标签显示正确,但无法完全让“this.total”以逗号显示堆栈上方的值。有任何想法吗?
提前致谢。
使用Highcharts.numberFormat具有如下定义的
numberFormat(数字 number,[数字小数],[字符串小数点],[字符串千位数])
formatter: function () {
return Highcharts.numberFormat(this.total, 1, '.', ',');
}
Run Code Online (Sandbox Code Playgroud)
这是一个演示http://jsfiddle.net/dhirajbodicherla/ah7r2fy1/2/
| 归档时间: |
|
| 查看次数: |
5078 次 |
| 最近记录: |