if (label == null) {
return; // nothing to do // nothing to do
}
Font labelFont = getItemLabelFont( [[#variable1aa564a0]], [[#variable1aa50da0]]);
g2.setFont(labelFont);
Paint paint = getItemLabelPaint( [[#variable1aa564a0]], [[#variable1aa50da0]]);
g2.setPaint(paint);
// find out where to place the label...
ItemLabelPosition position = null;
if ( !negative) {
position = getPositiveItemLabelPosition( [[#variable1aa564a0]], [[#variable1aa50da0]]);
}
else {
position = getNegativeItemLabelPosition( [[#variable1aa564a0]], [[#variable1aa50da0]]);
}
// work out the label anchor point...
Point2D anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), bar, plot.getOrientation());
if (isInternalAnchor(position.getItemLabelAnchor())) {
Shape bounds = TextUtilities.calculateRotatedStringBounds(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor());
if (bounds != null) {
if ( !bar.contains(bounds.getBounds2D())) {
if ( !negative) {
position = getPositiveItemLabelPositionFallback();
}
else {
position = getNegativeItemLabelPositionFallback();
}
if (position != null) {
anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), bar, plot.getOrientation());
}
}
}
}
if (position != null) {
TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor());
}
|