}
// Font font = getLabelFont();
// g2.setFont(font);
// g2.setPaint(getLabelPaint());
final RectangleInsets insets = this.getLabelInsets();
final Rectangle labelBounds = TextUtilities.getTextBounds(label, g2);
double labelx, labely;
if (edge == RectangleEdge.TOP) {
labelx = RectangleUtil.getCenterX(dataArea);
labely = state.getCursor() - insets.getBottom()
- labelBounds.height / 2.0;
TextUtilities.drawRotatedString(label, g2, (float) labelx,
(float) labely, TextAnchor.CENTER, this.getLabelAngle(),
TextAnchor.CENTER);
state.cursorUp(insets.getTop() + labelBounds.height
+ insets.getBottom());
} else if (edge == RectangleEdge.BOTTOM) {
labelx = RectangleUtil.getCenterX(dataArea);
labely = state.getCursor() + insets.getTop() + labelBounds.height
/ 2.0;
TextUtilities.drawRotatedString(label, g2, (float) labelx,
(float) labely, TextAnchor.CENTER, this.getLabelAngle(),
TextAnchor.CENTER);
state.cursorDown(insets.getTop() + labelBounds.height
+ insets.getBottom());
} else if (edge == RectangleEdge.LEFT) {
this.swapWidthAndHeight(labelBounds);
labelx = state.getCursor() - insets.getRight() - labelBounds.width
/ 2.0;
labely = RectangleUtil.getCenterY(dataArea);
TextUtilities.drawRotatedString(label, g2, (float) labelx,
(float) labely, TextAnchor.CENTER, this.getLabelAngle()
- Math.PI / 2.0, TextAnchor.BOTTOM_CENTER);
state.cursorLeft(insets.getLeft() + labelBounds.width
+ insets.getRight());
} else if (edge == RectangleEdge.RIGHT) {
this.swapWidthAndHeight(labelBounds);
labelx = state.getCursor() + insets.getLeft() + labelBounds.width
/ 2.0;
labely = RectangleUtil.getCenterY(dataArea);
TextUtilities.drawRotatedString(label, g2, (float) labelx,
(float) labely, TextAnchor.CENTER, this.getLabelAngle()
+ Math.PI / 2.0, TextAnchor.BOTTOM_CENTER);
state.cursorRight(insets.getLeft() + labelBounds.width
+ insets.getRight());
}
return state;
}