Reputation: 3389
I am trying to give float point into core-plot y axis value, it is not working. So is i need to give it as whole number instead of decimal number.If decimal number works please give me the sample code.
Upvotes: 0
Views: 625
Reputation: 79
You can make NSNUmber instance, then assign with NSDecimalNumber value. For example:
NSNumber *tmpNum = nil;
tmpNum = [[NSDecimalNumber decimalNumberWithDecimal:[[NSNumber numberWithFloat:yourFloat] decimalVaue]];
Upvotes: 0
Reputation: 27381
Many axis properties take an NSDecimal value. Core Plot includes a number of utility functions to make it easier to create them. You can see examples of the usage throughout the example programs. Look for CPDecimalFromDouble
, CPDecimalFromFloat
, CPDecimalFromString
, etc.
For the plot data, you can provide any NSNumber
instance. Core Plot supports NSDecimalNumber
as well and will use higher-precision calculations when drawing the graph, although this comes at a performance cost.
Upvotes: 2