JLoewy
JLoewy

Reputation: 535

Set Axis Text Style in Core Plot

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.

Upvotes: 2

Views: 344

Answers (1)

iDev
iDev

Reputation: 23278

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;

Upvotes: 2

Related Questions