2012-05-02 6 views
3

私は線形のy軸と対数的なx軸を持つ散布図を持っています。しかし、タッチポイントをプロット空間座標に変換しようとすると、私は問題を抱えています。コアプロット - ログ軸を持つプロット空間のプロット点にタッチポイントを変換する方法

私は以下の提案、様々な場所のようなものを見ている:私はこれを実行すると

- (BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(id)event atPoint:(CGPoint)point 
{ 
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)space; 

CPTScatterPlot *scatterPlot = [[[plotSpace graph] allPlots] objectAtIndex:0]; 
CGPoint plotAreaPoint = [[plotSpace graph] convertPoint:point toLayer:scatterPlot]; 

NSLog(@"PlotAreaPoint : %.1f, %.1f", plotAreaPoint.x, plotAreaPoint.y); 

NSDecimal dataPoint[2]; 
NSDecimalNumber *xCoordinate, *yCoordinate; 

[plotSpace plotPoint:dataPoint forPlotAreaViewPoint:plotAreaPoint]; 

xCoordinate = [NSDecimalNumber decimalNumberWithDecimal:dataPoint[0]]; 
yCoordinate = [NSDecimalNumber decimalNumberWithDecimal:dataPoint[1]]; 

NSLog(@"DataPoint : %.1f, %.1f", [xCoordinate floatValue], [yCoordinate floatValue]); 

return YES; 
} 

、plotAreaPointは正しいようだ、とY座標は正しいです。 xCoordinateは、左端(5.0)または右端(500.0)をタップすると正しいですが、中央をタップすると線形軸のように動作します。もし私が真ん中をタップすると、私は50.0の代わりに250.0を得ます。私は何かを逃しているのですか?これを行う別の方法がありますか?

ありがとう、Tim

答えて

関連する問題