Set Axis Text Style in Core Plot

339 Views Asked by At

So I am implementing a bar graph with core plots and currently have my y axis like this

enter image description here

What I'm trying to do is remove the trailing .0 from all the instances and am not sure what property I need to set, what method I need to override or what class I need to subclass to edit the display styling.

Thanks a lot for anyone who can help.

1

There are 1 best solutions below

1
On BEST ANSWER

Try to set the labelformatter with a suitable NSNumberFormatter.

For eg:-

NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
[numberFormatter setMaximumFractionDigits:0];
[numberFormatter setMinimumFractionDigits:0];
CPTXYAxis *y = axisSet.yAxis;
y.labelFormatter = numberFormatter;