List of usage examples for org.jfree.chart.renderer AbstractRenderer setItemLabelAnchorOffset
public void setItemLabelAnchorOffset(double offset)
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); }// w w w . j a va 2s . 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()); } }
From source file:org.openfaces.component.chart.impl.configuration.GridLabelsConfigurator.java
private void defaultInit(GridChartView chartView, AbstractRenderer renderer) { final ChartLabelPosition positiveLabelsPosition = chartView.getPositiveLabelsPosition(); final ChartLabelPosition negativeLabelsPosition = chartView.getNegativeLabelsPosition(); final ChartLabelPosition defaultLabelPosition = chartView.getDefaultLabelsPosition(); if (defaultLabelPosition != null && positiveLabelsPosition == null) { renderer.setBasePositiveItemLabelPosition(createItemLabelPosition(defaultLabelPosition)); } else if (positiveLabelsPosition != null) { renderer.setBasePositiveItemLabelPosition(createItemLabelPosition(positiveLabelsPosition)); }/*from w w w .ja v a 2s . c o m*/ if (defaultLabelPosition != null && negativeLabelsPosition == null) { renderer.setBaseNegativeItemLabelPosition(createItemLabelPosition(defaultLabelPosition)); } else if (negativeLabelsPosition != null) { renderer.setBaseNegativeItemLabelPosition(createItemLabelPosition(negativeLabelsPosition)); } renderer.setItemLabelAnchorOffset(chartView.getLabelsOffset()); }