afreechart/src/main/java/org/afree/chart/plot/CrosshairState.java
/**
     * Evaluates a data point and if it is the closest to the anchor point it
     * becomes the new crosshair point.
     * <P>
     * To understand this method, you need to know the context in which it will
     * be called. An instance of this class is passed to an
     * {@link org.afree.chart.renderer.xy.XYItemRenderer} as each data point is
     * plotted. As the point is plotted, it is passed to this method to see if
     * it should be the new crosshair point.
     * 
     * @param x
     *            x coordinate (measured against the domain axis).
     * @param y
     *            y coordinate (measured against the range axis).
     * @param domainAxisIndex
     *            the index of the domain axis for this point.
     * @param rangeAxisIndex
     *            the index of the range axis for this point.
     * @param transX
     *            x translated into Java2D space.
     * @param transY
     *            y translated into Java2D space.
     * @param orientation
     *            the plot orientation.
     * 
     * @since JFreeChart 1.0.4
     */
Evaluates a data point and if it is the closest to the anchor point it
becomes the new crosshair point.

To understand this method, you need to know the context in which it will
be called. An instance of this class is passed to an
org.afree.chart.renderer.xy.XYItemRenderer as each data point is
plotted. As the point is plotted, it is passed to this method to see if
it should be the new crosshair point.

@param x
x coordinate (measured against the domain axis).
@param y
y coordinate (measured against the range axis).
@param domainAxisIndex
the index of the domain axis for this point.
@param rangeAxisIndex
the index of the range axis for this point.
@param transX
x translated into Java2D space.
@param transY
y translated into Java2D space.
@param orientation
the plot orientation.


Evaluates a data point and if it is the closest to the anchor point it becomes the new crosshair point . To understand this method you need to know the context in which it will be called . An instance of this class is passed to an org . afree . chart . renderer . xy . XYItemRenderer as each data point is plotted . As the point is plotted it is passed to this method to see if it should be the new crosshair point . @param x x coordinate ( measured against the domain axis ) . @param y y coordinate ( measured against the range axis ) . @param domainAxisIndex the index of the domain axis for this point . @param rangeAxisIndex the index of the range axis for this point . @param transX x translated into Java2D space . @param transY y translated into Java2D space . @param orientation the plot orientation .
public void updateCrosshairPoint(double x, double y, int domainAxisIndex,
            int rangeAxisIndex, double transX, double transY,
            PlotOrientation orientation) {
        if (this.anchor != null) {
            double d = 0.0;
            if (this.calculateDistanceInDataSpace) {
                d = (x - this.anchorX) * (x - this.anchorX)
                        + (y - this.anchorY) * (y - this.anchorY);
            } else {
                double xx = this.anchor.x;
                double yy = this.anchor.y;
                if (orientation == PlotOrientation.HORIZONTAL) {
                    double temp = yy;
                    yy = xx;
                    xx = temp;
                }
                d = (transX - xx) * (transX - xx) + (transY - yy)
                        * (transY - yy);
            }
            if (d < this.distance) {
                this.crosshairX = x;
                this.crosshairY = y;
                this.domainAxisIndex = domainAxisIndex;
                this.rangeAxisIndex = rangeAxisIndex;
                this.distance = d;
            }
        }
    }
public void updateCrosshairPoint ( double x , double y , int domainAxisIndex , int rangeAxisIndex , double transX , double transY , PlotOrientation orientation ) { if ( this . anchor != null ) { double d = 0.0 ; if ( this . calculateDistanceInDataSpace ) { d = ( x - this . anchorX ) * ( x - this . anchorX ) + ( y - this . anchorY ) * ( y - this . anchorY ) ; } else { double xx = this . anchor . x ; double yy = this . anchor . y ; if ( orientation == PlotOrientation . HORIZONTAL ) { double temp = yy ; yy = xx ; xx = temp ; } d = ( transX - xx ) * ( transX - xx ) + ( transY - yy ) * ( transY - yy ) ; } if ( d < this . distance ) { this . crosshairX = x ; this . crosshairY = y ; this . domainAxisIndex = domainAxisIndex ; this . rangeAxisIndex = rangeAxisIndex ; this . distance = d ; } } }
Evaluates a data point and if it is the closest to the anchor point it
 becomes the new crosshair point.
Evaluates a data point and if it is the closest to the anchor point it becomes the new crosshair point .