Reputation: 1060
The text of my y Axis is displaying with a decimal point but I need this to show as an integer value. E.g. 3000.0 should display as 3000
The yAxis interval length though is declared in the source as
@property (nonatomic, readwrite, assign) NSDecimal majorIntervalLength;
How can I achieve this?
The y Axis ticks are calculated by
NSString *yMajorIntervalLength = [[NSNumber numberWithFloat:(yMaxRange / 10)] stringValue];
CPTXYAxis *y = axisSet.yAxis;
y.axisLineStyle = nil;
y.majorTickLineStyle = nil;
y.minorTickLineStyle = nil;
y.majorIntervalLength = CPTDecimalFromString(yMajorIntervalLength);
Upvotes: 0
Views: 50
Reputation: 156
You can try something like this
[yMajorIntervalLength stringByDeletingPathExtension]
:)
or
NSRange dotRange = [yMajorIntervalLength rangeOfString:@"." options:NSBackwardsSearch];
if (dotRange.location != NSNotFound)
test = [yMajorIntervalLength substringToIndex:dotRange.location];
Upvotes: 0
Reputation: 1296
Try -setMaximumFractionDigits: and -setMinimumFractionDigits:
These configure the number of digits after the decimal separator.
Upvotes: 1