gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:15:54 25 4
gpt4 key购买 nike

我想将接触到的点转换为 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, 有问题。 [plotSpace plotPoint:plotPoint forPlotAreaViewPoint:point];,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10329321/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com