Example usage for org.jfree.chart.labels ItemLabelAnchor INSIDE9

List of usage examples for org.jfree.chart.labels ItemLabelAnchor INSIDE9

Introduction

In this page you can find the example usage for org.jfree.chart.labels ItemLabelAnchor INSIDE9.

Prototype

ItemLabelAnchor INSIDE9

To view the source code for org.jfree.chart.labels ItemLabelAnchor INSIDE9.

Click Source Link

Document

INSIDE9.

Usage

From source file:com.att.aro.ui.view.waterfalltab.WaterfallPanel.java

/**
 * /*w w w .j  a  va2  s.c  o  m*/
 * @return
 */
private ChartPanel getChartPanel() {

    if (chartPanel == null) {

        renderer = new StackedBarRenderer();
        renderer.setMaximumBarWidth(0.05);
        renderer.setShadowVisible(false);

        renderer.setBaseToolTipGenerator(new CategoryToolTipGenerator() {
            @Override
            public String generateToolTip(CategoryDataset dataset, int row, int column) {

                WaterfallCategory wfCategory = (WaterfallCategory) dataset.getColumnKey(column);
                return wfCategory.getTooltip();
            }
        });
        renderer.setBaseItemLabelsVisible(true);
        renderer.setBasePositiveItemLabelPosition(
                new ItemLabelPosition(ItemLabelAnchor.INSIDE9, TextAnchor.CENTER_LEFT));
        renderer.setPositiveItemLabelPositionFallback(
                new ItemLabelPosition(ItemLabelAnchor.INSIDE9, TextAnchor.CENTER_LEFT));

        // Set up plot
        CategoryPlot plot = new CategoryPlot(new DefaultCategoryDataset(), getCategoryAxis(), getTimeAxis(),
                renderer);
        plot.setOrientation(PlotOrientation.HORIZONTAL);
        plot.setDomainGridlinesVisible(true);
        plot.setDomainGridlinePosition(CategoryAnchor.END);

        JFreeChart chart = new JFreeChart(plot);
        chartPanel = new ChartPanel(chart, 400, 200, 200, 200, 2000, 5000, true, false, false, false, false,
                true);
        chartPanel.setMouseZoomable(false);
        chartPanel.setRangeZoomable(false);
        chartPanel.setDomainZoomable(false);
        chartPanel.addChartMouseListener(new ChartMouseListener() {

            @Override
            public void chartMouseMoved(ChartMouseEvent arg0) {
                // Do Nothing
            }

            @Override
            public void chartMouseClicked(ChartMouseEvent event) {

                //TODO Add listner info or separate the listener.
                if (event.getEntity() instanceof CategoryItemEntity) {
                    CategoryItemEntity xyitem = (CategoryItemEntity) event.getEntity();
                    WaterfallCategory wfCategory = (WaterfallCategory) xyitem.getColumnKey();
                    if (wfCategory != null && wfCategory.getReqResp() != null) {
                        int count = event.getTrigger().getClickCount();
                        if (count > 1) {
                            waterfallTab.updateMainFrame(wfCategory.getSession());
                        } else {
                            popup.refresh(wfCategory.getReqResp(), wfCategory.getIndex());
                            if (!popup.getPopupDialog().isVisible()) {
                                popup.getPopupDialog().setVisible(true);
                            }
                        }
                    }
                }

            }
        });
    }

    return chartPanel;
}

From source file:com.newatlanta.bluedragon.CustomClusteredXYBarRenderer.java

private Point2D calculateLabelAnchorPoint(ItemLabelAnchor anchor, Rectangle2D bar,
        PlotOrientation orientation) {//from  w  ww  .jav a 2 s .  c  om
    Point2D result = null;
    double offset = getItemLabelAnchorOffset();
    double x0 = bar.getX() - offset;
    double x1 = bar.getX();
    double x2 = bar.getX() + offset;
    double x3 = bar.getCenterX();
    double x4 = bar.getMaxX() - offset;
    double x5 = bar.getMaxX();
    double x6 = bar.getMaxX() + offset;

    double y0 = bar.getMaxY() + offset;
    double y1 = bar.getMaxY();
    double y2 = bar.getMaxY() - offset;
    double y3 = bar.getCenterY();
    double y4 = bar.getMinY() + offset;
    double y5 = bar.getMinY();
    double y6 = bar.getMinY() - offset;

    if (anchor == ItemLabelAnchor.CENTER) {
        result = new Point2D.Double(x3, y3);
    } else if (anchor == ItemLabelAnchor.INSIDE1) {
        result = new Point2D.Double(x4, y4);
    } else if (anchor == ItemLabelAnchor.INSIDE2) {
        result = new Point2D.Double(x4, y4);
    } else if (anchor == ItemLabelAnchor.INSIDE3) {
        result = new Point2D.Double(x4, y3);
    } else if (anchor == ItemLabelAnchor.INSIDE4) {
        result = new Point2D.Double(x4, y2);
    } else if (anchor == ItemLabelAnchor.INSIDE5) {
        result = new Point2D.Double(x4, y2);
    } else if (anchor == ItemLabelAnchor.INSIDE6) {
        result = new Point2D.Double(x3, y2);
    } else if (anchor == ItemLabelAnchor.INSIDE7) {
        result = new Point2D.Double(x2, y2);
    } else if (anchor == ItemLabelAnchor.INSIDE8) {
        result = new Point2D.Double(x2, y2);
    } else if (anchor == ItemLabelAnchor.INSIDE9) {
        result = new Point2D.Double(x2, y3);
    } else if (anchor == ItemLabelAnchor.INSIDE10) {
        result = new Point2D.Double(x2, y4);
    } else if (anchor == ItemLabelAnchor.INSIDE11) {
        result = new Point2D.Double(x2, y4);
    } else if (anchor == ItemLabelAnchor.INSIDE12) {
        result = new Point2D.Double(x3, y4);
    } else if (anchor == ItemLabelAnchor.OUTSIDE1) {
        result = new Point2D.Double(x5, y6);
    } else if (anchor == ItemLabelAnchor.OUTSIDE2) {
        result = new Point2D.Double(x6, y5);
    } else if (anchor == ItemLabelAnchor.OUTSIDE3) {
        result = new Point2D.Double(x6, y3);
    } else if (anchor == ItemLabelAnchor.OUTSIDE4) {
        result = new Point2D.Double(x6, y1);
    } else if (anchor == ItemLabelAnchor.OUTSIDE5) {
        result = new Point2D.Double(x5, y0);
    } else if (anchor == ItemLabelAnchor.OUTSIDE6) {
        result = new Point2D.Double(x3, y0);
    } else if (anchor == ItemLabelAnchor.OUTSIDE7) {
        result = new Point2D.Double(x1, y0);
    } else if (anchor == ItemLabelAnchor.OUTSIDE8) {
        result = new Point2D.Double(x0, y1);
    } else if (anchor == ItemLabelAnchor.OUTSIDE9) {
        result = new Point2D.Double(x0, y3);
    } else if (anchor == ItemLabelAnchor.OUTSIDE10) {
        result = new Point2D.Double(x0, y5);
    } else if (anchor == ItemLabelAnchor.OUTSIDE11) {
        result = new Point2D.Double(x1, y6);
    } else if (anchor == ItemLabelAnchor.OUTSIDE12) {
        result = new Point2D.Double(x3, y6);
    }

    return result;
}

From source file:edu.ucla.stat.SOCR.motionchart.MotionBubbleRenderer.java

/**
 * Calculates the item label anchor point.
 *
 * @param anchor      the anchor.// w w w  .  j av  a 2 s .  co  m
 * @param x           the x coordinate.
 * @param y           the y coordinate.
 * @param orientation the plot orientation.
 * @return The anchor point (never <code>null</code>).
 */
@Override
protected Point2D calculateLabelAnchorPoint(ItemLabelAnchor anchor, double x, double y,
        PlotOrientation orientation) {
    Point2D result = null;
    double sizeX = 2.0 * this.itemLabelAnchorOffset;
    double sizeY = 2.0 * this.itemLabelAnchorOffset;

    if (currCircle != null) {
        sizeX = currCircle.getWidth() / 2.0 + this.itemLabelAnchorOffset;
        sizeY = currCircle.getHeight() / 2.0 + this.itemLabelAnchorOffset;
    }

    if (anchor == ItemLabelAnchor.CENTER) {
        result = new Point2D.Double(x, y);
    } else if (anchor == ItemLabelAnchor.INSIDE1) {
        result = new Point2D.Double(x + OPP * this.itemLabelAnchorOffset, y - ADJ * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE2) {
        result = new Point2D.Double(x + ADJ * this.itemLabelAnchorOffset, y - OPP * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE3) {
        result = new Point2D.Double(x + this.itemLabelAnchorOffset, y);
    } else if (anchor == ItemLabelAnchor.INSIDE4) {
        result = new Point2D.Double(x + ADJ * this.itemLabelAnchorOffset, y + OPP * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE5) {
        result = new Point2D.Double(x + OPP * this.itemLabelAnchorOffset, y + ADJ * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE6) {
        result = new Point2D.Double(x, y + this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE7) {
        result = new Point2D.Double(x - OPP * this.itemLabelAnchorOffset, y + ADJ * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE8) {
        result = new Point2D.Double(x - ADJ * this.itemLabelAnchorOffset, y + OPP * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE9) {
        result = new Point2D.Double(x - this.itemLabelAnchorOffset, y);
    } else if (anchor == ItemLabelAnchor.INSIDE10) {
        result = new Point2D.Double(x - ADJ * this.itemLabelAnchorOffset, y - OPP * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE11) {
        result = new Point2D.Double(x - OPP * this.itemLabelAnchorOffset, y - ADJ * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE12) {
        result = new Point2D.Double(x, y - this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.OUTSIDE1) {
        result = new Point2D.Double(x + sizeX * OPP, y - sizeY * ADJ);
    } else if (anchor == ItemLabelAnchor.OUTSIDE2) {
        result = new Point2D.Double(x + sizeX * ADJ, y - sizeY * OPP);
    } else if (anchor == ItemLabelAnchor.OUTSIDE3) {
        result = new Point2D.Double(x + sizeX, y);
    } else if (anchor == ItemLabelAnchor.OUTSIDE4) {
        result = new Point2D.Double(x + sizeX * ADJ, y + sizeY * OPP);
    } else if (anchor == ItemLabelAnchor.OUTSIDE5) {
        result = new Point2D.Double(x + sizeX * OPP, y + sizeY * ADJ);
    } else if (anchor == ItemLabelAnchor.OUTSIDE6) {
        result = new Point2D.Double(x, y + sizeY);
    } else if (anchor == ItemLabelAnchor.OUTSIDE7) {
        result = new Point2D.Double(x - sizeX * OPP, y + sizeY * ADJ);
    } else if (anchor == ItemLabelAnchor.OUTSIDE8) {
        result = new Point2D.Double(x - sizeX * ADJ, y + sizeY * OPP);
    } else if (anchor == ItemLabelAnchor.OUTSIDE9) {
        result = new Point2D.Double(x - sizeX, y);
    } else if (anchor == ItemLabelAnchor.OUTSIDE10) {
        result = new Point2D.Double(x - sizeX * ADJ, y - sizeY * OPP);
    } else if (anchor == ItemLabelAnchor.OUTSIDE11) {
        result = new Point2D.Double(x - sizeX * OPP, y - sizeY * ADJ);
    } else if (anchor == ItemLabelAnchor.OUTSIDE12) {
        result = new Point2D.Double(x, y - sizeY);
    }
    return result;
}

From source file:KIDLYRenderer.java

/**
 * Calculates the item label anchor point.
 *
 * @param anchor  the anchor./*from  w w w .ja  v a 2  s .  co  m*/
 * @param bar  the bar.
 * @param orientation  the plot orientation.
 *
 * @return The anchor point.
 */
private Point2D calculateLabelAnchorPoint(ItemLabelAnchor anchor, Rectangle2D bar,
        PlotOrientation orientation) {

    Point2D result = null;
    double offset = getItemLabelAnchorOffset();
    double x0 = bar.getX() - offset;
    double x1 = bar.getX();
    double x2 = bar.getX() + offset;
    double x3 = bar.getCenterX();
    double x4 = bar.getMaxX() - offset;
    double x5 = bar.getMaxX();
    double x6 = bar.getMaxX() + offset;

    double y0 = bar.getMaxY() + offset;
    double y1 = bar.getMaxY();
    double y2 = bar.getMaxY() - offset;
    double y3 = bar.getCenterY();
    double y4 = bar.getMinY() + offset;
    double y5 = bar.getMinY();
    double y6 = bar.getMinY() - offset;

    if (anchor == ItemLabelAnchor.CENTER) {
        result = new Point2D.Double(x3, y3);
    } else if (anchor == ItemLabelAnchor.INSIDE1) {
        result = new Point2D.Double(x4, y4);
    } else if (anchor == ItemLabelAnchor.INSIDE2) {
        result = new Point2D.Double(x4, y4);
    } else if (anchor == ItemLabelAnchor.INSIDE3) {
        result = new Point2D.Double(x4, y3);
    } else if (anchor == ItemLabelAnchor.INSIDE4) {
        result = new Point2D.Double(x4, y2);
    } else if (anchor == ItemLabelAnchor.INSIDE5) {
        result = new Point2D.Double(x4, y2);
    } else if (anchor == ItemLabelAnchor.INSIDE6) {
        result = new Point2D.Double(x3, y2);
    } else if (anchor == ItemLabelAnchor.INSIDE7) {
        result = new Point2D.Double(x2, y2);
    } else if (anchor == ItemLabelAnchor.INSIDE8) {
        result = new Point2D.Double(x2, y2);
    } else if (anchor == ItemLabelAnchor.INSIDE9) {
        result = new Point2D.Double(x2, y3);
    } else if (anchor == ItemLabelAnchor.INSIDE10) {
        result = new Point2D.Double(x2, y4);
    } else if (anchor == ItemLabelAnchor.INSIDE11) {
        result = new Point2D.Double(x2, y4);
    } else if (anchor == ItemLabelAnchor.INSIDE12) {
        result = new Point2D.Double(x3, y4);
    } else if (anchor == ItemLabelAnchor.OUTSIDE1) {
        result = new Point2D.Double(x5, y6);
    } else if (anchor == ItemLabelAnchor.OUTSIDE2) {
        result = new Point2D.Double(x6, y5);
    } else if (anchor == ItemLabelAnchor.OUTSIDE3) {
        result = new Point2D.Double(x6, y3);
    } else if (anchor == ItemLabelAnchor.OUTSIDE4) {
        result = new Point2D.Double(x6, y1);
    } else if (anchor == ItemLabelAnchor.OUTSIDE5) {
        result = new Point2D.Double(x5, y0);
    } else if (anchor == ItemLabelAnchor.OUTSIDE6) {
        result = new Point2D.Double(x3, y0);
    } else if (anchor == ItemLabelAnchor.OUTSIDE7) {
        result = new Point2D.Double(x1, y0);
    } else if (anchor == ItemLabelAnchor.OUTSIDE8) {
        result = new Point2D.Double(x0, y1);
    } else if (anchor == ItemLabelAnchor.OUTSIDE9) {
        result = new Point2D.Double(x0, y3);
    } else if (anchor == ItemLabelAnchor.OUTSIDE10) {
        result = new Point2D.Double(x0, y5);
    } else if (anchor == ItemLabelAnchor.OUTSIDE11) {
        result = new Point2D.Double(x1, y6);
    } else if (anchor == ItemLabelAnchor.OUTSIDE12) {
        result = new Point2D.Double(x3, y6);
    }

    return result;

}

From source file:KIDLYRenderer.java

/**
 * Returns <code>true</code> if the specified anchor point is inside a bar.
 *
 * @param anchor  the anchor point.//from   w  w w.  j a v  a2s .  co m
 *
 * @return A boolean.
 */
private boolean isInternalAnchor(ItemLabelAnchor anchor) {
    return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1
            || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3
            || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5
            || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7
            || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9
            || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11
            || anchor == ItemLabelAnchor.INSIDE12;
}

From source file:KIDLYAbstractRenderer.java

/**
 * Calculates the item label anchor point.
 *
 * @param anchor  the anchor.//  w  ww  .  j a  v a 2s.c o  m
 * @param x  the x coordinate.
 * @param y  the y coordinate.
 * @param orientation  the plot orientation.
 *
 * @return The anchor point (never <code>null</code>).
 */
protected Point2D calculateLabelAnchorPoint(ItemLabelAnchor anchor, double x, double y,
        PlotOrientation orientation) {
    Point2D result = null;
    if (anchor == ItemLabelAnchor.CENTER) {
        result = new Point2D.Double(x, y);
    } else if (anchor == ItemLabelAnchor.INSIDE1) {
        result = new Point2D.Double(x + OPP * this.itemLabelAnchorOffset, y - ADJ * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE2) {
        result = new Point2D.Double(x + ADJ * this.itemLabelAnchorOffset, y - OPP * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE3) {
        result = new Point2D.Double(x + this.itemLabelAnchorOffset, y);
    } else if (anchor == ItemLabelAnchor.INSIDE4) {
        result = new Point2D.Double(x + ADJ * this.itemLabelAnchorOffset, y + OPP * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE5) {
        result = new Point2D.Double(x + OPP * this.itemLabelAnchorOffset, y + ADJ * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE6) {
        result = new Point2D.Double(x, y + this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE7) {
        result = new Point2D.Double(x - OPP * this.itemLabelAnchorOffset, y + ADJ * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE8) {
        result = new Point2D.Double(x - ADJ * this.itemLabelAnchorOffset, y + OPP * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE9) {
        result = new Point2D.Double(x - this.itemLabelAnchorOffset, y);
    } else if (anchor == ItemLabelAnchor.INSIDE10) {
        result = new Point2D.Double(x - ADJ * this.itemLabelAnchorOffset, y - OPP * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE11) {
        result = new Point2D.Double(x - OPP * this.itemLabelAnchorOffset, y - ADJ * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.INSIDE12) {
        result = new Point2D.Double(x, y - this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.OUTSIDE1) {
        result = new Point2D.Double(x + 2.0 * OPP * this.itemLabelAnchorOffset,
                y - 2.0 * ADJ * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.OUTSIDE2) {
        result = new Point2D.Double(x + 2.0 * ADJ * this.itemLabelAnchorOffset,
                y - 2.0 * OPP * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.OUTSIDE3) {
        result = new Point2D.Double(x + 2.0 * this.itemLabelAnchorOffset, y);
    } else if (anchor == ItemLabelAnchor.OUTSIDE4) {
        result = new Point2D.Double(x + 2.0 * ADJ * this.itemLabelAnchorOffset,
                y + 2.0 * OPP * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.OUTSIDE5) {
        result = new Point2D.Double(x + 2.0 * OPP * this.itemLabelAnchorOffset,
                y + 2.0 * ADJ * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.OUTSIDE6) {
        result = new Point2D.Double(x, y + 2.0 * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.OUTSIDE7) {
        result = new Point2D.Double(x - 2.0 * OPP * this.itemLabelAnchorOffset,
                y + 2.0 * ADJ * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.OUTSIDE8) {
        result = new Point2D.Double(x - 2.0 * ADJ * this.itemLabelAnchorOffset,
                y + 2.0 * OPP * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.OUTSIDE9) {
        result = new Point2D.Double(x - 2.0 * this.itemLabelAnchorOffset, y);
    } else if (anchor == ItemLabelAnchor.OUTSIDE10) {
        result = new Point2D.Double(x - 2.0 * ADJ * this.itemLabelAnchorOffset,
                y - 2.0 * OPP * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.OUTSIDE11) {
        result = new Point2D.Double(x - 2.0 * OPP * this.itemLabelAnchorOffset,
                y - 2.0 * ADJ * this.itemLabelAnchorOffset);
    } else if (anchor == ItemLabelAnchor.OUTSIDE12) {
        result = new Point2D.Double(x, y - 2.0 * this.itemLabelAnchorOffset);
    }
    return result;
}

From source file:com.naryx.tagfusion.cfm.tag.awt.cfCHART.java

private void setCategoryItemLabelsData(AbstractCategoryItemRenderer renderer, cfCHARTSERIESData seriesData)
        throws cfmRunTimeException {
    // Set them as visible
    renderer.setItemLabelsVisible(true);

    // Set their color
    renderer.setItemLabelPaint(convertStringToColor(seriesData.getDataLabelColor()));

    // Set their font
    renderer.setItemLabelFont(getFont(seriesData.getDataLabelFont(), seriesData.getDataLabelFontBold(),
            seriesData.getDataLabelFontItalic(), seriesData.getDataLabelFontSize()));

    // Set the item label position for negative data values
    double degrees = seriesData.getDataLabelAngle();
    double radians = Math.toRadians(degrees);
    String negPosition = seriesData.getNegativeDataLabelPosition();
    if (negPosition.equals("top"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,
                TextAnchor.BOTTOM_CENTER, TextAnchor.CENTER, radians));
    else if (negPosition.equals("top_inside"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE12,
                TextAnchor.TOP_CENTER, TextAnchor.CENTER, radians));
    else if (negPosition.equals("left"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE9,
                TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, radians));
    else if (negPosition.equals("left_inside"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE9,
                TextAnchor.CENTER_LEFT, TextAnchor.CENTER, radians));
    else if (negPosition.equals("center"))
        renderer.setNegativeItemLabelPosition(
                new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, radians));
    else if (negPosition.equals("right"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3,
                TextAnchor.CENTER_LEFT, TextAnchor.CENTER, radians));
    else if (negPosition.equals("right_inside"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE3,
                TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, radians));
    else if (negPosition.equals("bottom_inside"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE6,
                TextAnchor.BOTTOM_CENTER, TextAnchor.CENTER, radians));
    else if (negPosition.equals("bottom"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6,
                TextAnchor.TOP_CENTER, TextAnchor.CENTER, radians));

    // Set the item label position for positive data values
    String posPosition = seriesData.getPositiveDataLabelPosition();
    if (posPosition.equals("top"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,
                TextAnchor.BOTTOM_CENTER, TextAnchor.CENTER, radians));
    else if (posPosition.equals("top_inside"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE12,
                TextAnchor.TOP_CENTER, TextAnchor.CENTER, radians));
    else if (posPosition.equals("left"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE9,
                TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, radians));
    else if (posPosition.equals("left_inside"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE9,
                TextAnchor.CENTER_LEFT, TextAnchor.CENTER, radians));
    else if (posPosition.equals("center"))
        renderer.setPositiveItemLabelPosition(
                new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, radians));
    else if (posPosition.equals("right"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3,
                TextAnchor.CENTER_LEFT, TextAnchor.CENTER, radians));
    else if (posPosition.equals("right_inside"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE3,
                TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, radians));
    else if (posPosition.equals("bottom_inside"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE6,
                TextAnchor.BOTTOM_CENTER, TextAnchor.CENTER, radians));
    else if (posPosition.equals("bottom"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6,
                TextAnchor.TOP_CENTER, TextAnchor.CENTER, radians));

    // With Bar graphs and an inside position, we want to force the item labels
    // to be drawn even if they don't fit inside the bar graph.
    if (renderer instanceof BarRenderer) {
        ((BarRenderer) renderer).setNegativeItemLabelPositionFallback(renderer.getNegativeItemLabelPosition());
        ((BarRenderer) renderer).setPositiveItemLabelPositionFallback(renderer.getPositiveItemLabelPosition());
    }/*from  w w  w .  j  a v a2 s  . c o m*/
}

From source file:com.naryx.tagfusion.cfm.tag.awt.cfCHART.java

private void setXYItemLabelsData(XYItemRenderer renderer, cfCHARTSERIESData seriesData)
        throws cfmRunTimeException {
    // Set them as visible
    renderer.setItemLabelsVisible(true);

    // Set their color
    renderer.setItemLabelPaint(convertStringToColor(seriesData.getDataLabelColor()));

    // Set their font
    renderer.setItemLabelFont(getFont(seriesData.getDataLabelFont(), seriesData.getDataLabelFontBold(),
            seriesData.getDataLabelFontItalic(), seriesData.getDataLabelFontSize()));

    // Set the item label position for negative data values
    double degrees = seriesData.getDataLabelAngle();
    double radians = Math.toRadians(degrees);
    String negPosition = seriesData.getNegativeDataLabelPosition();
    if (negPosition.equals("top"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,
                TextAnchor.BOTTOM_CENTER, TextAnchor.CENTER, radians));
    else if (negPosition.equals("top_inside"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE12,
                TextAnchor.TOP_CENTER, TextAnchor.CENTER, radians));
    else if (negPosition.equals("left"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE9,
                TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, radians));
    else if (negPosition.equals("left_inside"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE9,
                TextAnchor.CENTER_LEFT, TextAnchor.CENTER, radians));
    else if (negPosition.equals("center"))
        renderer.setNegativeItemLabelPosition(
                new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, radians));
    else if (negPosition.equals("right"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3,
                TextAnchor.CENTER_LEFT, TextAnchor.CENTER, radians));
    else if (negPosition.equals("right_inside"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE3,
                TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, radians));
    else if (negPosition.equals("bottom_inside"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE6,
                TextAnchor.BOTTOM_CENTER, TextAnchor.CENTER, radians));
    else if (negPosition.equals("bottom"))
        renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6,
                TextAnchor.TOP_CENTER, TextAnchor.CENTER, radians));

    // Set the item label position for positive data values
    String posPosition = seriesData.getPositiveDataLabelPosition();
    if (posPosition.equals("top"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,
                TextAnchor.BOTTOM_CENTER, TextAnchor.CENTER, radians));
    else if (posPosition.equals("top_inside"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE12,
                TextAnchor.TOP_CENTER, TextAnchor.CENTER, radians));
    else if (posPosition.equals("left"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE9,
                TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, radians));
    else if (posPosition.equals("left_inside"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE9,
                TextAnchor.CENTER_LEFT, TextAnchor.CENTER, radians));
    else if (posPosition.equals("center"))
        renderer.setPositiveItemLabelPosition(
                new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, radians));
    else if (posPosition.equals("right"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3,
                TextAnchor.CENTER_LEFT, TextAnchor.CENTER, radians));
    else if (posPosition.equals("right_inside"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE3,
                TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, radians));
    else if (posPosition.equals("bottom_inside"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE6,
                TextAnchor.BOTTOM_CENTER, TextAnchor.CENTER, radians));
    else if (posPosition.equals("bottom"))
        renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6,
                TextAnchor.TOP_CENTER, TextAnchor.CENTER, radians));
}