StoneBreaker
StoneBreaker

Reputation: 723

Making an NSDecimal for CorePlot

I have a coreplot item y.majorIntervalLength which I believe to be of type NSDecimal. I need to fill it with a value that I calculate from a couple of doubles. The problem is when I go to assign the resulting double to y.majorIntervalLength I get:

Incompatible type for Argument 1...

I do not know how to convert a value from a double to an NSDecimal which is what I gather is required for the y.majorIntervalLength.

How do I package/wrap/cast this value to the correct format?

What do I need to read to learn this kind of thing?

Thanks

Upvotes: 0

Views: 1115

Answers (1)

Eric Skroch
Eric Skroch

Reputation: 27381

Core Plot includes an extensive set of utility functions for converting values to and from NSDecimal. Look in the CPTUtilities header file or docs.

For your example:

y.majorIntervalLength = CPTDecimalFromDouble(2.5);

Upvotes: 4

Related Questions