iphone - coreplot :Converted coordinates, 有问题。 [plotSpaceplotPoint:plotPoint forPlotAreaViewPoint:point];

标签 iphone ios core-plot

我想将接触到的点转换为 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;
}

最佳答案

先将点转换到绘图区域的坐标系:

CGPoint plotAreaPoint = [graph convertPoint:point toLayer:graph.plotAreaFrame.plotArea];
[plotSpace plotPoint:plotPoint forPlotAreaViewPoint:plotAreaPoint]; 

关于iphone - coreplot :Converted coordinates, 有问题。 [plotSpaceplotPoint:plotPoint forPlotAreaViewPoint:point];,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10329321/

相关文章:

iphone - iOS Phone Gap/Cordova 2.2.0 中的默认启动图像

ios - Searchcontroller 仅适用于 iOS 11 或更高版本

iphone - 如何在 iOS 上做晕影效果?

ios - 如何向前移动 cpt 散点图线

objective-c - Core Plot 出现错误 "Too many arguments to function call"

ios - 性能核心图

ios - APNS 从多个服务器发送通知

iphone - iOS:我的第一个应用程序的初学者帮助:切换 View ?

iphone - 关于自动调整蒙版

ios - 如何有选择地向 UIWebView 添加样式表?