com.jrefinery.chart
Class CrosshairInfo

java.lang.Object
  extended by com.jrefinery.chart.CrosshairInfo

public class CrosshairInfo
extends java.lang.Object

Maintains information about crosshairs on a plot.


Field Summary
protected  double anchorX
          The x-value for the anchor point.
protected  double anchorY
          The y-value for the anchor point.
protected  double crosshairX
          The x-value for the crosshair point.
protected  double crosshairY
          The y-value for the crosshair point.
protected  double distance
          The smallest distance so far between the anchor point and a data point.
 
Constructor Summary
CrosshairInfo()
          Default constructor.
 
Method Summary
 double getCrosshairX()
          Sets the x-value for the crosshair point.
 double getCrosshairY()
          Sets the y-value for the crosshair point.
 void setAnchorX(double x)
          Sets the x-value for the anchor point.
 void setAnchorY(double y)
          Sets the y-value for the anchor point.
 void setCrosshairDistance(double distance)
          Sets the distance.
 void updateCrosshairPoint(double candidateX, double candidateY)
          Evaluates a data point and if it is the closest to the anchor point it becomes the new crosshair point.
 void updateCrosshairX(double candidateX)
          Evaluates an x-value and if it is the closest to the anchor point it becomes the new crosshair point.
 void updateCrosshairY(double candidateY)
          Evaluates a y-value and if it is the closest to the anchor point it becomes the new crosshair point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

anchorX

protected double anchorX
The x-value for the anchor point.


anchorY

protected double anchorY
The y-value for the anchor point.


crosshairX

protected double crosshairX
The x-value for the crosshair point.


crosshairY

protected double crosshairY
The y-value for the crosshair point.


distance

protected double distance
The smallest distance so far between the anchor point and a data point.

Constructor Detail

CrosshairInfo

public CrosshairInfo()
Default constructor.

Method Detail

setCrosshairDistance

public void setCrosshairDistance(double distance)
Sets the distance.


updateCrosshairPoint

public void updateCrosshairPoint(double candidateX,
                                 double candidateY)
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 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.


updateCrosshairX

public void updateCrosshairX(double candidateX)
Evaluates an x-value and if it is the closest to the anchor point it becomes the new crosshair point.

Used in cases where only the x-axis is numerical.


updateCrosshairY

public void updateCrosshairY(double candidateY)
Evaluates a y-value and if it is the closest to the anchor point it becomes the new crosshair point.

Used in cases where only the y-axis is numerical.


setAnchorX

public void setAnchorX(double x)
Sets the x-value for the anchor point.


setAnchorY

public void setAnchorY(double y)
Sets the y-value for the anchor point.


getCrosshairX

public double getCrosshairX()
Sets the x-value for the crosshair point.


getCrosshairY

public double getCrosshairY()
Sets the y-value for the crosshair point.



Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.