// the anchor point is typically the point where the mouse last
// clicked - the crosshairs will be driven off this point...
if ((anchor != null) && !dataArea.contains(anchor)) {
anchor = null;
}
final CrosshairState crosshairState = new CrosshairState();
crosshairState.setCrosshairDistance(Double.POSITIVE_INFINITY);
crosshairState.setAnchor(anchor);
crosshairState.setAnchorX(Double.NaN);
crosshairState.setAnchorY(Double.NaN);
if (anchor != null) {
final ValueAxis domainAxis = this.getDomainAxis();
if (domainAxis != null) {
double x;
if (orient == PlotOrientation.VERTICAL) {
x = domainAxis.java2DToValue(anchor.x, dataArea, this
.getDomainAxisEdge());
} else {
x = domainAxis.java2DToValue(anchor.y, dataArea, this
.getDomainAxisEdge());
}
crosshairState.setAnchorX(x);
}
final ValueAxis rangeAxis = this.getRangeAxis();
if (rangeAxis != null) {
double y;
if (orient == PlotOrientation.VERTICAL) {
y = rangeAxis.java2DToValue(anchor.y, dataArea, this
.getRangeAxisEdge());
} else {
y = rangeAxis.java2DToValue(anchor.x, dataArea, this
.getRangeAxisEdge());
}
crosshairState.setAnchorY(y);
}
}
crosshairState.setCrosshairX(this.getDomainCrosshairValue());
crosshairState.setCrosshairY(this.getRangeCrosshairValue());
gc.setClipping(dataArea);
AxisState domainAxisState = (AxisState) axisStateMap.get(this
.getDomainAxis());
if (domainAxisState == null) {