How to change the number separator of a LineChartSeries with spaces?

87 Views Asked by At

I would like to change the format of the axis of my graph like this: "1 000 000" and I can't find the solution.

Currently this code allows me to have this format "1,000,000" :

Axis y = lineModel.getAxis(AxisType.Y);
y.setTickFormat("%'.0f");

I work with Primefaces 6.0

Thanks

1

There are 1 best solutions below

0
stefan-dan On BEST ANSWER

You can use a chartExtender.

main.js

function chartExtender() {
    this.cfg.axes.yaxis.tickOptions.formatString = "%'#.0f";
    $.jqplot.sprintf.thousandsSeparator = ' ';
}

chart.xhtml

<p:lineChart extender='chartExtender'/>