Coreplot - 选择线下方的区域

时间:2016-03-07 11:30:47

标签: ios core-plot

我正在使用coreplot来绘制一个散点图: enter image description here

我使用4个不同的图(彩色)并通过在每个“条”的开头/结尾添加0值点来创建“棒状”感觉。 我想确定用户选择了哪个条形图,然后更改其他图形的alpha。

我尝试过使用

-(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(id)event atPoint:(CGPoint)point {
    //here I translate the selected point to Data points coordinates 
    //and check which of the plot sources has value >0 (that means bar is visible)
    //and is closest to the selected point
}

此方法有效,但是当我想滚动数据时,也会调用上面的方法。

必须有一些更容易的解决方案。感谢。

1 个答案:

答案 0 :(得分:1)

从您的委托方法返回YES,以告知您已对该事件采取操作的绘图空间,并且无需启动滚动。您可能还需要处理其他事件,因此您的应用可以区分点击和拖动。