0
사용자가 팔레트 플롯에서 포인트를 터치하고 해당 포인트에 대한 정보를 가져와야하는 AndroidPlot을 사용하는 어플리케이션을 작성 중입니다. 즉, 응용 프로그램은 접촉 한 위치에 가장 가까운 점을 식별하거나 점이 만져 졌음을 인식하고 점의 특정 ID를 반환 할 수 있어야합니다. 이 스 캐터 플롯의 모든 점은 항상 하나의 시리즈로 이루어 지므로 시리즈 간의 식별은 문제가되지 않지만 터치 된 점을 찾거나 식별하는 방법을 구현할 방법을 모르겠습니다. 그래프를 터치 할 때마다에 AlertDialog를 생성AndroidPlot : 포인트에서 터치 이벤트 감지하기
plot.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
PointF click = new PointF(motionEvent.getX(), motionEvent.getY());
if(plot.getGraphWidget().containsPoint(click)) {
AlertDialog.Builder builder = new AlertDialog.Builder(GraphView.this);
builder.setTitle("Point: ");
builder.setMessage("Description: ");
AlertDialog dialog = builder.create();
dialog.show();
}
return false;
}
});
}
: 나는 멀리로 얻을 수
.