* @return The width of the tallest tick label.
*/
protected double findMaximumTickLabelWidth(List<ValueTick> ticks,
Graphics2D g2, Rectangle2D drawArea, boolean vertical) {
RectangleInsets insets = getTickLabelInsets();
Font font = getTickLabelFont();
double maxWidth = 0.0;
if (!vertical) {
FontMetrics fm = g2.getFontMetrics(font);
for (ValueTick tick : ticks) {
Rectangle2D labelBounds = null;
if (tick instanceof LogTick) {
LogTick lt = (LogTick) tick;
if (lt.getAttributedLabel() != null) {
labelBounds = TextUtilities.getTextBounds(
lt.getAttributedLabel(), g2);
}
} else if (tick.getText() != null) {
labelBounds = TextUtilities.getTextBounds(tick.getText(),
g2, fm);
}
if (labelBounds != null
&& labelBounds.getWidth() + insets.getLeft()
+ insets.getRight() > maxWidth) {
maxWidth = labelBounds.getWidth()
+ insets.getLeft() + insets.getRight();
}
}
} else {
LineMetrics metrics = font.getLineMetrics("ABCxyz",
g2.getFontRenderContext());
maxWidth = metrics.getHeight()
+ insets.getTop() + insets.getBottom();
}
return maxWidth;
}