afreechart/src/main/java/org/afree/chart/renderer/xy/XYBarRenderer.java
/**
     * Draws an item label.  This method is provided as an alternative to
     * {@link #drawItemLabel(Graphics2D, PlotOrientation, XYDataset, int, int,
     * double, double, boolean)} so that the bar can be used to calculate the
     * label anchor point.
     *
     * @param canvas  the graphics device.
     * @param dataset  the dataset.
     * @param series  the series index.
     * @param item  the item index.
     * @param plot  the plot.
     * @param generator  the label generator (<code>null</code> permitted, in
     *         which case the method does nothing, just returns).
     * @param bar  the bar.
     * @param negative  a flag indicating a negative value.
     */
Draws an item label.  This method is provided as an alternative to
{@link #drawItemLabel(Graphics2D, PlotOrientation, XYDataset, int, int,
double, double, boolean)} so that the bar can be used to calculate the
label anchor point.

@param canvas  the graphics device.
@param dataset  the dataset.
@param series  the series index.
@param item  the item index.
@param plot  the plot.
@param generator  the label generator (null permitted, in
which case the method does nothing, just returns).
@param bar  the bar.
@param negative  a flag indicating a negative value.
Draws an item label . This method is provided as an alternative to { @link #drawItemLabel ( Graphics2D PlotOrientation XYDataset int int double double boolean ) } so that the bar can be used to calculate the label anchor point . @param canvas the graphics device . @param dataset the dataset . @param series the series index . @param item the item index . @param plot the plot . @param generator the label generator ( null permitted in which case the method does nothing just returns ) . @param bar the bar . @param negative a flag indicating a negative value .
protected void drawItemLabel(Canvas canvas, XYDataset dataset,
            int series, int item, XYPlot plot, XYItemLabelGenerator generator,
            RectShape bar, boolean negative) {
        if (generator == null) {
            return;  
        }
        String label = generator.generateLabel(dataset, series, item);
        if (label == null) {
            return;  
        }
        ItemLabelPosition position = null;
        if (!negative) {
            position = getPositiveItemLabelPosition(series, item);
        }
        else {
            position = getNegativeItemLabelPosition(series, item);
        }
        PointF anchorPoint = calculateLabelAnchorPoint(
                position.getItemLabelAnchor(), bar, plot.getOrientation());
        /*
        if (isInternalAnchor(position.getItemLabelAnchor())) {
            Shape bounds = TextUtilities.calculateRotatedStringBounds(label,
                    canvas, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                    position.getTextAnchor(), position.getAngle(),
                    position.getRotationAnchor());
            if (bounds != null) {
                if (!bar.contains(bounds.getBounds())) {
                    if (!negative) {
                        position = getPositiveItemLabelPositionFallback();
                    }
                    else {
                        position = getNegativeItemLabelPositionFallback();
                    }
                    if (position != null) {
                        anchorPoint = calculateLabelAnchorPoint(
                                position.getItemLabelAnchor(), bar,
                                plot.getOrientation());
                    }
                }
            }
        }
        */
        if (position != null) {
            Paint paint = PaintUtility.createPaint(
                    Paint.ANTI_ALIAS_FLAG,
                    getItemLabelPaintType(series, item),
                    getItemLabelFont(series, item)
                    );
            TextUtilities.drawRotatedString(label, canvas,
                    (float) anchorPoint.x, (float) anchorPoint.y,
                    position.getTextAnchor(), position.getAngle(),
                    position.getRotationAnchor(),paint);
        }
    }
protected void drawItemLabel ( Canvas canvas , XYDataset dataset , int series , int item , XYPlot plot , XYItemLabelGenerator generator , RectShape bar , boolean negative ) { if ( generator == null ) { return ; } String label = generator . generateLabel ( dataset , series , item ) ; if ( label == null ) { return ; } ItemLabelPosition position = null ; if ( ! negative ) { position = getPositiveItemLabelPosition ( series , item ) ; } else { position = getNegativeItemLabelPosition ( series , item ) ; } PointF anchorPoint = calculateLabelAnchorPoint ( position . getItemLabelAnchor ( ) , bar , plot . getOrientation ( ) ) ; /*
        if (isInternalAnchor(position.getItemLabelAnchor())) {
            Shape bounds = TextUtilities.calculateRotatedStringBounds(label,
                    canvas, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                    position.getTextAnchor(), position.getAngle(),
                    position.getRotationAnchor());

            if (bounds != null) {
                if (!bar.contains(bounds.getBounds())) {
                    if (!negative) {
                        position = getPositiveItemLabelPositionFallback();
                    }
                    else {
                        position = getNegativeItemLabelPositionFallback();
                    }
                    if (position != null) {
                        anchorPoint = calculateLabelAnchorPoint(
                                position.getItemLabelAnchor(), bar,
                                plot.getOrientation());
                    }
                }
            }

        }
        */ if ( position != null ) { Paint paint = PaintUtility . createPaint ( Paint . ANTI_ALIAS_FLAG , getItemLabelPaintType ( series , item ) , getItemLabelFont ( series , item ) ) ; TextUtilities . drawRotatedString ( label , canvas , ( float ) anchorPoint . x , ( float ) anchorPoint . y , position . getTextAnchor ( ) , position . getAngle ( ) , position . getRotationAnchor ( ) , paint ) ; } }
Draws an item label.
Draws an item label .
// nothing to do // nothing to do // find out where to place the label... // work out the label anchor point... //TextUtilities.drawRotatedString(label, canvas,