Primefaces图表编号格式
Primefaces Chart number format
我希望 Primefaces Bar Chart 中的数字显示为小数点(例如:102.456,00)。
是否可以在 function extender:
中设置数字格式
function ext() {
this.cfg.axes.yaxis.tickOptions.formatString = "R$ %d ";
this.cfg.seriesDefaults.rendererOptions.dataLabelFormatString = "R$ %d";
}
有了这个功能,数字显示如下:R$10832 | 25476雷亚尔等
但我希望它显示为:R$10.832 | 25.476 雷亚尔等等
是否可以在函数中设置,还是需要用Java Number Format设置?
我将此解决方案用于 bean 控制器中的千位分隔符:
Axis yAxis = graph.getAxis(AxisType.Y);
yAxis.setTickFormat("%'.0f");
所以,对于您的问题,请尝试 yAxis.setTickFormat("R$%'.0f");
在JQPlot文档中查找解决方案,发现可以在Extender中设置thousandsSeparator和decimalMark,如下:
<script>
function ext() {
this.cfg.axes.yaxis.tickOptions.formatString = "R$%'#.0f";
$.jqplot.sprintf.thousandsSeparator = '.';
$.jqplot.sprintf.decimalMark = ',';
}
</script>
我希望 Primefaces Bar Chart 中的数字显示为小数点(例如:102.456,00)。
是否可以在 function extender:
中设置数字格式function ext() {
this.cfg.axes.yaxis.tickOptions.formatString = "R$ %d ";
this.cfg.seriesDefaults.rendererOptions.dataLabelFormatString = "R$ %d";
}
有了这个功能,数字显示如下:R$10832 | 25476雷亚尔等 但我希望它显示为:R$10.832 | 25.476 雷亚尔等等
是否可以在函数中设置,还是需要用Java Number Format设置?
我将此解决方案用于 bean 控制器中的千位分隔符:
Axis yAxis = graph.getAxis(AxisType.Y);
yAxis.setTickFormat("%'.0f");
所以,对于您的问题,请尝试 yAxis.setTickFormat("R$%'.0f");
在JQPlot文档中查找解决方案,发现可以在Extender中设置thousandsSeparator和decimalMark,如下:
<script>
function ext() {
this.cfg.axes.yaxis.tickOptions.formatString = "R$%'#.0f";
$.jqplot.sprintf.thousandsSeparator = '.';
$.jqplot.sprintf.decimalMark = ',';
}
</script>