Example usage for org.jfree.chart.renderer AbstractRenderer setPositiveItemLabelPosition

List of usage examples for org.jfree.chart.renderer AbstractRenderer setPositiveItemLabelPosition

Introduction

In this page you can find the example usage for org.jfree.chart.renderer AbstractRenderer setPositiveItemLabelPosition.

Prototype

public void setPositiveItemLabelPosition(ItemLabelPosition position) 

Source Link

Document

Sets the item label position for positive values in ALL series, and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:org.openfaces.component.chart.impl.plots.PlotUtil.java

private static void defaultInit(PlotOrientation orientation, AbstractRenderer renderer) {
    if (orientation == PlotOrientation.HORIZONTAL) {
        ItemLabelPosition position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT);
        renderer.setPositiveItemLabelPosition(position1);
        ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE9, TextAnchor.CENTER_RIGHT);
        renderer.setNegativeItemLabelPosition(position2);
    } else if (orientation == PlotOrientation.VERTICAL) {
        ItemLabelPosition position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,
                TextAnchor.BOTTOM_CENTER);
        renderer.setPositiveItemLabelPosition(position1);
        ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER);
        renderer.setNegativeItemLabelPosition(position2);
    }/*from w  w w. j av  a 2 s  .  co m*/

}

From source file:org.toobsframework.pres.chart.ChartUtil.java

public static void configureDomainItemLabels(IRequest componentRequest, BasePlot plot,
        AbstractRenderer renderer, Map params, boolean is3D) {
    if (plot.getShowDomainItemLabels()) {
        String orientation = ParameterUtil.resolveParam(componentRequest, plot.getOrientation(), params,
                "horizontal")[0];
        if (orientation.equals("horizontal")) {
            ItemLabelPosition position1;
            if (is3D) {
                position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE2, TextAnchor.CENTER_LEFT);
                renderer.setItemLabelAnchorOffset(15.0d);
            } else {
                position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT);
            }/*from  w w  w .j a v a  2  s .c  o  m*/
            renderer.setPositiveItemLabelPosition(position1);

            ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE9,
                    TextAnchor.CENTER_RIGHT);
            renderer.setNegativeItemLabelPosition(position2);
        } else if (orientation.equals("vertical")) {
            ItemLabelPosition position1;
            if (is3D) {
                position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BOTTOM_CENTER);
                renderer.setItemLabelAnchorOffset(10.0d);
            } else {
                position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER);
            }
            renderer.setPositiveItemLabelPosition(position1);

            ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6,
                    TextAnchor.TOP_CENTER);
            renderer.setNegativeItemLabelPosition(position2);
        }
        renderer.setBaseItemLabelsVisible(true);
        ((CategoryItemRenderer) renderer).setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    }
}