g2.setPaint(marker.getPaint());
g2.setStroke(marker.getStroke());
g2.draw(line);
String label = marker.getLabel();
RectangleAnchor anchor = marker.getLabelAnchor();
if (label != null) {
Font labelFont = marker.getLabelFont();
g2.setFont(labelFont);
g2.setPaint(marker.getLabelPaint());
Point2D coordinates = calculateRangeMarkerTextAnchorPoint(
g2, orientation, dataArea, line.getBounds2D(),
marker.getLabelOffset(), LengthAdjustmentType.EXPAND, anchor
);
TextUtilities.drawAlignedString(
label, g2,
(float) coordinates.getX(), (float) coordinates.getY(),
marker.getLabelTextAnchor()
);
}
}
else if (marker instanceof IntervalMarker) {
IntervalMarker im = (IntervalMarker) marker;
double start = im.getStartValue();
double end = im.getEndValue();
Range range = axis.getRange();
if (!(range.intersects(start, end))) {
return;
}
// don't draw beyond the axis range...
start = range.constrain(start);
end = range.constrain(end);
double v0 = axis.valueToJava2D(
start, dataArea, plot.getRangeAxisEdge()
);
double v1 = axis.valueToJava2D(
end, dataArea, plot.getRangeAxisEdge()
);
PlotOrientation orientation = plot.getOrientation();
Rectangle2D rect = null;
if (orientation == PlotOrientation.HORIZONTAL) {
rect = new Rectangle2D.Double(
v0, dataArea.getMinY(), v1 - v0, dataArea.getHeight()
);
}
else if (orientation == PlotOrientation.VERTICAL) {
rect = new Rectangle2D.Double(
dataArea.getMinX(), Math.min(v0, v1),
dataArea.getWidth(), Math.abs(v1 - v0)
);
}
Paint p = marker.getPaint();
if (p instanceof GradientPaint) {
GradientPaint gp = (GradientPaint) p;
GradientPaintTransformer t = im.getGradientPaintTransformer();
if (t != null) {
gp = t.transform(gp, rect);
}
g2.setPaint(gp);
}
else {
g2.setPaint(p);
}
g2.fill(rect);
String label = marker.getLabel();
RectangleAnchor anchor = marker.getLabelAnchor();
if (label != null) {
Font labelFont = marker.getLabelFont();
g2.setFont(labelFont);
g2.setPaint(marker.getLabelPaint());
Point2D coordinates = calculateRangeMarkerTextAnchorPoint(