diff --git a/framework/Source/CPTUtilities.h b/framework/Source/CPTUtilities.h index fe41b4dd6..691923cec 100644 --- a/framework/Source/CPTUtilities.h +++ b/framework/Source/CPTUtilities.h @@ -133,6 +133,7 @@ CGRect CPTAlignBorderedRectToUserSpace(__nonnull CGContextRef context, CGRect re NSString *__nonnull CPTStringFromPoint(CGPoint point); NSString *__nonnull CPTStringFromSize(CGSize size); NSString *__nonnull CPTStringFromRect(CGRect rect); +NSString *__nonnull CPTStringFromVector(CGVector vector); /// @} diff --git a/framework/Source/CPTUtilities.m b/framework/Source/CPTUtilities.m index 9b268e58e..373f11b5b 100644 --- a/framework/Source/CPTUtilities.m +++ b/framework/Source/CPTUtilities.m @@ -976,6 +976,15 @@ CGRect CPTAlignBorderedRectToUserSpace(__nonnull CGContextRef context, CGRect re return [NSString stringWithFormat:@"{{%g, %g}, {%g, %g}}", (double)rect.origin.x, (double)rect.origin.y, (double)rect.size.width, (double)rect.size.height]; } +/** @brief Creates a string representation of the given vector. + * @param vector The vector. + * @return A string with the format {dx, dy}. + **/ +NSString *__nonnull CPTStringFromVector(CGVector vector) +{ + return [NSString stringWithFormat:@"{%g, %g}", (double)vector.dx, (double)vector.dy]; +} + #pragma mark - #pragma mark CGPoint utilities