MrStan12
MrStan12

Reputation: 85

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

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

Upvotes: 1

Views: 103

Answers (1)

stefan-dan
stefan-dan

Reputation: 604

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'/>

Upvotes: 1

Related Questions