Android 如何捕捉移动十字线的十字线坐标?

Android 如何捕捉移动十字线的十字线坐标?,android,view,charts,listener,jfreechart,Android,View,Charts,Listener,Jfreechart,我有一个基本上是图像视图的图表视图。我需要在这上面加上十字线。当用户在需要获取XY坐标的任何位置触摸图表时,将它们映射到我的数据集,最后使用映射值更新textview。因此,当用户移动十字线时,我将使用crossponding值动态更新textview 我在图像中添加了一个onTouchListener,获得了XY坐标,但仍坚持将XY坐标映射到我的数据集(数据集中有多个时间序列)。此外,我还不知道是否可以使用plot.getDomainCroshairValue()和plot.geRangeCr

我有一个基本上是图像视图的图表视图。我需要在这上面加上十字线。当用户在需要获取XY坐标的任何位置触摸图表时,将它们映射到我的数据集,最后使用映射值更新textview。因此,当用户移动十字线时,我将使用crossponding值动态更新textview

我在图像中添加了一个onTouchListener,获得了XY坐标,但仍坚持将XY坐标映射到我的数据集(数据集中有多个时间序列)。此外,我还不知道是否可以使用plot.getDomainCroshairValue()和plot.geRangeCroshairValue()来获取数据集的值

在使用AFreeChart库时,有人能给我建议如何在Android中实现这一点吗

Need to know when to use plot.handleClick(x, y, plotrendingInfo) ?
谢谢
来自javadoc:AFreeChart.handleClick()的Akhash

应该实现视图的onTouchEvent(),并且在触摸事件发生时提供的MotionEvent对象应该转换为Afreechart的handleClick(),后者反过来委托Plot.handleClick()进行绘制

handleClick()已经具有转换机制,可以将X,Y坐标转换为数据集X,Y值

/**
 * Handles a 'click' on the chart. AFreeChart is not a UI component, so some
 * other object (for example, {@link DemoView}) needs to capture the click
 * event and pass it onto the AFreeChart object. If you are not using
 * AFreeChart in a client application, then this method is not required.
 * 
 * @param x
 *            x-coordinate of the click (in Java2D space).
 * @param y
 *            y-coordinate of the click (in Java2D space).
 * @param info
 *            contains chart dimension and entity information (
 *            <code>null</code> not permitted).
 */

public void handleClick(int x, int y, ChartRenderingInfo info) {

    // pass the click on to the plot...
    // rely on the plot to post a plot change event and redraw the chart...
    this.plot.handleClick(x, y, info.getPlotInfo());

}