Displaying decimal places on primefaces pie chart

假如想象 提交于 2019-11-29 05:19:59

Define an extender function like:

function ext() {
    this.cfg.seriesDefaults.rendererOptions.dataLabelFormatString = '%.4s%%';
    this.cfg.seriesDefaults.rendererOptions.dataLabelThreshold = 0;
}

This will format your output labels to show percentage up to 4 digits after the decimal point. Also jqPlot by default, for areas smaller than 3% won't display any labels. You have to overwrite this value with dataLabelThreshold = 0.

Finally attach this extender function on your p:pieChart:

<p:pieChart id="sample" value="#{testClazz.pieModel}"
                extender="ext" showDataLabels="true"/>

Define an extender function like:

function ext() {
    this.cfg.seriesDefaults.rendererOptions.dataLabelFormatString = '%#.4f';
    this.cfg.seriesDefaults.rendererOptions.dataLabelThreshold = 0;
}

in my case '%.4s%%' (PF 4.0) is not working so instead of I used'%#.4f' that work fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!