public class CrosshairState extends Object
Constructor and Description |
---|
CrosshairState()
Creates a new
crosshairState instance that calculates
distance in Java2D space. |
CrosshairState(boolean calculateDistanceInDataSpace)
Creates a new
crosshairState instance. |
Modifier and Type | Method and Description |
---|---|
Point2D |
getAnchor()
Returns the anchor point.
|
double |
getAnchorX()
Returns the x-coordinate (in data space) for the anchor point.
|
double |
getAnchorY()
Returns the y-coordinate (in data space) for the anchor point.
|
double |
getCrosshairDistance()
Returns the distance between the anchor point and the current crosshair
point.
|
double |
getCrosshairX()
Get the x-value for the crosshair point.
|
double |
getCrosshairY()
Get the y-value for the crosshair point.
|
int |
getDatasetIndex()
Returns the dataset index that the crosshair values relate to.
|
void |
setAnchor(Point2D anchor)
Sets the anchor point.
|
void |
setAnchorX(double x)
Sets the x-coordinate (in data space) for the anchor point.
|
void |
setAnchorY(double y)
Sets the y-coordinate (in data space) for the anchor point.
|
void |
setCrosshairDistance(double distance)
Sets the distance between the anchor point and the current crosshair
point.
|
void |
setCrosshairX(double x)
Sets the x coordinate for the crosshair.
|
void |
setCrosshairY(double y)
Sets the y coordinate for the crosshair.
|
void |
setDatasetIndex(int index)
Sets the dataset index that the current crosshair values relate to.
|
void |
updateCrosshairPoint(double x,
double y,
int datasetIndex,
double transX,
double transY,
PlotOrientation orientation)
Updates the crosshair point.
|
void |
updateCrosshairX(double x,
double transX,
int datasetIndex)
Checks to see if the specified data point is the closest to the
anchor point and, if yes, updates the current state.
|
void |
updateCrosshairY(double candidateY,
double transY,
int datasetIndex)
Evaluates a y-value and if it is the closest to the anchor y-value it
becomes the new crosshair value.
|
public CrosshairState()
crosshairState
instance that calculates
distance in Java2D space.public CrosshairState(boolean calculateDistanceInDataSpace)
crosshairState
instance. Determination of the
data point nearest the anchor point can be calculated in either
dataspace or Java2D space. The former should only be used for charts
with a single set of axes.calculateDistanceInDataSpace
- a flag that controls whether the
distance is calculated in data
space or Java2D space.public double getCrosshairDistance()
setCrosshairDistance(double)
public void setCrosshairDistance(double distance)
distance
- the distance.getCrosshairDistance()
public void updateCrosshairPoint(double x, double y, int datasetIndex, double transX, double transY, PlotOrientation orientation)
x
- the x-value.y
- the y-value.datasetIndex
- the dataset index.transX
- the x-value in Java2D space.transY
- the y-value in Java2D space.orientation
- the plot orientation (null
not permitted).public void updateCrosshairX(double x, double transX, int datasetIndex)
x
- the x-value.transX
- the x-value in Java2D space.datasetIndex
- the dataset index.public void updateCrosshairY(double candidateY, double transY, int datasetIndex)
Used in cases where only the y-axis is numerical.
candidateY
- y position of the candidate for the new crosshair
point.transY
- the y-value in Java2D space.datasetIndex
- the index of the range axis for this y-value.public Point2D getAnchor()
setAnchor(Point2D)
public void setAnchor(Point2D anchor)
anchor
- the anchor point (null
permitted).getAnchor()
public double getAnchorX()
public void setAnchorX(double x)
x
- the x-coordinate.public double getAnchorY()
public void setAnchorY(double y)
y
- the y-coordinate.public double getCrosshairX()
setCrosshairX(double)
public void setCrosshairX(double x)
x
- the coordinate.getCrosshairX()
,
setCrosshairY(double)
,
updateCrosshairPoint(double, double, int, double, double,
PlotOrientation)
public double getCrosshairY()
setCrosshairY(double)
public void setCrosshairY(double y)
y
- the y coordinate.getCrosshairY()
,
setCrosshairX(double)
,
updateCrosshairPoint(double, double, int, double, double,
PlotOrientation)
public int getDatasetIndex()
setDatasetIndex(int)
public void setDatasetIndex(int index)
index
- the dataset index.getDatasetIndex()
Copyright © 2001–2017 JFree.org. All rights reserved.