Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.jfree.chart.plot.CrosshairState
public class CrosshairState
extends java.lang.Object
Constructor Summary | |
| |
|
Method Summary | |
Point2D |
|
double |
|
double |
|
double |
|
double |
|
double |
|
int |
|
int |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
public CrosshairState()
Creates a newCrosshairState
instance that calculates distance in Java2D space.
public CrosshairState(boolean calculateDistanceInDataSpace)
Creates a newCrosshairState
instance.
- Parameters:
calculateDistanceInDataSpace
- a flag that controls whether the distance is calculated in data space or Java2D space.
public Point2D getAnchor()
Returns the anchor point.
- Returns:
- The anchor point.
- Since:
- 1.0.3
- See Also:
setAnchor(Point2D)
public double getAnchorX()
Returns the x-coordinate (in data space) for the anchor point.
- Returns:
- The x-coordinate of the anchor point.
- Since:
- 1.0.3
public double getAnchorY()
Returns the y-coordinate (in data space) for the anchor point.
- Returns:
- The y-coordinate of teh anchor point.
- Since:
- 1.0.3
public double getCrosshairDistance()
Returns the distance between the anchor point and the current crosshair point.
- Returns:
- The distance.
- Since:
- 1.0.3
- See Also:
setCrosshairDistance(double)
public double getCrosshairX()
Get the x-value for the crosshair point.
- Returns:
- The x position of the crosshair point.
- See Also:
setCrosshairX(double)
public double getCrosshairY()
Get the y-value for the crosshair point. This is the coordinate in data space measured against the range axis.
- Returns:
- The y position of the crosshair point.
- See Also:
setCrosshairY(double)
public int getDomainAxisIndex()
Returns the domain axis index for the crosshair x-value.
- Returns:
- The domain axis index.
- Since:
- 1.0.4
public int getRangeAxisIndex()
Returns the range axis index for the crosshair y-value.
- Returns:
- The range axis index.
- Since:
- 1.0.4
public void setAnchor(Point2D anchor)
Sets the anchor point. This is usually the mouse click point in a chart panel, and the crosshair point will often be the data item that is closest to the anchor point.
Note that the x and y coordinates (in data space) are not updated by this method - the caller is responsible for ensuring that this happens in sync.
- Parameters:
anchor
- the anchor point (null
permitted).
- See Also:
getAnchor()
public void setAnchorX(double x)
Sets the x-coordinate (in data space) for the anchor point. Note that this does NOT update the anchor itself - the caller is responsible for ensuring this is done in sync.
- Parameters:
x
- the x-coordinate.
- Since:
- 1.0.3
public void setAnchorY(double y)
Sets the y-coordinate (in data space) for the anchor point. Note that this does NOT update the anchor itself - the caller is responsible for ensuring this is done in sync.
- Parameters:
y
- the y-coordinate.
- Since:
- 1.0.3
public void setCrosshairDistance(double distance)
Sets the distance between the anchor point and the current crosshair point. As each data point is processed, its distance to the anchor point is compared with this value and, if it is closer, the data point becomes the new crosshair point.
- Parameters:
distance
- the distance.
- See Also:
getCrosshairDistance()
public void setCrosshairX(double x)
Sets the x coordinate for the crosshair. This is the coordinate in data space measured against the domain axis.
- Parameters:
x
- the coordinate.
public void setCrosshairY(double y)
Sets the y coordinate for the crosshair.
- Parameters:
y
- the y coordinate.
public void updateCrosshairPoint(double x, double y, double transX, double transY, PlotOrientation orientation)
Deprecated. Use
updateCrosshairPoint(double,double,int,int,double,double,PlotOrientation)
. See bug report 1086307.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 anXYItemRenderer
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.
- Parameters:
x
- x coordinate (measured against the domain axis).y
- y coordinate (measured against the range axis).transX
- x translated into Java2D space.transY
- y translated into Java2D space.orientation
- the plot orientation.
public void updateCrosshairPoint(double x, double y, int domainAxisIndex, int rangeAxisIndex, double transX, double transY, PlotOrientation 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 anXYItemRenderer
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.
- Parameters:
x
- x coordinate (measured against the domain axis).y
- y coordinate (measured against the range axis).domainAxisIndex
- the index of the domain axis for this point.rangeAxisIndex
- the index of the range axis for this point.transX
- x translated into Java2D space.transY
- y translated into Java2D space.orientation
- the plot orientation.
- Since:
- 1.0.4
public void updateCrosshairX(double candidateX)
Deprecated. Use
updateCrosshairX(double,int)
. See bug report 1086307.Evaluates an x-value and if it is the closest to the anchor x-value it becomes the new crosshair value. Used in cases where only the x-axis is numerical.
- Parameters:
candidateX
- x position of the candidate for the new crosshair point.
public void updateCrosshairX(double candidateX, int domainAxisIndex)
Evaluates an x-value and if it is the closest to the anchor x-value it becomes the new crosshair value. Used in cases where only the x-axis is numerical.
- Parameters:
candidateX
- x position of the candidate for the new crosshair point.domainAxisIndex
- the index of the domain axis for this x-value.
- Since:
- 1.0.4
public void updateCrosshairY(double candidateY)
Deprecated. Use
updateCrosshairY(double,int)
. See bug report 1086307.Evaluates a y-value and if it is the closest to the anchor y-value it becomes the new crosshair value. Used in cases where only the y-axis is numerical.
- Parameters:
candidateY
- y position of the candidate for the new crosshair point.
public void updateCrosshairY(double candidateY, int rangeAxisIndex)
Evaluates a y-value and if it is the closest to the anchor y-value it becomes the new crosshair value. Used in cases where only the y-axis is numerical.
- Parameters:
candidateY
- y position of the candidate for the new crosshair point.rangeAxisIndex
- the index of the range axis for this y-value.
- Since:
- 1.0.4