CorePlot - 如何在图形中的不同散点图中绘制两个绘图符号之间的连接线

时间:2016-02-12 18:21:37

标签: ios core-plot

我有一张带有两个散点图的图表。两个图都有一段时间内记录的数据。对于图1中的每个数据点,在图2中存在相应的数据点。换句话说,图1和图2对于给定的x值具有变化的y值。

我正在尝试连接绘图1的选定绘图符号,以及绘图2的相应绘图符号。是否有特定的API可以使用CorePlot实现此功能?委托方法只需要一个情节符号所以没有任何东西跳到我身上,而且我还没有能够在类似问题的人身上找到任何其他问题。

我附上了一张图片来说明我想要达到的效果。

如果CorePlot目前不支持此行为,我的解决方法是向图表添加第三个绘图。第三个图将仅显示绘图1中所选数据点的绘图点和绘图2中的相应数据点。

Graph with two scatter plots where selected plot symbol is connected to corresponding plot symbol in a different plot.

1 个答案:

答案 0 :(得分:0)

As long as all three plots use the same plot space, your idea to use a third scatter plot to draw the connecting line is the best solution. Its datasource will be very simple since it only needs two points when it should draw the line, or zero when the selection is hidden. Since it's a separate plot, you can use a different line style to distinguish it from the other plots, too.