我想将触摸的点转换为CPTXYPlotSpace point。但是我发现那里的偏移量带有真实坐标。
我发现,它是从边界计算的x轴的一部分。
我想将点映射到x&y轴的值。

我的Enlish很穷...
我想知道哪里错了?请告诉我 。

这是代码。

-(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:转换后的坐标,有问题。 [plotSpace plotPoint:plotPoint for PlotAreaViewPoint:point];,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10329321/

10-10 22:32