afreechart/src/main/java/org/afree/chart/annotations/XYTextAnnotation.java
/**
     * Draws the annotation.
     *
     * @param canvas  the graphics device.
     * @param plot  the plot.
     * @param dataArea  the data area.
     * @param domainAxis  the domain axis.
     * @param rangeAxis  the range axis.
     * @param rendererIndex  the renderer index.
     * @param info  an optional info object that will be populated with
     *              entity information.
     */
Draws the annotation.
@param canvas  the graphics device.
@param plot  the plot.
@param dataArea  the data area.
@param domainAxis  the domain axis.
@param rangeAxis  the range axis.
@param rendererIndex  the renderer index.
@param info  an optional info object that will be populated with
entity information.
Draws the annotation . @param canvas the graphics device . @param plot the plot . @param dataArea the data area . @param domainAxis the domain axis . @param rangeAxis the range axis . @param rendererIndex the renderer index . @param info an optional info object that will be populated with entity information .
public void draw(Canvas canvas, XYPlot plot, RectShape dataArea,
                     ValueAxis domainAxis, ValueAxis rangeAxis,
                     int rendererIndex,
                     PlotRenderingInfo info) {
        PlotOrientation orientation = plot.getOrientation();
        RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(
                plot.getDomainAxisLocation(), orientation);
        RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(
                plot.getRangeAxisLocation(), orientation);
        float anchorX = (float) domainAxis.valueToJava2D(
                this.x, dataArea, domainEdge);
        float anchorY = (float) rangeAxis.valueToJava2D(
                this.y, dataArea, rangeEdge);
        if (orientation == PlotOrientation.HORIZONTAL) {
            float tempAnchor = anchorX;
            anchorX = anchorY;
            anchorY = tempAnchor;
        }
        Paint paint = PaintUtility.createPaint(Paint.ANTI_ALIAS_FLAG, getPaintType(), getFont());
        RectShape hotspot = TextUtilities.calculateRotatedStringBounds(
                getText(), paint, anchorX, anchorY, getTextAnchor(),
                getRotationAngle(), getRotationAnchor());
        if (this.backgroundPaintType != null) {
            PaintUtility.updatePaint(paint, this.backgroundPaintType);
            hotspot.fill(canvas, paint);
        }
        PaintUtility.updatePaint(paint, this.backgroundPaintType);
        TextUtilities.drawRotatedString(getText(), canvas, anchorX, anchorY,
                getTextAnchor(), getRotationAngle(), getRotationAnchor(), paint);
        if (this.outlineVisible) {
            PaintUtility.updatePaint(paint, this.backgroundPaintType);
            paint.setStrokeWidth(this.outlineStroke);
            hotspot.draw(canvas, paint);
        }
        String toolTip = getToolTipText();
        String url = getURL();
        if (toolTip != null || url != null) {
            addEntity(info, hotspot, rendererIndex, toolTip, url);
        }
    }
public void draw ( Canvas canvas , XYPlot plot , RectShape dataArea , ValueAxis domainAxis , ValueAxis rangeAxis , int rendererIndex , PlotRenderingInfo info ) { PlotOrientation orientation = plot . getOrientation ( ) ; RectangleEdge domainEdge = Plot . resolveDomainAxisLocation ( plot . getDomainAxisLocation ( ) , orientation ) ; RectangleEdge rangeEdge = Plot . resolveRangeAxisLocation ( plot . getRangeAxisLocation ( ) , orientation ) ; float anchorX = ( float ) domainAxis . valueToJava2D ( this . x , dataArea , domainEdge ) ; float anchorY = ( float ) rangeAxis . valueToJava2D ( this . y , dataArea , rangeEdge ) ; if ( orientation == PlotOrientation . HORIZONTAL ) { float tempAnchor = anchorX ; anchorX = anchorY ; anchorY = tempAnchor ; } Paint paint = PaintUtility . createPaint ( Paint . ANTI_ALIAS_FLAG , getPaintType ( ) , getFont ( ) ) ; RectShape hotspot = TextUtilities . calculateRotatedStringBounds ( getText ( ) , paint , anchorX , anchorY , getTextAnchor ( ) , getRotationAngle ( ) , getRotationAnchor ( ) ) ; if ( this . backgroundPaintType != null ) { PaintUtility . updatePaint ( paint , this . backgroundPaintType ) ; hotspot . fill ( canvas , paint ) ; } PaintUtility . updatePaint ( paint , this . backgroundPaintType ) ; TextUtilities . drawRotatedString ( getText ( ) , canvas , anchorX , anchorY , getTextAnchor ( ) , getRotationAngle ( ) , getRotationAnchor ( ) , paint ) ; if ( this . outlineVisible ) { PaintUtility . updatePaint ( paint , this . backgroundPaintType ) ; paint . setStrokeWidth ( this . outlineStroke ) ; hotspot . draw ( canvas , paint ) ; } String toolTip = getToolTipText ( ) ; String url = getURL ( ) ; if ( toolTip != null || url != null ) { addEntity ( info , hotspot , rendererIndex , toolTip , url ) ; } }
Draws the annotation.
Draws the annotation .