afreechart/src/main/java/org/afree/chart/axis/PeriodAxis.java
/**
     * Estimates the space (height or width) required to draw the axis.
     *
     * @param canvas  the graphics device.
     * @param plot  the plot that the axis belongs to.
     * @param plotArea  the area within which the plot (including axes) should
     *                  be drawn.
     * @param edge  the axis location.
     * @param space  space already reserved.
     *
     * @return The space required to draw the axis (including pre-reserved
     *         space).
     */
Estimates the space (height or width) required to draw the axis.
@param canvas  the graphics device.
@param plot  the plot that the axis belongs to.
@param plotArea  the area within which the plot (including axes) should
be drawn.
@param edge  the axis location.
@param space  space already reserved.

@return The space required to draw the axis (including pre-reserved
space).
Estimates the space ( height or width ) required to draw the axis . @param canvas the graphics device . @param plot the plot that the axis belongs to . @param plotArea the area within which the plot ( including axes ) should be drawn . @param edge the axis location . @param space space already reserved . @return The space required to draw the axis ( including pre - reserved space ) .
public AxisSpace reserveSpace(Canvas canvas, Plot plot,
                                  RectShape plotArea, RectangleEdge edge,
                                  AxisSpace space) {
        if (space == null) {
            space = new AxisSpace();
        }
        if (!isVisible()) {
            return space;
        }
        double dimension = getFixedDimension();
        if (dimension > 0.0) {
            space.ensureAtLeast(dimension, edge);
        }
        RectShape labelEnclosure = getLabelEnclosure(canvas, edge);
        double labelHeight = 0.0;
        double labelWidth = 0.0;
        double tickLabelBandsDimension = 0.0;
        for (int i = 0; i < this.labelInfo.length; i++) {
            PeriodAxisLabelInfo info = this.labelInfo[i];
            Paint paint = PaintUtility.createPaint(Paint.ANTI_ALIAS_FLAG, info.getLabelPaintType(), info.getLabelFont());
            FontMetrics fm = paint.getFontMetrics();
            tickLabelBandsDimension
            += info.getPadding().extendHeight(fm.bottom-fm.top);
        }
        if (RectangleEdge.isTopOrBottom(edge)) {
            labelHeight = labelEnclosure.getHeight();
            space.add(labelHeight + tickLabelBandsDimension, edge);
        }
        else if (RectangleEdge.isLeftOrRight(edge)) {
            labelWidth = labelEnclosure.getWidth();
            space.add(labelWidth + tickLabelBandsDimension, edge);
        }
        double tickMarkSpace = 0.0;
        if (isTickMarksVisible()) {
            tickMarkSpace = getTickMarkOutsideLength();
        }
        if (this.minorTickMarksVisible) {
            tickMarkSpace = Math.max(tickMarkSpace,
                    this.minorTickMarkOutsideLength);
        }
        space.add(tickMarkSpace, edge);
        return space;
    }
public AxisSpace reserveSpace ( Canvas canvas , Plot plot , RectShape plotArea , RectangleEdge edge , AxisSpace space ) { if ( space == null ) { space = new AxisSpace ( ) ; } if ( ! isVisible ( ) ) { return space ; } double dimension = getFixedDimension ( ) ; if ( dimension > 0.0 ) { space . ensureAtLeast ( dimension , edge ) ; } RectShape labelEnclosure = getLabelEnclosure ( canvas , edge ) ; double labelHeight = 0.0 ; double labelWidth = 0.0 ; double tickLabelBandsDimension = 0.0 ; for ( int i = 0 ; i < this . labelInfo . length ; i ++ ) { PeriodAxisLabelInfo info = this . labelInfo [ i ] ; Paint paint = PaintUtility . createPaint ( Paint . ANTI_ALIAS_FLAG , info . getLabelPaintType ( ) , info . getLabelFont ( ) ) ; FontMetrics fm = paint . getFontMetrics ( ) ; tickLabelBandsDimension += info . getPadding ( ) . extendHeight ( fm . bottom - fm . top ) ; } if ( RectangleEdge . isTopOrBottom ( edge ) ) { labelHeight = labelEnclosure . getHeight ( ) ; space . add ( labelHeight + tickLabelBandsDimension , edge ) ; } else if ( RectangleEdge . isLeftOrRight ( edge ) ) { labelWidth = labelEnclosure . getWidth ( ) ; space . add ( labelWidth + tickLabelBandsDimension , edge ) ; } double tickMarkSpace = 0.0 ; if ( isTickMarksVisible ( ) ) { tickMarkSpace = getTickMarkOutsideLength ( ) ; } if ( this . minorTickMarksVisible ) { tickMarkSpace = Math . max ( tickMarkSpace , this . minorTickMarkOutsideLength ) ; } space . add ( tickMarkSpace , edge ) ; return space ; }
Estimates the space (height or width) required to draw the axis.
Estimates the space ( height or width ) required to draw the axis .
// create a new space object if one wasn't supplied... // if the axis is not visible, no additional space is required... // if the axis has a fixed dimension, return it... // get the axis label size and update the space object... //                += info.getPadding().extendHeight(fm.getHeight()); // add space for the outer tick labels, if any...