グラフのプロットに沿った点から吹き出しポップアップを表示するために、ここでコードの修正版を使用しています。私はそれをほとんど機能させましたが、問題は、グラフをスクロールまたはズームすると、ポイントの移動に追従せずに、吹き出しが画面上の同じ場所にとどまることです。
試してみるコード サンプルが必要な場合は、こちらをご覧ください。吹き出しをプロット ポイントと一緒に移動させる方法についてのアイデアはありますか? ありがとう!
-(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)idx {
if ([plot.identifier isEqual:_plotIdentifier]) {
NSArray *selectedSymbolItem = [self.data.xyArrays objectAtIndex:idx];
NSNumber *x = [selectedSymbolItem objectAtIndex:0];
NSNumber *y = [selectedSymbolItem objectAtIndex:1];
double doublePrecisionPlotPoint[2];
doublePrecisionPlotPoint[0] = x.doubleValue;
doublePrecisionPlotPoint[1] = y.doubleValue;
CGPoint pointTouched = [plot.graph.defaultPlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:doublePrecisionPlotPoint];
CGPoint convertedPoint = [plot.graph convertPoint:pointTouched toLayer:self.view.layer];
_popupView = [[SMCalloutView alloc] init];
_popupView.title = [NSString stringWithFormat:@"Thing %i", idx];
[_popupView presentCalloutFromRect:CGRectMake(convertedPoint.x, convertedPoint.y, 10, 10) inLayer:self.view.layer constrainedToLayer:self.hostView.layer permittedArrowDirections:SMCalloutArrowDirectionDown animated:YES];
}
}