在核心图中,如何使用plotSymbolWasSelectedAtRecordIndex方法转换为坐标?
我可以看到,在 mac 版本示例中,他们使用了绑定和 NSArrayController(这两者在 iO 中都不可用?)
我得到的
(void)scatterPlot:(CPScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index
是上下文中的索引和绘图。
我需要获得准确的坐标,以便我可以在此时使用弹出框。
提前致谢
i can see that in the mac version example, they have used binding and NSArrayController (both of which are not available in iOs?)
what i have from
(void)scatterPlot:(CPScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index
is the index and the plot in context.
I need to get the exact coordinates so that i can use a popover at that point.
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您向散点图提供数据时,您使用了
委托方法(或类似的方法)。它查询的部分信息是 recordIndex,它通常用作数据点 NSArray 的索引。
您在那里显示的委托方法会返回一个索引,以指示与散点图上的点进行了交互。您应该能够获取与数据源数组中的索引相对应的 X、Y 坐标,并用于
获取图表中与所触摸的数据点位置相对应的视图坐标。从那里,您可以进行坐标空间转换,以获得放置注释的适当位置。
When you provided data to the scatter plot, you used the
delegate method (or something like that). Part of the information it queried was the recordIndex, which is usually used as an index into an NSArray of your data points.
The delegate method you show there gives you back an index to indicate that a point on the scatter plot was interacted with. You should be able to grab the X, Y coordinate that corresponds to that index in your data source array and use
to obtain the view coordinate in the graph that corresponds to the data point location that was touched. From there, you can do coordinate space conversions to get the appropriate location to place your annotation.