double x2 = dataset.getXValue(series, Math.min(item + 1, itemCount - 1));
double y2 = dataset.getYValue(series, Math.min(item + 1, itemCount - 1));
if (Double.isNaN(y2)) {
y2 = 0.0;
}
double transX2 = domainAxis.valueToJava2D(x2, dataArea, plot.getDomainAxisEdge());
double transY2 = rangeAxis.valueToJava2D(y2, dataArea, plot.getRangeAxisEdge());
double transZero = rangeAxis.valueToJava2D(0.0, dataArea, plot.getRangeAxisEdge());
Polygon hotspot = null;
if (plot.getOrientation() == PlotOrientation.HORIZONTAL) {
hotspot = new Polygon();
hotspot.addPoint((int) transZero, (int) ((transX0 + transX1) / 2.0));
hotspot.addPoint((int) ((transY0 + transY1) / 2.0), (int) ((transX0 + transX1) / 2.0));
hotspot.addPoint((int) transY1, (int) transX1);
hotspot.addPoint((int) ((transY1 + transY2) / 2.0), (int) ((transX1 + transX2) / 2.0));
hotspot.addPoint((int) transZero, (int) ((transX1 + transX2) / 2.0));
}
else { // vertical orientation
hotspot = new Polygon();
hotspot.addPoint((int) ((transX0 + transX1) / 2.0), (int) transZero);
hotspot.addPoint((int) ((transX0 + transX1) / 2.0), (int) ((transY0 + transY1) / 2.0));
hotspot.addPoint((int) transX1, (int) transY1);
hotspot.addPoint((int) ((transX1 + transX2) / 2.0), (int) ((transY1 + transY2) / 2.0));
hotspot.addPoint((int) ((transX1 + transX2) / 2.0), (int) transZero);
}
|