【发布时间】:2012-04-26 07:54:42
【问题描述】:
我想将触摸的点转换为 CPTXYPlotSpace 点。但我发现那里有与真实坐标的偏移。 我发现,它从边界计算了 x 轴的一部分。 我想将点映射到 x&y 轴的值。
我的英语很差.... 我想知道哪里错了?请告诉我。
这是代码。
-(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(id)event atPoint:(CGPoint)point
{ NSDecimal plotPoint[2];
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace;
[plotSpace plotPoint:plotPoint forPlotAreaViewPoint:point];
//HERE HAVE SOME OFFSET. I FIND ,it Calculated part of the x-axis from the border
NSLog(@"touch plotPoint = %d, %f",
[[NSDecimalNumber decimalNumberWithDecimal:plotPoint[CPTCoordinateX]] intValue],
[[NSDecimalNumber decimalNumberWithDecimal:plotPoint[CPTCoordinateY]] doubleValue]);
return YES;
}
【问题讨论】: