Search code examples
primefaceschartsjqplot

Primefaces Chart number format


I want that numbers in my Primefaces Bar Chart should be displayed with decimal points (e.g.: 102.456,00).

Is it possible to set number format in a function extender:

function ext() {
    this.cfg.axes.yaxis.tickOptions.formatString = "R$ %d ";
    this.cfg.seriesDefaults.rendererOptions.dataLabelFormatString = "R$ %d";
}

With this function, the numbers are displayed like this: R$10832 | R$25476 etc. But I want it to be displayed like: R$10.832 | R$25.476 etc.

Is it possible to set it in the function or do I need to set it with Java Number Format?


Solution

  • I use this solution for thousand separator in bean controller :

    Axis yAxis = graph.getAxis(AxisType.Y);
    yAxis.setTickFormat("%'.0f");
    

    So, for your question try yAxis.setTickFormat("R$%'.0f");