When using the nearest point picking mode for IlvChartPickInteractor, performing a mouse click on a polyline chart does not select the nearest data point

Technote (troubleshooting)


Problem(Abstract)

Why the nearest data point is not selected when clicking on a polyline chart with IlvChartPickInteractor in the nearest point picking mode?

Cause

By default the pick distance is set to 5. As the API documentation states for IlvChartDataPicker.getPickDistance():

"This distance specifies the maximum distance from the picking point beyond which data points are not considered."

Therefore, if you are using the nearest point picking mode, your mouse click must be no more than 5 pixels away from a point for the nearest point to be found.

Resolving the problem

You can set a new pick distance by subclassing IlvChartPickInteractor and overriding its createDataPicker method. Inside the createDataPicker method you will return a new DataPicker in which you pass in the pick distance as the third argument.

Here is a code snippet that sets the pick distance to 300 pixels:


public class NearestInteractor extends IlvChartPickInteractor {

    private int _minDist = 300;
   
    public void setMinDist(int minDist) {
        _minDist = minDist;
    }
    public int getMinDist() {
        return _minDist;
    }
   
    protected IlvChartDataPicker createDataPicker(MouseEvent event)
    {
      return new DataPicker(event.getX(), event.getY(), _minDist);
    }
}

Cross reference information
Segment Product Component Platform Version Edition
Business Integration IBM ILOG JViews Enterprise SDK Linux, Windows, Solaris, Mac OS X 8.8, 8.7, 8.6 All Editions

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

IBM ILOG JViews Charts
SDK

Software version:

8.6, 8.7, 8.8

Operating system(s):

Linux, Mac OS X, Solaris, Windows

Reference #:

1600346

Modified date:

2013-05-31

Translate my page

Machine Translation

Content navigation