Can someone tell me how to remove the decimal points from the Axis labels? Instead of 10.0 I\'d like to have only 10 showing.
CPTXYAxis *x = axisSet.xAxis;
NSNumberFormatter *Xformatter = [[NSNumberFormatter alloc] init];
[Xformatter setGeneratesDecimalNumbers:NO];
[Xformatter setNumberStyle:NSNumberFormatterDecimalStyle];
x.labelFormatter = Xformatter;
[Xformatter release];
This will take care of the decimals on the x axis as well as add commas with NSNumberFormatterDecimalStyle. You will need to do the same for the y axis.
There are a ton of things you can do with NSNumberFormatter, including converting numbers into dollars using:
[Xformatter setNumberStyle:NSNumberFormatterCurrencyStyle];
//this will add a decimal point again if you put this in the code above
Play around with the Esc key to see all formatting available for setNumberStyle or other methods.
Set the labelFormatter
property on the axis to a new formatter. This is a standard NSNumberFormatter object. See Apple's class documentation for details on the options available.