afreechart/src/main/java/org/afree/chart/axis/ValueAxis.java
/**
     * A utility method for determining the width of the widest tick label.
     * 
     * @param ticks
     *            the ticks.
     * @param canvas
     *            the graphics device.
     * @param drawArea
     *            the area within which the plot and axes should be drawn.
     * @param vertical
     *            a flag that indicates whether or not the tick labels are
     *            'vertical'.
     * 
     * @return The width of the tallest tick label.
     */
A utility method for determining the width of the widest tick label.

@param ticks
the ticks.
@param canvas
the graphics device.
@param drawArea
the area within which the plot and axes should be drawn.
@param vertical
a flag that indicates whether or not the tick labels are
'vertical'.

@return The width of the tallest tick label.
A utility method for determining the width of the widest tick label . @param ticks the ticks . @param canvas the graphics device . @param drawArea the area within which the plot and axes should be drawn . @param vertical a flag that indicates whether or not the tick labels are ' vertical ' . @return The width of the tallest tick label .
protected double findMaximumTickLabelWidth(List ticks, Canvas canvas,
            RectShape drawArea, boolean vertical) {
        Paint paint = PaintUtility.createPaint(Paint.ANTI_ALIAS_FLAG, getTickLabelPaintType(), getTickLabelFont());
        RectangleInsets insets = getTickLabelInsets();
        double maxWidth = 0.0;
        if (!vertical) {
            Iterator iterator = ticks.iterator();
            while (iterator.hasNext()) {
                Tick tick = (Tick) iterator.next();
                float labelWidth = TextUtilities.getTextWidth(tick
                        .getText(), paint);
                if (labelWidth + insets.getLeft()
                        + insets.getRight() > maxWidth) {
                    maxWidth = labelWidth + insets.getLeft()
                            + insets.getRight();
                }
            }
        } else {
            RectShape labelBounds = TextUtilities.getTextBounds("ABCxyz",
                    paint);
            maxWidth = labelBounds.getHeight() + insets.getTop()
                    + insets.getBottom();
        }
        return maxWidth;
    }
protected double findMaximumTickLabelWidth ( List ticks , Canvas canvas , RectShape drawArea , boolean vertical ) { Paint paint = PaintUtility . createPaint ( Paint . ANTI_ALIAS_FLAG , getTickLabelPaintType ( ) , getTickLabelFont ( ) ) ; RectangleInsets insets = getTickLabelInsets ( ) ; double maxWidth = 0.0 ; if ( ! vertical ) { Iterator iterator = ticks . iterator ( ) ; while ( iterator . hasNext ( ) ) { Tick tick = ( Tick ) iterator . next ( ) ; float labelWidth = TextUtilities . getTextWidth ( tick . getText ( ) , paint ) ; if ( labelWidth + insets . getLeft ( ) + insets . getRight ( ) > maxWidth ) { maxWidth = labelWidth + insets . getLeft ( ) + insets . getRight ( ) ; } } } else { RectShape labelBounds = TextUtilities . getTextBounds ( "ABCxyz" , paint ) ; maxWidth = labelBounds . getHeight ( ) + insets . getTop ( ) + insets . getBottom ( ) ; } return maxWidth ; }
A utility method for determining the width of the widest tick label.
A utility method for determining the width of the widest tick label .
// Font font = getTickLabelFont(); //performance tuning //                RectShape labelBounds = TextUtilities.getTextBounds(tick //                        .getText(), paint); //                if (labelBounds.getWidth() + insets.getLeft() //                        + insets.getRight() > maxWidth) { //                    maxWidth = labelBounds.getWidth() + insets.getLeft() //                            + insets.getRight(); //                }