afreechart/src/main/java/org/afree/chart/title/TextTitle.java
/**
     * Draws a the title horizontally within the specified area. This method
     * will be called from the {@link #draw(Graphics2D, RectShape) draw}
     * method.
     * 
     * @param canvas
     *            the graphics device.
     * @param area
     *            the area for the title.
     */
Draws a the title horizontally within the specified area. This method
will be called from the  #draw(Graphics2D, RectShape) draw
method.

@param canvas
the graphics device.
@param area
the area for the title.
Draws a the title horizontally within the specified area . This method will be called from the #draw ( Graphics2D RectShape ) draw method . @param canvas the graphics device . @param area the area for the title .
protected void drawHorizontal(Canvas canvas, RectShape area) {
        RectShape titleArea = (RectShape) area.clone();
        TextBlockAnchor anchor = null;
        float x = 0.0f;
        HorizontalAlignment horizontalAlignment = getHorizontalAlignment();
        if (horizontalAlignment == HorizontalAlignment.LEFT) {
            x = (float) titleArea.getX();
            anchor = TextBlockAnchor.TOP_LEFT;
        } else if (horizontalAlignment == HorizontalAlignment.RIGHT) {
            x = (float) titleArea.getMaxX();
            anchor = TextBlockAnchor.TOP_RIGHT;
        } else if (horizontalAlignment == HorizontalAlignment.CENTER) {
            x = (float) titleArea.getCenterX();
            anchor = TextBlockAnchor.TOP_CENTER;
        }
        float y = 0.0f;
        RectangleEdge position = getPosition();
        if (position == RectangleEdge.TOP) {
            y = (float) titleArea.getY();
        } else if (position == RectangleEdge.BOTTOM) {
            y = (float) titleArea.getMaxY();
            if (horizontalAlignment == HorizontalAlignment.LEFT) {
                anchor = TextBlockAnchor.BOTTOM_LEFT;
            } else if (horizontalAlignment == HorizontalAlignment.CENTER) {
                anchor = TextBlockAnchor.BOTTOM_CENTER;
            } else if (horizontalAlignment == HorizontalAlignment.RIGHT) {
                anchor = TextBlockAnchor.BOTTOM_RIGHT;
            }
        }
        this.content.draw(canvas, x, y, anchor);
    }
protected void drawHorizontal ( Canvas canvas , RectShape area ) { RectShape titleArea = ( RectShape ) area . clone ( ) ; TextBlockAnchor anchor = null ; float x = 0.0f ; HorizontalAlignment horizontalAlignment = getHorizontalAlignment ( ) ; if ( horizontalAlignment == HorizontalAlignment . LEFT ) { x = ( float ) titleArea . getX ( ) ; anchor = TextBlockAnchor . TOP_LEFT ; } else if ( horizontalAlignment == HorizontalAlignment . RIGHT ) { x = ( float ) titleArea . getMaxX ( ) ; anchor = TextBlockAnchor . TOP_RIGHT ; } else if ( horizontalAlignment == HorizontalAlignment . CENTER ) { x = ( float ) titleArea . getCenterX ( ) ; anchor = TextBlockAnchor . TOP_CENTER ; } float y = 0.0f ; RectangleEdge position = getPosition ( ) ; if ( position == RectangleEdge . TOP ) { y = ( float ) titleArea . getY ( ) ; } else if ( position == RectangleEdge . BOTTOM ) { y = ( float ) titleArea . getMaxY ( ) ; if ( horizontalAlignment == HorizontalAlignment . LEFT ) { anchor = TextBlockAnchor . BOTTOM_LEFT ; } else if ( horizontalAlignment == HorizontalAlignment . CENTER ) { anchor = TextBlockAnchor . BOTTOM_CENTER ; } else if ( horizontalAlignment == HorizontalAlignment . RIGHT ) { anchor = TextBlockAnchor . BOTTOM_RIGHT ; } } this . content . draw ( canvas , x , y , anchor ) ; }
Draws a the title horizontally within the specified area.
Draws a the title horizontally within the specified area .
// canvas.setFont(this.font);